#arma3_scripting
1 messages ยท Page 461 of 1
and then when they reach the center they go let's say again 5km way in random degree
or optionally straight
isn't that a kind of vectoring?
i would say in Spanish "Vectores en el plano cartesiano" ( vectors in cartesian plane )
it is in the math sense
vactor is the direction of travel from a point in space to another point along a line
what you need to do is first generate a random position on the map or specific position and work from there
remember it has to be 5km away from the center given
say you want the copter to land at a specific point
it's easy to made it 1 time manually
but the thing it's make a formula/script/function whatever to do that dynamic just giving the center and the distance
for example you have a marker at the spot, grab its position and chose a random direction and add 5km along its x, y cords
how do i chosse a ramdon direction?
i can getDir/setDir but i can't say, hey in this direction giveme a random position from 5km away :p
or do i can?
yes, this will spin the "choppers" to this direction
but how u will get the position 5km away in this direction?
and another thing, how do you sping choppers pointing to the center given?
i would look at DreadedEntity post here https://community.bistudio.com/wiki/setVectorDir
found it
@late gull i think thats the command youre looking for
it will return a position from the object you want at a minimum distance you specify, then all you have to do is use createVehicle at that possition
then set the waypoint to the object you run the relPos off of and do it again to get a new position for the next waypoint out.
or you could just make the copter return to its starting location
@dry egret check the page: use getPos's alternative syntax
you could use that if you combined it with a random number for the direction
donno what one is faster though if we are talking about speed though
getPos is faster.
i have not learned how to speed test scripts just yet
< still learning the arma scripting
you can use the editor debug and use the benchmark button (bottom left of the input field) ๐
๐
does arma scripting support nested execution?
like in c++ how a function parameter can have a function as a parameter?
well, you can have code as parameter
Did someone say vector?
@little eagle i think me and Lou got him pointed in the right direction
Vectored in the right direction*
@warm bronze lmao, perfect name for that comment
๐คทโโ๏ธ
No, irony deals with opposites. This is just a coincidence.
got a small issue here.
cursorObject addAction [localize"STR_MAR_Drug_Dealer",lega_fnc_openDialog, ['Drug Dealer','drugdealer'],0,false,false,"",'isNull objectParent player && player distance _target < 5 && playerSide isEqualTo civilian'];
``` is working fine through debug console on the server yet
```sqf
this addAction [localize"STR_MAR_Drug_Dealer",lega_fnc_openDialog, ['Drug Dealer','drugdealer'],0,false,false,"",'isNull objectParent player && player distance _target < 5 && playerSide isEqualTo civilian'];
``` isnt working in the init in the mission.sqm, the option shows up but does nothing.
now this is fucked xD
changing lega_fnc_openDialog for {_this call lega_fnc_openDialog} works xD
the syntax should be addAction [<string>,<string>,... or addAction [<string>,<code>,... and you have addAction [<string>,lega_fnc_openDialog...๐
lega_fnc_openDialog would be code i imagine
#define LEGA_DIALOG (call{\
/*something */ \
})
``` like zo... maybe will works ๐
lega_fnc_openDialog probably isnt set when the addaction is added
#define FUNC_CALL {\
hint "IT WORKS";\
}
test_fnc_call = {hint "IT WORKS AGAIN";};
player addAction ["Test", FUNC_CALL];
player addAction ["Test 2", test_fnc_call];
actually both works ๐ค
so addaction script is just call compile <string> or call <code>๐ค
never tried it that way ^
@meager heart addAction converts the code to a string or takes the string directly. And then call compile's each time the action is executed
code is code. No matter if in a variable or directly.
variables are resolved sooner. The command can't even see that you passed a variable
i see, ty for the clarifications
i thought there is something more than just typeName checks
How do I make "reply to an incoming message" system ? example : https://i.hizliresim.com/oVQRZQ.jpg
@rancid pecan link no work
This is my current command im exicuting and id like to know how to do this using the new commands that replace BIS_fnc_MP... iv looked at the wiki but i cant figure it out.
[[[],"cys_tasking\missionCombat.sqf"],"BIS_fnc_execVM",false] call BIS_fnc_MP;
@still forum is ti link working ?
yes. I already answered you ^
[[],"cys_tasking\missionCombat.sqf"] remoteExec ["BIS_fnc_execVM", 0];
Why BIS_fnc_execVM? why not execVM or spawn
also 0 < for the targets is default
@still forum Thanks a ton, i could not figure out the syntax for the life of me
@still forum Iv always used the BIS_fnc_execVM.
is their a better way of calling this? should i be using one of the others instead?
params [["_args1", []], "_args2"];
// --- input format: "script" or ["script"]
if (isNil "_args2" && _args1 isEqualType "") exitWith {[] execVM _args1};
// --- input format: [param, "script"]
if (!isNil "_args2" && {_args2 isEqualType ""}) exitWith {_args1 execVM _args2};
// --- error and suggest supported format
[_this, "isEqualTypeParams", [nil, ""]] call (missionNamespace getVariable "BIS_fnc_errorParamsType");
scriptNull
BIS_fnc_execVM ^ ๐
just use execVM
really wanting a facepaml emoji right now
๐ค ๐ด
lol
๐คฆ ?
๐ต
Anyone knows how to get a helicopter to pickup a car reliable half way into a mission where the have moved?
I done s pickup waypoint which works when i put it on the car, but then if I drive away.. it doesn't
So then I tried a setwppos at the car position, helicopter flew there. But no pickup
AI can lift vehicles? xD
Yeah :)
that's pretty
I don't know what kind of magic happens when you put a waypoint on top of a vehicle /building but in the editor it can sorta attach.
Wonder if I can do the same but dynamically ingame?
maybe with attach
Found a thread that seemed to kinda solved it.
Gives some new input to test tonight
{
if ({_x distance _x < 5} count allPlayers > 0) then {doThings};
} forEach array;
I have an issue with the above as it requires two _x's to be used. What is the solution to this?
move your first _x into a variable
I get what you mean but im not sure how I can do that due to the nature of {_x distance Object} count AllPlayers > 0
{
_v = _x;
if ({_v distance _x < 5} count allPlayers > 0) then {doThings};
} forEach array;
http://killzonekid.com/arma-scripting-tutorials-variables-part-1/
their is another use of using 2 _x in the nested loop section
"Wow you can really set a variable?" "Wow. You really can set a variable"
seriously? ๐
No i understand that Dedmen and how it looks dumb, but I saw it as seeing both as just _x and doing _v = _x doing nothing
But I've misunderstood that
no need to take the piss man ๐
you mean you thought _x changing would also overwrite _v then?
prolly
i dont think arma scripting has pointers lol
they.. do... kinda
Yes essentially, but also no
That doesn't happen because the = operator creates a "copy"
If you are unfamiliar with it, and doesn't know that _x gets created again and again (inside the {}forEach Part), it would look like: Compare A with A (with another name :D)
can someone tell why BI now is using the second approach to compute mapSize
_bbr = boundingBoxReal _object;
_maxWidth = abs (((_bbr select 1) select 0) - ((_bbr select 0) select 0));
_maxLength = abs (((_bbr select 1) select 1) - ((_bbr select 0) select 1));
_mapSize = _maxWidth max _maxLength;
_mapSize = (round (_mapSize * 100)) / 100;
_maxWidth = abs ((_bbr select 1) select 0)) + abs (((_bbr select 0) select 0);
_maxLength = abs ((_bbr select 1) select 1)) + abs (((_bbr select 0) select 1);
//same
_mapSize = _maxWidth max _maxLength;
_mapSize = (round (_mapSize * 100)) / 100;```
for most vehicles the result is the same, but some get different results
@velvet merlin if got you right, you are asking why bbr is different for same class of vehicle - then it's not possible to be that way. If that was around that bbr is not accurate, well yes. I've seen vanilla signs to be in a size of a car
Does anyone know how to make automatic generated variables? E.G. A variable that changes names every time the script loads.
just generate a random string then assign the value to it?
I can only find documentation on the variable 'random' which generates a number?
give me a sec and ill write out what i mean
private _name = "someName";
missionNamespace setVariable ["prefix_" + _name, <value>];
// global variable "prefix_someName" is available
But you need to think if you really need dynamic variable names. Usually it can be a sign of code that could be written in better way.
{
_characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" splitstring "";
_output = [];
_output resize 10; // 10 is the length of the string
_output apply {selectRandom _characters} joinString ""
};
that kind of thing to give you a random string. take note of what veteran said though ^
anyone know anything about handle damage being buggy asf
12:45:20 "T 1122.98 : [[civ_1,""spine1"",2.15749,civ_2,""B_9x21_Ball"",4,civ_2,""hitabdomen""]]"
12:45:20 "T 1122.98 : [[civ_1,""spine2"",2.15749,civ_2,""B_9x21_Ball"",5,civ_2,""hitdiaphragm""]]"
12:45:20 "T 1122.98 : [[civ_1,""body"",0.000252492,civ_2,""B_9x21_Ball"",11,civ_2,""incapacitated""]]"
12:45:20 "T 1122.98 : [[civ_1,"""",0.089633,civ_2,""B_9x21_Ball"",-1,civ_2,""""]]"
12:45:20 "T 1122.98 : [[civ_1,""spine1"",1.08835,civ_2,""B_9x21_Ball"",4,civ_2,""hitabdomen""]]"
12:45:20 "T 1122.98 : [[civ_1,""spine2"",1.08835,civ_2,""B_9x21_Ball"",5,civ_2,""hitdiaphragm""]]"
12:45:20 "T 1122.98 : [[civ_1,""body"",0.000124828,civ_2,""B_9x21_Ball"",11,civ_2,""incapacitated""]]"``` thats one shot
bullet travels through
that is understandable
but 2.15749 damage from 1 9mm shot o.O
@hollow thistle @robust hollow That's perfect, thank you chaps!
@wary vine Close range,,, long range... ?
close range
its a 9mm and its one shotting
as a temp fix I added if !(_index isEqualTo -1) exitWith {0};
seems to work
@robust hollow @hollow thistle A pretty stupid question but how would I call the variable after?
well... you can get it again doing missionNameSpace getvariable [<string>,{}] but you need to know the variable name for that
Well, this is the setup I'm attempting to do to obviously get the variable name and call the variable function.
_name = []call _generateStringBro;
missionNamespace setVariable ["jh_" + _name, "hint ""potato"";"];
_callMeBitch = missionNamespace getVariable ["jh_", _name];
[]call _callMeBitch;
you can't call a string
you can only call code
also your getVariable is wrong
You are getting the variable jh_ and if it's undefined it returns _name
You need to combine them.
Bingo, thank you. It's all working as wanted now โค
in the editor under groups >> empty, there are groups of objects defined. Is their a way to spawn them via scripting?
Hello, i am using ace3mod, and i was wondering if i can prohibit the access to the gas station, can you help ?
@dry egret sure. You can do almost everything through scripting. The question is just if it's easy or hard
@still forum im still googling but im not finding much on it.
since the object compositions are under the default arma groups, im not sure if its considered an eden composition.
they aren't
groups are a Arma2/ old editor thing
https://configs.arma3.ru/155.133137/configfile/CfgGroups.html
https://configs.arma3.ru/155.133137/configfile/CfgGroups/West/BLU_F/Infantry/BUS_InfSquad.html There is the group.
And in there you have the list of units. Their classname. Their relative position. Their rank
yeah im not wanting to spawn AI units.... im looking into the object groups that are under the group of props
like Fuel_dump
So I've tried to create some sort of event loop in mission that emits events when player is in certain area (in current case fob areas that are stored as array of markers).
It is kind of messy and needs to be moved into functions:
https://github.com/KillahPotatoes/KP-Liberation/blob/cfad31102f0d01d1ad82b6aad766309bd07afdfb/Missionframework/modules/01_core/fnc/event/fn_event_init.sqf#L36:L78
Do you see any optimizations that I could make or is it fine when considering performance? ๐
(other than considering to run it as PFH)
Feel free to shittalk this code it was written at 1am after long day of work ๐
Well.. @dry egret If you don't want WEST/EAST... How about.. Just looking into Empty? https://configs.arma3.ru/155.133137/configfile/CfgGroups/Empty.html
No don't PFH that.
_players = _players - [_x];
make an array
private _checkedPlayers = []; the pushBack into it inside the loop. And then after the loop
_players = _players - _checkedPlayers
also I'd recommend to keep that variable always the same datatype. You'll forget to check that at sooome place and trip over it
use empty string for no FOB and non empty for some FOB
What is that useless call on Line 43?
it is here to remind me that i should move this into function propably.
As I will check more similar things in this "event loop"
If you don't reuse that elsewhere I don't see the need for a function. But just personal preference
Thats true as calls are a little bit of perf loss.
Thanks for the array tip. I don't need to create new arrays so many times.
alternative for my arrayTip to get rid of the pushBack.
.... waiit..
You are doing that for every _x. You don't need an extra array. You already have _inFob
or you can move that array even above the forEach (KPLIB_sectors_fobs) and inside just _checkedPlayers append _inFob;
and at the end forEach (_players - _checkedPlayers)
Right. I will take a look at it later.
also private _players = allPlayers select {alive _x}; > playableUnits and you have uiSleep on the server side ๐ค
playableUnits also returns AI. Which you don't want
also playableUnits still needs the alive check
Bad idea
Cba players > allplayers
uiSleep vs Sleep don't make a real difference on server. Doesn't matter which one you use
Uisleep is good when u want to sleep during briefing phase on swrver
WOOOOOOOOOOT
test = [getMarkerPos "marker_4", empty, (configfile >> "CfgGroups" >> "Empty" >> "Military" >> "HQLarge" >> "Headquarters_OPF_F")] call BIS_fnc_spawnGroup;
Normal sleep waits for briefing to close and game tonstart
๐ it works @still forum
"The sleep precision is given by a framerate". So from what i understood uiSleep can be more "precise"(?).
since youre talking about sleep commands, for spawning in small side missions.... would their be any performance gains if i changed the sleep command to use the cba wait and execute?
your precision is between 20ms and several hours
@dry egret CBA_waitAndExecute is something completly different
Sleep sleeps in scheduled. The CBA func registers a unscheduled function to execute after that time and is potentially checked every frame if it should execute
playableUnits also returns AI. Which you don't want
https://github.com/KillahPotatoes/KP-Liberation/blob/cfad31102f0d01d1ad82b6aad766309bd07afdfb/Missionframework/description.ext#L33
huehue*
also playableUnits still needs the alive check
playableUnits do not return dead players
huehue*
๐
it's a framework. You cannot be sure if someone enables AI again
well... that's true
How about allPlayers - allDead?
maybe
#define ALL_PLAYERS ((allUnits + allDeadMen) select {isPlayer _x})
suuure
thanks for the help @still forum , im out for the night ๐
also returns dead
there vehicles also, Lou
and sounds like it does the same as allPlayers ๐ค
(allUnits + allDeadMen) select {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}}
Source
@still forum oh
That's only because
In player hosted game, the complete array of allPlayers may get delayed at the start. Use BIS_fnc_listPlayers if you need it earlier
Which is not relevant here
allPlayers is perfectly fine here. Doesn't matter if it's delayed by a minute
^ - I only need to filter out headless clients as support for them will be added later.
and dead units ^
So what about allPlayers - allDead instead of allPlayers select {alive _x}?
first one should be faster
will it still be faster after some time when there will be a lot killed units?
They will be garbage cleaned after some time but i guess we can expect to have some of them being around for some time.
Also is BIS corpseManager and wreckManager any good?
addMissionEventHandler "EntityKilled" < custom corpseManager ๐
you may have another mod/object/setting setting it back to 12km?
@tiny adder does it work in Eden?
also the description says it's limited to 10km. Which was already wrong for Arma2
were is in the pbo files the icons for the weapons?
setViewDistance 40000 works fine in the extended debug console
in Eden or in MP, again?
I'm trying in SP
but I also want it to work in MP
I've gotten it to work before
could it be some mods causing it?
[_veh, ["Medical Treatment", _fnc_heal, nil, 1.5, true, true, "", "true", 5, false, "", ""]] remoteExec ["addAction", 0, _veh];
[_veh, ["Combat Supplies", {["Open",true] call BIS_fnc_arsenal;}, nil, 2, true, true, "", "true", 5, false, "", ""]] remoteExec ["addAction", 0, _veh];```
Any specific reason why the second overwrites the addaction formed by the first one? ๐ค
If I comment the 2nd line out, the first one appears without issues. If neither are commented out, only Combat Supplies appears
As Lou already asked... you may have another mod/object/setting setting it back to 12km?
@tiny adder drop the mods, test again? it's usually a mod
I disabled all mods and now it works, hmm
lol
ยฏ_(ใ)_/ยฏ
he he he
I have close to no experience about mods, so I don't know which could change your VD
reckon a sleep 5 between them would help?
nvm that's not the solution
nothing in the documentation though
Hmm...
Tom addwaypoint [getmarkerpos "Origin", 0];
Tom addwaypoint [(getmarkerpos "Origin"), 0];```
Neither of these work. What is the correct syntax and why is it correct. How could I figure out proper syntax on my own if I needed to do it without trial and error.
you need to use (group Tom)
If you want the unit to move you need to use setWaypointType as well. eg.
_wp setWaypointType "move";```
openYoutubeVideo "watch?v=T4LweM7quxI";
This still returns false even though i have steam overlay activated
A recent script command let's you open a YouTube video directly in the Steam overlay (if enabled). openYoutubeVideo gives quite a bit of control over the various options, since you don't just provide the video ID, but other playback parameters as well. For security reasons we have restricted its use to outside scenarios only (e.g. in the game's UI or a mod's UI). We'll be using it ourselves to link & play the Community Guide series from within the game in Bootcamp Update.
http://dev.arma3.com/sitrep-00061
Any work around to that?
create a UI and let the player click
Or call that in a UI eventhandler.. I guess that should work too
Was geht?
umm yup
i found a thing
why when i use "NONE" in trigger wont detect PRESENT if you are insinde a vehicle
but it does with "EmptyDetector"
by script, but in editor u can use "NONE" and it works
@still forum i got the solution in triggers, i make it work
compiling the function in initPlayerLocal.sqf instead of init.sqf
locallity business -.-
Is there a better way of checking if a large number is equal to another large number other than == or isEqualTo
12345678911234567 == 12345678911234567 // true // these are the same number
12345678911234567 == 12345678000000000 // true // these are not the same number
I'm trying to check player UIDs against an array of admin UIDs and realised that there are potentially over 100,000,000 numbers that could return true in my condition check.
exactly what I was just thinking lol, they are strings to prevent that problem
oh. That makes so much more sense. ty.
there is no reason to convert to number, if anything you are shooting yourself in the foot :p
Floating point precision is what you are missing
guys, how i'm supossed to get Vehicle display name
i'm doing that:
_vehName = configfile >> "CfgVehicles" >> _vehType >> "displayName";
but it's giving me a route
getText (configPath)
oki
worked thanks
what about turrets
do i need use getArray? i'm already testing w/o and seems not necesary
to get arrays you need getArray to get numbers getNumber for text.... etc.
but i mean
_vehMagazines = configFile >> "CfgVehicles" >> _vehType >> "magazines";
this is working well withouth getArray
problem :S
// actions\vehicleRespawn.sqf
[respawn_west_helicopter, 10, -1, -1, nil, 0, 0, 2, true] call BIS_fnc_moduleRespawnVehicle;
// init.sqf
#include "actions\vehicleRespawn.sqf";
the vehicle respawn twice
i tried moving the include to initPlayerLocal and to initServer, but then wont work
why...are you using include though?
and then?
i dont relly understand that thing
doing
// init.sqf
if (isServer) then { code... };
is not the same
// initServer.sqf
code...
in practice it is. Since the init.sqf will run on the client and the server all you're checking in the init.sqf is that you're running on the server and not the client
and initserver.sqf will always execute on server regardless of checks
the thig is: i used BIS_fnc_moduleRespawnVehicle in intServer and was not working
then i move it to init.sqf and uset isServer and worked
so this is making me like crazy
everything in SQF makes me crazy
๐
why tf are you using module fncs in the first place
no less the respawn vehicle module fnc?
why not, it works good
no it does not
why?
Can confirm, reading through \a3\modules_f\Multiplayer\functions\fn_moduleRespawnVehicle.sqf was an issue in frustration. I envy a mind that can create such confusion that surprisingly works part of the time.
In some cases it doesn't even respawn stuff at all: https://feedback.bistudio.com/T123940 , and then when you tell them exactly the problem, the cause, and even offer a solution, nothing gets done...(edited)
But stay away from it, not worth your time, you deserve better: https://feedback.bistudio.com/search/query/TE.8rf7URd7Z/#R
so u suggest me use them in editor?
No, I suggest you don't use them at all
all the module does is feed parameters to the function
#ifdef DEBUG_BUILD
if (_optic == "BWA3_optic_debug") then compile preprocessFileLineNumbers "\bwa3_optics\scripts\debug_reticle.sqf";
#endif
best way of referencing a controlsGroupctrl when you create the controlsGroup in a foreach ?
{
private _group = _display ctrlCreate ["EmerMessageGroup", _idcStart, _controlsGroup];
_idcStart = _idcStart + 1;
private _background = (_controlsGroup controlsGroupctrl 1);
systemChat str _background;
(_controlsGroup controlsGroupctrl 1) ctrlSetText "Lega\Lega_xPhone\Images\dialogImages\emerMessageBackground2.paa";
} forEach EMS_Messages;
``` always returns the same control
nvm
i fucked up
need some help figuring out how to spawn editor prop groups correctly
_radiohq = [getMarkerPos _markerAO, empty, (configfile >> "CfgGroups" >> "Empty" >> "Military" >> "HQLarge" >> "Headquarters_OPF_F")] call BIS_fnc_spawnGroup;
^ this spawns the objects as needed but causes a lot of errors.
What is the command to make AI characters speak recorded, already in game, vanilla dialogue lines and where are those lines configs found??
@shadow sapphire im not sure how to use the built in but if you wanted to run custom voice overs i can tell you how to do that
I know how to do custom voices, but thanks for looking out, @dry egret.
if you can find the audio location, you could just set the custom voice over to use the stock audio file
Is there an alternative or better way to call a function on a server other than
waitUntil{[_mkr] remoteExecCall ["my_Function",2];}
``` because it returns a string not the same as if I just did
```SQF
waitUntil {[_mkr] call myFunction}
@daring pawn those two examples dont necessarily do the same
You can only call the function on the server directly if you're already in a script on the server
If you're running anywhere else you will need remoteexec to specify to run the call on the server
Not to mention that call will return the last value given in the function (regardless of what it is). remoteExecCall will return a string, but it's either an empty string or the JIP ID, which has nothing to do with what the function itself is doing
Anyone familar with
[ "#rev", 1, player ] call BIS_fnc_reviveOnState;
@tame portal Yea i'm aware of the difference as to where to call them
@ruby breach Yea i know, thats my issue. I know call returns the last thing given to it, so its useful with waitUntil if the function has true at the end so it waits until that. Its obviously not the same with remoteExecCall
I need a way to call the function from the player to the server and still get the result of true so i can waitUntil with it
So you want to repeat calling your function until it returns true?
I don't know if there's any proper way to wait for network calls to be done but I believe there isn't
Uh no not necesarilly. So i want to wait until the function that is called is completed before moving on
So you would have to make a server function send the result back to you
Why wait until then?
call already makes sure it doesn't return before the function is done
The script you're calling is run in the same context or "thread"
So it will finish the call and then return the value before it does anything that's written behind the call
So you can remove that waitUntil in this case
In your example code you would keep running the whole function over and over again until it eventually returns true
but like I said over network you will need to implement a mechanic that sends the data back to the requester
as remoteExecCall has no implementation to get the returned value over network (sadly)
maybe just setVariable before RE and change variable in that function, wait for variable change on the client ๐
So im using it to spawn units when you get within a radius. If you end up getting in radius of two areas at once or more, it sometimes gets jumpy cause it dumps spawning units. When I use waitUntil, it waits the the first set of units is spawned before the next.
Its not completely horrific without WaitUntil but its a bit more ideal
for that spawning function, maybe just spawn and scriptDone
hmm the thing is the function is only known by the server, so hence me remoteExecCalling it
So basically u are calling function on server to spawn units for the area
Re that from client
So issue ?
Lag when spawning?
thats correct. The player checks if they are close enough to the area to spawn the unit. Then calls the function on the server to spawn it (all checks to make sure every single player doesn't call it are done and bla bla bla)
I want to wait until that particular area or script that spawns the units is done, before it can loop back and spawn further units if in the case of it setting off several areas
Make a handler for ai spawner
dumb question maybe (I am not sure I read the whole topic here) but why isn't it the server that checks distance? the client would just "endure" server decisions, not trigger them?
๐คท
I have a unit placed in eden
and I want to add a bullet injury to their head
so that players can have a medic look at him and find out he was shot
(it doesn't look like he was, and that's part of the plot)
any ideas how I can do that?
take a weapon, aim to head, pull the trigger ๐
[this, 0.8, "head", "bullet"] call ace_medical_fnc_addDamageToUnit;
in ACE web u have full docummentation
404 ๐
@peak plover how do you mean? As in something to prevent too many ai spawning at a time?
@winter rose because in a situation where theres many players, theres also many many positions that need to be checked if players are in relevant distance. Its less strain for the player to check if they themselves are closer
Im using NearestLocations
it still says "no injuries to this body part" ๐ข
oh, okay, advanced medical mode was only enabled for players
still no injuries to this body part...
Try:
[{
[_this, 0.8, "head", "bullet"] call ace_medical_fnc_addDamageToUnit;
}, this] call CBA_fnc_execNextFrame;
okay, I'll try that
that was about my next guess; throw it into a block, put a sleep before it and spawn it
okay it works now
again, thanks a lot ๐
yw
@daring pawn a distance check is performance-wise close-to-nothing.
Only the server should be the reference for unit distances and positions, so you should definitely let it do the job
I dont belive it is worth the hassle to do distance checks on the clients.
But if u insist you want to do it your way, I think you could remoteExec it on server and notify client when you are done via publicVariableEventHandler
โ hassle it is
It is.
is.
it
<period>
KTHXBYE
@winter rose @hollow thistle cheers gents i'll sort something out
bad channel
?
ikr
@daring pawn with pleasure, tell us here if you need help for a server-side check
@daring pawn spawn function on server adds required to spawn units to N array. The function spawns first unit, updates array and if there is another unit in the array, cba execute on next frame the same function, but this time don't add more units
So this time the function spawns a unit from array and removes the spawned one from array, deletes from array and runs same function again
On next frame, cba bless
So im back (sorry) with another semi issue.
15:44:05 Performance warning: SimpleSerialization::Write 'PMF_ActivatedLocations' is using type of ',LOCATION' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
When saving the location to an array then publicVariable that array
An array
created by _nearbyLocations = nearestLocations [position player, ["Invisible"],800];
its an array of https://community.bistudio.com/wiki/Location
willi, some data types are not meant to be sent over the network. E.g. TEXT and LOCATION.
I assume its bad for delay?
LOCATION transfered doesn't make sense anyway, because locations are local things.
I assume its bad for delay?
It doesn't really matter for traffic unless you sent them in loops or something. But for LOCATION, it will be locationNull everywhere else anyway.
It's related to my lack of knowledge and doing something in a way that'd probably cause you to throw up
In regards to that, all the locations i've got on both client and server
They're different objects on all machines though.
Oh i see
hello, is there any simple option to hide all messages when someone is joining server, killed by someone etc
For the latter set DeathMessages to 0 on the server profile.
thanks @errant jasper but i need to disable chat totally
AFAIK that is not possible. You might disable most ingame chat by disabling the channels for players, but do not think you can remove the player joined server messages.
im thinking about client side mod to disable this
There is a way to remove player joined server messages but I cannot remember the way.
@amber eagle https://community.bistudio.com/wiki/showChat
@little oxide i tried this but not working
That's working for me
you are this in script like init or description.ext?
Lock the server, no players = no messages
๐
in the initplayerlocal, i'm waiting the spawn of player, and executing it
ok, thanks
by creating a simple object on client side, the client will create that object only locally?
nope, global effect
https://community.bistudio.com/wiki/createSimpleObject
yawns
haha
๐
How do I connect to a server with a button in sqf?
not sure you can (easily)
check http://killzonekid.com/farewell-my-arma-friends/
@winter rose Thanks
๐
How do I make it whenever I shoot on a tank it instandly explodes?
I currently got this
this addEventHandler["Hit", {"setDammage 1"}];
Anyone knows how to make a tank explode even when you hit it with like a pistol
its for a mission
also (_this select 0) setDamage 1
What do you mean by spawn a bomb
setDamage is also a binary command.
Hey guys. What is the right command to use to play sound from the server onto an object in the 3DSpace if you have an ogg file
Wow wow its my first missions guys haha XD
lol
myTank addEventHandler ["Hit", { (_this select 0) setDamage 1; }];
Thanks let see if that works ๐
Hey guys. What is the right command to use to play sound from the server onto an object in the 3DSpace if you have an ogg file
If the object moves or it is a mission, remote exec say3D, if the object stands still and it's an addon, local playSound3D.
Thank you commy2 i will try say3D with remote exec
Even for mission, of the sound is inside the game files and the objects stands still, playSound3D.
class CfgSounds
{
class SndExileNGRobbery
{
name = "";
sound[] = {"\sounds\shop_robbery.ogg",1,1};
titles[] = {};
};
};
["SndExileNGRobbery"] remoteExec ["say3D", _playerObject, false];
I have this code but it does not play anything in game so weird
the file is in the mission pbo
[player, "SndExileNGRobbery"] remoteExec ["say3D", player, false]; =>DOES NOT WORK
player say3D "SndExileNGRobbery" => WORKS
Check CfgRemoteExec if say3D is white listed,
[_playerObject, "SndExileNGRobbery"] remoteExec ["say3D",-2]; THIS WORKS
@little eagle playSound3D needs an absolute file path, so kinda tedious to get working in a MP mission
Did you read what I wrote and understand it? Doesn't sound like it to me.
I did thank you for your help i was just doing things wrong
I didn't read properly ๐
I meant SuicideKing. : /
Hey guys, thanks for the help here in this discord, here is the mission i was making
https://steamcommunity.com/sharedfiles/filedetails/?id=1394517910
๐๐ป
Hello, how can I make AI shoot out of car in unit capture?
Try captureFiring maybe
I think playSound3D is global, not sure about Say3D. On mobile atm
playsound3d is indeed global. say3d needs to be remoteExec'd for all clients to hear
can someone tell me why thats not working? sqf [(theHeli),["AddTread",1,"AddTread_Short",0, "AddHoldingFrame",1,"AddGunHolder",1,"BenchL_Up",0,"BenchR_Up",0]] call BIS_fnc_initVehicle; The benches of the MH-9 is still there
2nd parameter should be third, add nil between theHeli and the array
see https://community.bistudio.com/wiki/BIS_fnc_initVehicle 3rd example
@hollow lantern
oh wow I missed that, thx
๐
that seems odd. The bench is placed above the heli and has even collision instead of removal https://i.imgur.com/Gagp2vT.png
Guys
I want to attach a player to a car
But I still want the guy to be enable to look around
Is this possible?
@hollow lantern the MH9 is not supposed to have guns, that's why I think
@winter rose Guns? I just want to remove the benches
no guns at all
yes my code above is old, my new one is ```sqf
[air1, nil,["AddTread",1, "AddHoldingFrame",1,"BenchR_Up",1,"BenchL_Up",1]] call BIS_fnc_initVehicle;
set gunHolder to zero then
_heli animateSource ["addbenches", 0, 1];
``` ^ https://gyazo.com/3a5e36528c7f9452312013981cc5d9c4
nice thanks
Why not do this from the editor, btw?
Seems like a less painful way to go about it...
because its not applying
โฆ?
... if you try to apply that via vehicle customisations (editor) its not saving and when loading the mission the benches are still there
Somehow for us, the editor doesn't apply the removal of benches when using the vanilla ingame vehicle appearance change menu
Unsure why that is, that's why we're looking for a workaround
0 = this spawn {
_this animateSource ["addbenches", 0, 1];
};
```into init filed ^ don't working ?
this is working
we were talking about the vehicle customisations menu
so to answer why we took the scripted approach
initVehicle page has been updated, look it up: Example 4, you can use a BIS_fnc var
also you can do the same with this way
copyToClipboard str (animationNames cursorObject); //--- Animation names
copyToClipboard str (getObjectMaterials cursorObject); //--- Materials
copyToClipboard str (getObjectTextures cursorObject); //--- Textures
```and then this commands > `animateSource, setObjectTexture (Global) , setObjectMaterial (Global)`
well... up2u
How can you properly read getCenterOfMass? Does it return an offset array values as 0..1 of the possbile car size, or its not a coefficent?
returns an array, it's a position
https://community.bistudio.com/wiki/getCenterOfMass
like "your mass centre is shifted 3m to the left"
[3,0,0]
So you can basically shift it to 10000 meters away and get some marvelous results?
bbr not again..
bbr? bouncy bouncy rhino?
boundingBoxReal to get a max possible car width and lenght ๐ฆ
boundingBoxForReal๐
is there any issues with addMusicEventHandler "MusicStart" ?
sometimes do not detects, when music played first time and works as expected on second and xx times for some reason...
@meager heart It might happens sometimes, if to be correct in two cases:
- Previous music interrupted with a new one (end of the track was not reached).
- When you start a music track from a specific second.
I think it's an engine issue of how the time is handled.
You also may notice that some music might interrupt randomly at this point.
probably the second option in my case
Altho its floating, it happens in some random conditions
cursorObject setCenterOfMass [0,-100,0]
Made my pickup fly away and splash into a.. water on the ground to disappear totally
๐ค ๐
harry potter music here
that against the law... the newton's law, don't try this at home arma
What would be the smartest way to design and develop some kind of generic "civilian job" feature? Using compositions with scripted behavior or something else?
For example, to help immersion, you want to add a market seller or a mechanic fixing the car or ... you get the picture
Adding these 'life' features so far is too much work with scripts
Anyone know how to use BIS_fnc_reviveOnState?
Anyone know how to use https://community.bistudio.com/wiki/BIS_fnc_drawAO. I can't get it to do anything
@tough abyss I couldn't even find that function on the community wiki
Its not on there afaik
I've seen people post snippets of code using it but i can't figure out anything beyond what they posted because it's not documented
Description:
Used to execute specific code localy on every client whenever unit's state changes.
Parameters:
_this select 0: STRING - Variable that carries the state value over the network, defined by macro VAR_TRANSFER_STATE.
_this select 1: SCALAR - State.
_this select 2: OBJECT - Unit to set the status for.
Returns:
True if successful, false if not.
States:
#define STATE_RESPAWNED 0
#define STATE_REVIVED 1
#define STATE_INCAPACITATED 2
#define STATE_DEAD 3
That's about all you're going to get for documentation
yup
can anyone point me what's wrong here:
_mkr = createMarker [format["grpMkr_%1", _index], [0,0]];
_mkr setMarkerPos _pos;
_mkr setMarkerShape "ICON";
_mkr setMarkerType "Flag";
_mkr setMarkerColor "ColorBlack";
allGrpMkrs pushBack format["grpMkr_%1", _index];
i can't see these markers
your position is [0,0]
_mkr setMarkerPos _pos;
if that was the problem i should see it in 0,0 atleast xD
hmm, seems like "Flag" does not exits in arma 3
also maybe type is wrong ? should be "hd_flag" or "mil_flag"
only arma 2
yeah
do you think that
format["grpMkr_%1", _index] setMarker... ...
will work?
yes, thanks, i was looking there, but i take one from arma 2 xD
for the marker name with format
private _marker = createmarker [format ["marker_%1", _index], _markerPos];
Never understood why people write it like this.
private _marker = format ["marker_%1", _index];
createmarker [_marker, _markerPos];
_marker setMarkerShape blah...
Seems nicer.
oki, will test that
yep looks better and readableier* ๐
but in this way, will work with pushing back inside an array and then use that array to delet them dinamically?
The marker? Sure, why not.
private _mkrName = format["grpMkr_%1", _index];
createMarker [_mkrName, [0,0]];
_mkrName setMarkerPos _pos;
_mkrName setMarkerShape "ICON";
_mkrName setMarkerType "mil_objective";
_mkrName setMarkerColor "colorOPFOR";
_mkrName setMarkerDir 0;
_mkrName setMarkerSize [0.25, 0.25];
_mkrName setMarkerAlpha 1;
allGrpMkrs pushBack _mkrName;
{
deleteMarker _x;
} forEach allGrpMkrs;
Yes.
oki, ty
Not only is this more readable, it also explains what a marker type actually is. Just a string.
with marker name
It could be any string, maybe even one that doubles as object netId/ vehicle var name.
I'd tag them though, as marker names are global and they should interact well with other scripts, missions and mods.
I'm a little confused with a script I am creating
private _counter = 0;
while {_counter < 360} do {
_counter = _counter + 1;
[-1,{systemChat format ["Created %1", _counter]}] call CBA_fnc_globalExecute;
};
I just get Created any in system chat
yes
you are using "private" outside from the while
private _counter and _counter are not the same var
๐คฆ
this private _counter is not reachable inside the while loop
_counter = 0;
while {_counter < 360} do {
_counter = _counter + 1;
[-1,{systemChat format ["Created %1", _counter]}] call CBA_fnc_globalExecute;
};
Still get Created any
Nevermind
double check that you recompile(pbo) xD
globalExecute
@late gull please stop lying
DEPRECATED. Use <remoteExec at https://community.bistudio.com/wiki/remoteExec> instead.
use remoteExec
private prevents variables from higher scopes from being overwritten. That's it.
@still forum in whaT?
@fringe yoke local variables don't carry over into new scripts
@fringe yoke keep the private
I've already reverted after I saw that globalExecute was the cause
so killzonekid lyed to me, that's what i read from the blog
globalExecute still works fine. I always use that.
no that's not what you read from his blog
you probably missinterpreted something
yep so, or it's too old
private _walls = [];
private _counter = 0;
while {_counter < 360} do {
private _w = _wall createVehicle (_pos getPos [150, _counter]);
_w enableSimulationGlobal false;
_walls pushBack _w;
_counter = _counter + 1;
};
[-1,{systemChat format ["Walls: %1", _this]}, count _walls] call CBA_fnc_globalExecute;
I get Walls: 0
not sure why
_wall is "VR_Billboard_01_F" which is just a simple VR wall
what if you check the content of _walls before the globalExecute?
can i ask, where this _this comes from?
replacing _wall with "VR_Billboard_01_F" worked, not sure why it didn't like _wall. It was defined. Doing diag_log _wall showed "VR_Billboard_01_F" in the rpt
what?
no _wall was not defined
_w was
oh wait. That _wall up there
no. according to your script that was not defined
That wasn't the entire script
private _wall = "VR_Billboard_01_F";
private _pos = [nil, ["water"]] call BIS_fnc_randomPos;
missionNamespace setVariable ["MISSION_CENTER", _pos, true];
private _lighthouse = "Land_LightHouse_F" createVehicle _pos;
_lighthouse enableSimulationGlobal false;
sleep 20;
missionNamespace setVariable ["MISSION_STARTED", true, true];
[-1, {
[300, "#00ccff"] spawn synixe_scripts_fnc_countdownTimer;
}] call CBA_fnc_globalExecute;
//walls
private _walls = [];
private _counter = 0;
while {_counter < 360} do {
private _w = _wall createVehicle (_pos getPos [150, _counter]);
_w enableSimulationGlobal false;
_walls pushBack _w;
_counter = _counter + 1;
};
Not sure why it didn't like _wall on the createVehicle line, but replacing it with the string literal worked, so whatever I guess.
just to get 100% that i read wrong somewher, can u remove private?
removing private can break scripts that call your script
if you have the same variable name as them. You'll overwrite their value
also private makes your script faster
because when you set a local variable. It looks through all scopes, going upwards trying to find if anyone was already using that variable
because it would've to overwrite the variable in a higher scope if it existed
with private it knows it doesn't have to do that and immediately set's the variable
hmm, that help's me to understand
i should had test that time ago:
private _a = "ok";
if (true) then { hint str _a; };
๐คฆ
i swear, i read somewhere that _a will be not reachable inside this if
You should not read such things.
hahaha
god bless discord
btw, when you are getting params, u don't need to use private for those params huh?
they are supossed to not be overwrite
params does it internally
ok
params ["_var"] is equal to
private _var = if (_this isEqualType []) then {
if (count _this > 0) then {_this select 0} else {_defaultValue};
} else {_this};
or private _var = _this param [0, _defaultValue]
where _defaultValue is nil in this case
ok, thx
Wew, this chat is hard to stomach for me ๐คข
(ใคยฐ_ยฐ)ใค๐
In that case you should give a blue pill instead of a red pill.
@errant jasper it's you Morpheus?
Unfortunately no, i'm just, "It's a me, Mario".
๐ฉ ๐
hides
Any ideas why when i do this on the server as a script i get numbers like 486311 but when i do it from the client i get the number i expect ?
_timeout = floor(serverTime) + 300;
_group setVariable ["NG_Timeout", _timeout, true];
I think serverTime is broken. See bottom comment: https://community.bistudio.com/wiki/serverTime
If you are using CBA you might try CBA_missionTime. Personally I just do #define time CBA_missionTime.
I do not have CBA. I would like to not be dependent on mods
Do you have any suggestions to alternative time pointer i could use for this
AFAIK time is still not reliable in MP since it drifts away.
Depending on what you need the timeout for, e.g. if only the server checks anyway, you don't need synchronized time. When the timeout is up the server just does it's thing.
I just want to kill a group after a while
So exact time is not a must.
However with my current script i get 400311 rather than 380 for instance so its a lot different
If you don't need exact then just use time .
Thank you i will try it now
can't you just use sleep though?
[myGroup, 120] spawn {
params ["_group", "_duration"];
sleep _duration;
{ deleteVehicle _x } forEach units _group; // or setDamage 1
deleteGroup _group;
};
And if you need to remove any vehicles crewed by the group:
private _vehicles = (units _group) apply {vehicle _x} - (units _group);
_vehicles = _vehicles arrayIntersect _vehicles;
{deleteVehicle _x} forEach _vehicles;```
Guys
I want to attach a player to a car
But I still want the guy to be enable to look around
Is this possible?
afaik no
I want to capture ai on a car shooting and moving around in unit capture
Thats what I am trying to make
So I though what if I attach the AI to a car, record it shooting and then play it
But when I attached I couldn't look around with the AI
So anyone maybe know a method I can get this working?
Hello guys. What's the best way to write object-oriented SQF? oop.h seems pretty good out here, did anyone try to use it?
Anyone??
So you want him run over a car and shoot around?
oh wait sry i wasn't aware of unitcapture
does anybody happen to know what class editor Modules are so I can filter them out from an array of objects?
Guys
Is it possible to like disable the sound of a helicopter?
Like if my heli is called heli1
none that I know of
Believe they are logics. But right-click on one in editor, and open config viewer and check.
oh, that's right, you could open config editor from context menu...
What config should I disable just sound?
Is there a way to force lights off?
@gleaming cedar https://community.bistudio.com/wiki/Arma_3_Actions#LightOff
A thanks
Is there a way to remove recoil off a gunner?
I have a script that a unit shoots
But when it shoots automatic
It goes all in the air
XD
this setUnitRecoilCoefficient 0.3;
I tried this doesnt work
got it
i use now
player6d fireAtTarget [player3d,"LMG_Minigun_Transport"];
So I've scripted event that is executed globaly from server. Handlers for this event receive player that triggered it as param.
Will checking if _paramPlayer == player be enough to determine if local client is the one that fired the event?
if you're doing that check on the server, then no, because player is not defined on the server
is it not possible to do isClass (missionconfigfile >> "blah") on serverside on startup ?
preInit
yup
I just worked around it
[] spawn {
waitUntil {time > 0};
private _check1 = isClass (missionconfigfile >> "Lega_xPhone_usablesMain");
private _check2 = isClass (missionconfigfile >> "xPhoneMain");
diag_log format ["FUCK ARMA %1 -- %2", _check1, _check2];
if !(_check1 || _check2) exitWith {[] execVM "\Lega_Core\errors\MissionError.sqf"};
};
should work right ?
why the spawn and waitUntil?
should though
im gunna start without it a second just to make sure the paths are correct on the includes/.
doesn't time only progress after init?
yeah.
i had a ; on my include my phone is finally finished
guys, how i can add a BIS_fnc_holdActionAdd to a object
not in editor/init
object spawned by script
doing:
[
device2,
"Hack",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa",
"_this distance _target < 3", "_caller distance _target < 3",
{},
{},
{device2Done = true;},
{},
[],
5,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", [0,2] select isDedicated, device2];
does not work
got this in RPT
Trying to target client #2 during JIP when calling RemoteExec(Call) 'bis_fnc_holdactionadd'. Target must be 0 for JIP
you are passing device2 as JIP parameter.. why?
Well. Just read what it says
you are passing 2 ([0,2] select isDedicated) But you are only allowed to pass 0
so that example it's wrong?
yes
ok, thanks
that code is complete nonsense..
isDedicated returns true when you are on a server. And 2 only executes on the server.
So that thing says. If you are the server then only execute locally.
just remove that and just pass 0
ahh oki, thanks
but wait, what about device2 in the end?
nvm, it's ok
i readed the remoteExec docs
@still forum it should be [0,-2]
I think @little eagle knows something about why that's useless
well, if using -2 is also useless then that's news to me
because When number is negative, the effect is inverted. -2 means execute on every client but not the server
someone here said that [0,-2] select isDedicated was stoopid and should not be used, period - commy2 maybe indeed
@inner swallow your comment may disappear if we correct/remove the example part
Yes, I did, because yes, it is.
while I tend to agree on the matter, may I ask you what makes you think it is always a bad idea?
I haven't found one time where it is a good idea, where as I found lots of times where it was a bad idea.
scenario case, when you have to use a script calling "player"?
(but I agree, the script itself should check if isNull player)
A script like that should just use
if (!hasInterface) exitWith {};
as first line in the script.
That way it also not-runs on a headless client.
I think the point of this issue is
you could, but are you sure you need
in a way, be sure to know what you do else use 0
There is absolutely no point in using -2 though. And every time you do use it, you open yourself up for bugs, even if small ones, and faulty code.
wait hold on
so the point is
using 0 means it's run everywhere
including on the server
which is pointless
Depends... Server might have a player.
yeah, hence the select statement
on a dedicated server asking it to run at all seems like a waste of cycles
but, if the engine optimises for it, then i guess it's useless
i.e. doesn't add actions to things without an interface
on a dedicated server asking it to run at all seems like a waste of cycles
Same for a headless client. The only safe way is to use a hasInterface in the script. -2 method wastes cycles on hc's.
or for example if you wanted to setObjectTexture to all players
so you're suggesting putting the addAction/setobjectTexture/whatever thing in a separate script that has a hasInterface check in it?
and then running the script via remoteExec?
The C++ check that aborts setObjectTexture is less computation time than the select isDedicated.
Also, bad example, since we have setObjectTextureGlobal which is JIP compatible.
(deleted wrong code ;^)
That's the first time I've heard of that. I have my doubts about that.
I've been complaining about this for years now, and we've discussed this before
Been experienced by a lot of people
You mean any global command executed from the init event?
Who does that?
The only way to use init events is to write the config or use CBA. I have my doubts lot of people here do that regularly.
but even then, if you use initPlayerLocal, and need to change all player textures, it's not reliable to use setObjectTexture global
wait i misunderstood you
i thought by init event you meant init box
initPlayerLocal is some scheduled script, not an init event.
Yeah, and the init box isn't the init event either. Init box is compatible with global commands.
it's not reliable though, because players don't initialise at the same time.
Well, sort of. You probably want to wrap the init box in isServer then.
it's not reliable though, because players don't initialise at the same time.
Do you have a repro for that? Because that doesn't sound real to me.
the repro depends on enough people joining the mission
And how would RE help that? This doesn't sound right to me.
Idk what JIP flag you're refering to.
I know, but you don't need to use the RE JIP stack if the command itself causes the server to tell a JIP client what texture to use.
yes, i'm saying i highly doubt it does that (the command)
You doubt that setObjectTextureGlobal has global effects that persist for JIP?
yes
no
wait
i don't doubt it has global effects
i do doubt it persists for JIP
Luckily this can be tested.
who?
i dunno, maybe it broke along the way?
All* global commands are synched on JIP in Arma 3 afaik.
*stuff like playSound3D
I've even had issues with setPosATL
Can you repro that? In that case would be a serious bug in the engine
I can, but i don't have access to arma until august
so i can at most describe a test case
Well, position will not synch if you disable simulation.
I had to do this, basically
[UnitCSAT_SUR1, _spawnLocation] remoteExec ["setPosATL",UnitCSAT_SUR1,true];```
this is a script that's execVM-ed at the end of init.sqf, runs only on the server
wouldn't work without remoteExec
Well it runs only on one machine regardless ?
This sounds only "useful" if UnitCSAT_SUR1 had it's simulation disabled, therefore network synching of the positions disabled.
i have not explicitly disabled it so i dunno about that.
Is it playable unit?
How did you do it before, when it did not work?
To get back to the original topic, this overuse of RE seems to cause a lot more wasted network traffic than not doing -2 loses computation time on the server.
just setPosATL
Where? init.sqf ? init box?
this is a script that's execVM-ed at the end of init.sqf, runs only on the server
same
These were two units in the same group. On localhost, both get teleported. On DS, if i slot one, i would not get teleported, whereas the AI would, if my memory servers me correctly.
see https://community.bistudio.com/wiki/Talk:setObjectTextureGlobal about setObjectTextureGlobal in init field
Well, in that case if the slot was taken by a non JIP it would be interesting, since that would mean the player was not ready at the time - and that should be fixed in the engine. For JIPs it is obviously broken with just using setPosATL on the server.
I will admit i can't make much sense of the conversation on that talk page
is KK asking him to do exactly what he's doing?
actually no, nevermind, i think i see the difference.
dose anyone know how to set refuel point/function?
Yeah, he ran the global command globally, and did not know it did not work with mission paths.
but then... if he's using (isServer) then is he not using the global command just once?
or is the problem that the paths are different and the server is now asking clients to use the wrong path?
imo that setPosATL will fails 100% you need isNull check first, SuicideKing
[UnitCSAT_SUR1, _spawnLocation] remoteExec ["setPosATL",UnitCSAT_SUR1,true];
```โ
```sqf
if (!isNull UnitCSAT_SUR1) then {
[UnitCSAT_SUR1, _spawnLocation] remoteExec ["setPosATL",2];
};
```also you can stop using init.sqf already ๐
There were two problems.
- Initially he was using the global command globally.
- The global command does not work well with mission paths since they differ on clients.
The solution to the first is to wrap in isServer. A solution to the second is to apply the local command with the same arguments globally.
Because there were two problems, is also the reason the discussion page can be a bit confusing.
ahh, i see
yeah i think it's possible then that the second problem is what we keep running into
So for a non-mission image, what I believe (and commy2 if I got that right), is that you only really need to run the global setObjectTextureGlobal once, say on the server, and it would also remain JIP compatible (assuming no other script modifies stuff).
Yes.
Doesn't mean I'm saying it could not be bugged, but I've never seen it bugged.
I can't be sure now, since i think we were running into the second issue, as we always use isServer
will ask people to try it KK's way and see what happens
@meager heart the full segment was
if !(isNil "UnitCSAT_SUR1") then
{
//UnitCSAT_SUR1 setPosATL _spawnLocation;
[UnitCSAT_SUR1, _spawnLocation] remoteExec ["setPosATL",UnitCSAT_SUR1,true];
_flag1 = 1;
};```
i just posted the most relevant part. Although i'm using isNil for whatever reason ๐คท๐ฝ
^
U need isNil
If unit is not slotted
the variable is not defined
isNull would error
Also after first JIP leaves? Won't it get nulled then?
I dunno. But this is known to work ๐
i was probably checking for it existing, while sldt1ck was checking for the player being initialised
i think
private _unit = missionNamespace getVariable ['unitcsat_sur1',objNull];
if (!isNull _unit) then {
//fun stuff
};
Also where does this run?
I would use that ^^ just so I don't have to do elaborate testing to discover the true behaviour ๐
You run that in init.sqf in an isServer check correct?
ah, i see i have commented out the old code that wasn't working
yes
actually no wait
the script has an isServer check
but the script is run from init.sqf
not inside init.sqf
if you know what i mean
Okay, but it runs from init.sqf on the server only?
okay then.
also if runs on the server why re ?
because it wasn't working without RE
I know
Also works without RE on my machine ๐คท๐ป
purportedly
Well, I admit I have worries that:
- If no player takes that slot when the mission starts, then the server won't RE the setPosATL because isNil.
- If there is a player on that slot, then it will RE and the JIP tag will be set. But when the player disconnects, according to remoteExec the JIP "ticket" is removed. Then when another takes the slot, nothing will happen.
note how i've commented out the part without RE
Muzzleflash that's fine
it just needs to happen once
in fact that's intended
actually, i must add that we enable AI slots
so if a player leaves, teh AI still exists
Oh alright then. Well that fixes my second bullet point, but does not consider the first one? Perhaps it does not need to happen there either?
Ah, no it does
It's a rescue mission and stuff
so they're being moved to a randomised location (among a set of hand picked locations)
if they're in the open they'll probably die pretty soon ๐
So if i don't have the isNil check, i'm assuming it'll complain about not being able to find the target unit
or maybe it just fails silently, i don't remember
but yeah it seemed dumb to try and move something that doesn't exist
hmm coming back to the setObjectTextureGlobal for a moment
would the path differences between server and client also matter in the case of textures that are included in the game?
Not for addon textures
if (local _unit) then
{
[_unit, [0, "\a3\characters_f\OPFOR\Data\clothing_rus_co.paa"]] remoteExec ["setObjectTexture", 0, true];
[_unit, [1,"\a3\characters_f\OPFOR\Data\tech_rus_co.paa"]] remoteExec ["setObjectTexture", 0, true];
};```
like this for example?
That path should be fine for the global version
hmm. it wasn't working.
These are vanilla items? Looks like it.
yeah
Gimme 2 mins - firing up the old computotron.
unused russian uniform textures
thanks
wasn't working in dedicated, particularly
i think the easy way to test this would be to make some 14 or so CSAT rifleman slots, and plop that code into initPlayerLocal.sqf
and change _unit to player
How are you running it?
well, tried in many ways. directly from the init field, execVM-ing a script from the init field, then eventually added it to F3's Assign Gear script since we use F3.
Since I'm on my laptop, this is an older version of the mission, at which point i think i was using the second method.
I think I started off by execVM-ing the script from init.sqf
(oh, F3 assign gear is called from the unit's init box)
and change _unit to player
that won't work with AI obviously, though.
in the most recent version of this mission, i've added it to the end of https://github.com/Raptoer/F3/blob/master/f/assignGear/f_assignGear_clothes.sqf
since that was the most elegant way to do it
[cursorTarget, [0, "\a3\characters_f\OPFOR\Data\clothing_rus_co.paa"]] remoteExec ["setObjectTexture"];
[cursorTarget, [1,"\a3\characters_f\OPFOR\Data\tech_rus_co.paa"]] remoteExec ["setObjectTexture"];
```on local host ^ https://gyazo.com/8c25fa9c362ca96ce2b4c2789df744f3
player > https://gyazo.com/c127477dd658e40dacaf677835dd4d3a
๐
Hmm, it does seem it can be run too quickly. In my test case (not using RE) it works for JIPs but not for non-JIPs.
I try both the local and the global (on different subjects).
If I run
this setObjectTexture [0, "\a3\characters_f\OPFOR\Data\clothing_rus_co.paa"]```
in init box of soldier, I can find no reason why it should not work for player joining dedicated as non-JIP, but work for JIP. If I spawn a 1s sleep before doing it, it works.
spawn it maybe ^
people would either run the command 5 times consecutively
or like me add a sleep thing
i found the former too un-elegant though
don't remember why i stopped using sleep
probably found the RE method nicer
we also had the issue where JIP clients (slotting into AI enabled slots) couldn't see the texture on other players
it was very messy, some had the textures and some didn't
anyone have experience with scripted guard points in a3 ? what is default area radius ?
createGuardedPoint < this point i mean
Guys
player6d fireAtTarget [player3d,"LMG_Minigun_Transport"];
Why is this now working
player6d is the shooter and player3d is the person beeing shot
I put this in a loop
But the player6d shootes but it doesnt aim on player3d
afaik fireAtTarget < for vehicles only
I did got it working
I put this in an ai
And it works
Or should I not name the player but the vechile
Like
car1 fireAtTarget [player3d,"LMG_Minigun_Transport"];
Like this?
?
fireAtTarget wont target the object by itself. You need to use doTarget before.
something like this maybe
//--- vehicle
_gunner doWatch _target;
waitUntil {_vehicle aimedAtTarget [_target] > 0.5};
_gunner fireAtTarget [_target];
//--- unit
_unit doWatch _target;
waitUntil {[objNull, "VIEW"] checkVisibility [eyePos _unit, aimPos _target] > 0.5};
_unit forceWeaponFire [weaponState _unit select 1, weaponState _unit select 2];
@inner swallow Put this command in your gear script with a sleep after you've assigned the players uniform;
_unit spawn { sleep 0.1; _this setObjectTextureGlobal [0, "\a3\characters_f\OPFOR\Data\clothing_rus_co.paa"]; };
Is there a way to display the IDs for the game ui. I have a few IDs I have found online, but is there some tool to find them myself?
@runic rose thanks, although now for me the question is, why do this over remoteExec?
@fringe yoke you usually look into the config viewer to find them
Don't know what ID's you mean. There are Control and Display ID's. Here are the display ones from vanilla https://gist.github.com/dedmen/bfa12ab3906ed0107d5e56396326c7d8
is there a way to check if a postion is actually on the map ?
with mapGridPosition maybe
hm
as in if it is in the marked map or out in the black?
ye
im trying to make it work on anymap xd
[[(worldSize / 2),(worldSize / 2),0],0, (worldSize / 2), 10, 0] call BIS_fnc_findSafePos; what im using to find the positions
but sometimes its outside the map
check ur x and y coords if they are < 0 or > worldsize.
also we have https://community.bistudio.com/wiki/BIS_fnc_mapSize
no idea what it does lol
But you can grab other worlds size with this one
Is there an event handler for a marker being placed in the map?
User marker I guess?
If a person opens up their map, and creates a marker