#arma3_scripting
1 messages · Page 733 of 1
What do you mean? the code works if the unit is spawned? Maybe just run it when the player spawns? Could be a case of the player object not being fully loaded before it spawns. https://community.bistudio.com/wiki/Event_Scripts#onPlayerRespawn.sqf
so the code i posted works in a debug console no issues
but when i put it in the event scripts, it does not work. My guess is because of the respawn screen, the player is technically loaded but hasn't selected a vehicle yet.
it despawns all my alive units during respawn menu, so you cant spawn in the vehicles until something loads them in.
i was hoping the local player init wouldn't load untill the player spawned in
init runs upon joining
and i dont want to keep creating zeus modules for when the player respawns
so i cant use the on player respawn event script
brb thanks for your time
true
Hi, is a waypoint's onActivation script run on every machine, or just the machine of the group's owner?
I believe it is executed on every machine by default, same as with triggers
Ok, thanks. I may put a safety check in the script just to be safe.
I think you have a good idea, i don't know what the issue is. anyway heres my code ```params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];
if (_oldUnit == objNull) then {
_logic = createGroup sideLogic;
_zeus = _logic createUnit ["ModuleCurator_F",[0,0,0],[],0,"NONE"];
_zeus setVariable ["Owner", ""];
_zeus setVariable ["Name", ""];
_zeus setVariable ["Addons", 2];
_zeus setVariable ["Forced", 0];
[_newUnit, _zeus] remoteExec ["assignCurator",2];
_zeus addCuratorEditableObjects [[_newUnit], true];
[_zeus, [-1, -2, 0]] call bis_fnc_setCuratorVisionModes;
_zeus addCuratorPoints 0.1;
};
it will work on debug console if i replace the variables with _newUnit = player
waitUntil {sleep 1; this in units group player };
_this call BIS_fnc_ambientAnim__terminate;```
in unit's init. Why is this *no bueno*? I'm trying to terminate the ambient animation when the unit joins players group - it joinSilents player in other place
no sleeping or waiting in unit init

[] spawn { waitUntil {sleep 1; rfl_1 in units group player }; rfl_1 call BIS_fnc_ambientAnim__terminate;
};``` this one works but the unit looses all of its gear except uniform and weapon
it's for singleplayer btw
that is a feature of BIS_fnc_ambientAnim
oh, so I have to give this stuff back to him through another script?
give "ASIS" as third argument
I'll try
equipmentLevel: String - the equipment level of the unit. Possible values:
NONE LIGHT MEDIUM FULL ASIS RANDOM
[this, "SIT1", "ASIS"] call BIS_fnc_ambientAnim;
yes I must have missed that part, thank you so much
I tried to do the same thing with Ambient AI feature from 3den Enhanced that creates the same animation either as ambientAnim or ambientAnimCombat, but it's impossible to terminate any of those with the same spawn as above, manually setting combat behaviour also doesn't work, unless I'm wrong 
i haven't used that feature of 3den enhanced
but you should be able to terminate the animation with switchMove or playMoveNow
why does the element order change when using createHashmapFromArray?
Because it's a hashmap
aka unordered map
There's no order in hashmaps
If you need order you must use arrays
ok but why does it shuffle the order?
It doesn't "shuffle"
It depends on the hash
Hashmap uses the hash to map to a bucket
AKA the order means nothing for hashmap
hmm
because the order it uses makes searching more efficient (that's the assumption anyway)
Just google hashmap
Or hash table
it could preserve iteration order but that would make the table more complicated
you can do it yourself by storing your data in an array and using a key->index table instead
I'm just curious why the order of elements changes
Like I said just google it and you'll see
thx for the link , I think I understand little better now
buckets and all, I think it's an optimization thing?
it's all part of the hash table algorithm. the nice thing about hash tables is that they provide average constant time access
in other words, on average the time needed to find an element stays the same even as you add more elements
though that is not entirely true in reality, and also depends on the quality of the hash
a bad hash reduces efficiency of the table. the worst possible hash which assigns all keys the same hash value produces linear access times
that is, with that worst possible hash, as you double the size of the table, the time required to find a key also doubles
interesting stuff, thx guys 🙂
has anyone experienced issues with using keyhandler, in terms of activation without an actual keypress?
E.g: someone opens a menu without pressing Y.
or perhaps a key activating something its NOT supposed to?
E.g someone opens a menu by pressing P instead of the assigned key(Y).
looking at https://community.bistudio.com/wiki/getMissionLayerEntities, it seems there is no command returning all layers, right?
seems so
aaaaaah, thanks 👍
any way to get layer name from its id? 😁
ouh smart! 👍
Attributes are available only within the Eden Editor workspace. You cannot access them in scenario preview or exported scenario!
also,all3DENEntitiesdoesn't return anything when the mission is launched 😔
ah well, not mandatory for what I want to do, I'll find a workaround.
don't have arma installed to examine how all the indexing and stuff works, could help more otherwise 😄 hope you get it working
interesting that with hashmaps you can delete element when doing foreach loop without breaking the loop
(skipping elements)
yes because the keys are copied
ok
can you loop over a map?
hashmap yes
{ } foreach _map ?
are you sure deleting works? seems a bit sus
Makes sense if you're only deleting the element and not the key as a whole
this is what I used to test: ```
_hm = createHashmapFromArray [["test1",7],["test2",5],["test3",2]];
systemchat format ["==== %1 ====", _hm];
{
systemchat format ["%1 => %2", _x, _y];
if(_y == 2 || _y == 5) then
{
systemchat "deleting...";
_hm deleteAt _x;
};
} foreach _hm;
this test is not good enough
how so?
Makes sense to me
no reason it'd be trying to iterate over a hashmap like an array, it'd just be performing key lookups
so deleting a key shouldn't break anything
that's not how any of this works
That's exactly how a hashmap works
A foreach does not iterate over a hashmap in the same way one iterates over an array.
Is my point.
So deleting arbitrary elements during iteration shouldn't break anything
you have no way of knowing that
???
first of all you'd have to know the algorithm they use
You can't
i assume it's the same naive array of arrays as it is in A2
Key and value are one element
Yeah I meant value not element
It does.
mixup in wording
But it does.
it doesn't have to
A hashtable is just multiple arrays.
usually it's one array
it would work if you used unordered_map, though i know you're not
You are iterating through many arrays. Deleting elements will mess it up the same as it does with arrays
That's entirely implementation defined
I'm used to things like unordered_map and such
Yeah I'm telling you how it's implemented
implementation defined... 🙄
Fair enough, wasn't aware it was implemented that way and I've never seen it implemented that way
I stand fairly corrected
It's basically exactly how hashtable is described on Wikipedia i think
Pretty sure.. multiple arrays as the buckets
yeah array of arrays is the kindergarten algorithm
it's fairly naive though. most real world implementations use open addressing
The entire idea of arrays as buckets is a bit... yuck
Might as well not be using buckets at all if you're not using open addressing
you do know how unordered_map works right?
I know the gist of it
yeah well they use an array of linked list buckets
Right but I'm talking about literally just hashing raw arrays and calling them buckets
what?
As in how that'd be a stupid thing to do
yeah sounds that way. did someone do that?
i have no idea what you even mean
so my test code is not supposed to work... 🙄
I must be wording it poorly
as in, it might break
an item reorder may happen, from what I understand
what I'm saying is it'd be a very naive and stupid decision to use arrays as "buckets" instead of a linked list structure
ok
as in literally just throwing arrays into a hashmap and pretending that it's anywhere close to actual buckets
...?
I thought we'd already established that's how it's usually done
don't think I need to explain why

« They say of the Acropolis where the Parthenon is… »
do you know why unordered_map is implemented that way?
I assume it's because of literally everything that makes buckets a good idea in the first place?
well you assume wrong
it's because of the iterator stability guarantees imposed by the standard, and most of the C++ community considers unordered_map largely worthless because of it
Well I've been around the C++ community and I've never heard this lol
Nor has any education I've received ever talked about that
well it's entirely a performance issue. i guess it depends on the circles you hang around whether or not it'll come up
I know the standard enforces a lot of... unnecessary performance overhead in areas
but I don't really see a noticeable performance problem w/ unordered_map hashmaps in any usage of them I've done
well there's plenty of literature on the subject out there
plenty of benchmarks too
Are we talking significant performance decreases on a macro scale or microoptimization?
Cos I'd say it's quite a different story if it only applies when trying to scale a massive application for instance
the scale of the problem depends on how heavily your workload depends on the hash table
Well yeah
I mean moreso in terms of actual complexity
is this something that the average developer should be seriously considering avoiding
Yes
it's a hash table, it's average O(1) either way
we're talking about constant factors
Fair enough, though I know the average can sway due to implementation factors
Moreso what I'm getting at is
Is this a problem only someone writing code for a microcontroller should be worried about or something more universally applicable?
What's the scale of the performance difference
I'll have to look into the literature on it
Wow that certainly grows at scale doesn't it
Interesting, I was not aware, thanks for informing me
would this code work for deleting elements? ```
_hm = createHashmapFromArray [["test1",7],["test2",5],["test3",2]];
for "_i" from (count _hm - 1) to 0 step -1 do
{
_keys = keys _hm;
_k = _keys # _i;
_v = _hm get _k;
systemchat format ["%1 => %2", _k, _v];
if(_v == 2) then
{
systemchat "deleting...";
_hm deleteAt _k;
};
};
hmmm
push all the keys to be deleted into an array and do another loop to delete them all afterwards
ok
what if I use + copy? ```
_hm = createHashmapFromArray [["test1",7],["test2",5],["test3",2]];
{
systemchat format ["%1 => %2", _x, _y];
if(_y == 2) then
{
systemchat "deleting...";
_hm deleteAt _x;
};
} foreach +_hm;
that's fine
ok thx 🙂
I hope you aren't doing lookups by value too often 
Certainly doesn't invalidate the entire advantage of hashing
not very often just checking if enough time has passed and deleting the element, this script doesn't run like every frame
Is there a particular reason you're testing this?
Ah it's a _y <... Check, instead of a ==?
sorry test what? just trying to get this working without bugs 😉
yes > check
Well it's just
I don't see what it could be being used for that would benefit from this implementation
sounds like you want a queue
no problem, you have already helped me so thx for that

depends on the code that is used. but maybe it is because of different keyboard layouts, eg german has QWERTZ vs english QWERTY, so if you check for key_id == 123 (where 123 is the id for y) a german user would have to press z instead
Ahh, good point. I dont think it applies in the same way in our case as we are using numpad for it. Although it could be so. Thank you for pointing that out : D
Is there some function to make an AI speak one of its preset dialogs? For example, in my paradrop script, I want to make a group leader say "Dismount!" over group channel.
yes. groupRadio, or directSay
Ah great, groupRadio looks like what I need, thanks.
Am I missing something simple here? The condition is apparently being ignored - the actions are visible all the time:
player addAction [format["<t color='#FF0000'>Torch Nest</t> %1", _nest], {
params ["_target", "_caller", "_actionId", "_arguments"];
hint "Torching";
_caller removeAction _actionId;
},
[_nest], 6, true, true, "",
"_this distance2D _target <= 3;"
];
_this distance2D _target <= 3;
why not just change the action radius?
I can look at that as a viable option... but why is what I have not working
ah... yes, that would be it isn't it
so distance is always 0
hmm I'm not sure the best way to go about this then. I could add the action to the "nest" and use this or modify the radius but that will require me looking directly at the object correct?
In this case, that doesn't really work because the nest is made of several objects... unless I were to add the action to everyone of them?
then using _target distance _arguments and providing the nest as argument
Does the condition access the arguments? I tried: _target distance2D _arguments and _target distance2D (_arguments select 0) with no effect
according to the wiki no:
condition: String - (Optional, default "true") Expression that must return true for the action to be shown. Special variables passed to the script code are:
_target:
_this:
_originalTarget:
Yeah, I didn't think so - that's what I'm looking at also
just add the action to the "nest"
well, like I said, I nest is made up of several different objects. Should I just add an action to each one to ensure the player can activate wherever they're looking?
I'm not sure what would be considered too taxing... looking at roughly 19 objects per nest
use a global var and be done with it
Regardless I'm looking at 19 possible objects the player could be looking at (could be realistically lowered to around 10) and multiple nests across the map... not sure how a single variable would help in this case
or am I missing something?
you can use an array
Can you explain how that would work in this case? I currently have the nests in an array and listen for a thermite grenade... I was hoping to replace that with the action route
not sure how a single variable would help in this case
distance to a position
If it was one nest sure but I'm talking about several nests
player distance ([] call ST234_fnc_getNearestNestPosition)
_nestID = 5; //nest index
player addAction ["blabla", {
}, ...., format ["_this distance2D allNests#%1 < 3", _nestID], ...]
NestPositions = [/*...*/];
// ...
NestPositions findIf { player distance _x < 3 } != -1
```etc, etc
Ok... I don't think I'm fully tracking yet but I'm almost there! Thank you both
And there we go:
format["_this distance2D [%1, %2] <= 3;", (getPos _nest select 0), (getPos _nest select 1)]
lol is that worse?
it'll do
I mean it works but I also don't want to get stuck with "good enough". Are the other options "better" or just different?
well in general I don't think what you do is good. action conditions are evaluated every frame in unscheduled environment, and in this case it'll be evaluated all the time (since the action is added to the player). so if you have many of these "nests" it'll be bad, performance-wise.
Have any other clever solutions then? Should I just stick with adding actions to each the objects in the nest but changing the radius? At least that way they're not firing all the time
Hi, does someone have a recommendation for an animation of someone running and jumping from the ramp of a transport aircraft?
Well, I've gotta run... please ping me if you happen to think of something better
how about one of those transport unload ones? 
like the one for dismounting the back of a HEMMT
Maybe, I will take another look, thanks for the suggestion @little raptor
Hey, I need help with being able to move an non-physics object slowly from A to B on dedicated multiplayer
Still having trouble with it, and not much clue where to start 😅
p1 = [blabla];
p2 = [blablabla];
velo = [blabla];
spd = vectorMagnitude velo;
start = time;
duration = (p1 vectorDistance p2) / spd;
onEachFrame {
obj setVelocityTransformation
[
p1,
p2,
velo,
velo,
p1 vectorFromTo p2,
p1 vectorFromTo p2,
vectorUp obj,
vectorUp obj,
(time - start) / duration
];
}
AMAZING. Thank you 🙏
that's just for testing tho
Promise I'll reverse-engineer it when I'm not in mission crunch so I can better understand it 😆
Of course
Any clue if it'll work in MP yet? I'll test it but just curious to know
if you execute if locally yes
here's a quick test case:
p1 = getPosASL player;
p2 = getPosASL player vectorAdd [0,100,100];
velo = [0,1,0];
spd = vectorMagnitude velo;
start = time;
duration = (p1 vectorDistance p2) / spd;
obj = player;
onEachFrame {
obj setVelocityTransformation
[
p1,
p2,
velo,
velo,
p1 vectorFromTo p2,
p1 vectorFromTo p2,
vectorUp obj,
vectorUp obj,
(time - start) / duration
];
}
just go in Eden, place a player, run the mission and execute
@tidal ferry also you need to add a termination condition ofc
Will do
if (time - start > duration) exitWith {onEachFrame ""}
And yeah sounds good
trying to locate some control idc from inventory display, but don't know if using right event handler
player addEventHandler
[
"InventoryOpened",
{
params ["_unit", "_container"];
_unit spawn
{
waitUntil { !isNull ( findDisplay 602 ) };
{
( findDisplay 602 displayCtrl ( ctrlIDC _x ) ) ctrlAddEventHandler ["onMouseEnter", {
params ["_control"];
hint format ["%1", ctrlIDC _control];
}];
}
forEach ( allControls findDisplay 602 );
};
}
];
( findDisplay 602 displayCtrl ( ctrlIDC _x ) )
just put_x
error: displayCtrl expecting number, control provided
I said JUST _x
Script works great on players, but not on the object I want to move, which doesn't have physics
_x ctrlAddEventHandler ...
it doesn't have anything to do with physics
units don't have physics either
how are you trying to move the object?
Replacing player with the varname of the object
what's the object?
player addEventHandler
[
"InventoryOpened",
{
params ["_unit", "_container"];
_unit spawn
{
waitUntil { !isNull ( findDisplay 602 ) };
{
_x ctrlAddEventHandler ["onMouseEnter", {
params ["_control"];
hint format ["%1", ctrlIDC _control];
}];
}
forEach ( allControls findDisplay 602 );
};
}
];
no hints
It's a background object we have, virtually no physics
I can DM you about if if you'd like
WAIT
Nvm, think I got it
you've put onMouseEnter
there's no such event handler
it's mouseEnter
read the wiki
When using the event names listed here with the ctrlAddEventHandler, ctrlSetEventHandler, displayAddEventHandler or displaySetEventHandler commands, the prefix "on" in the event name must be removed (e.g. 'ButtonDown' instead of 'onButtonDown').
damn, I am blind
Hey @little raptor, question
Does the above script need to be executed in the scheduled, or unscheduled environment?
I'm looking to stuff it into an execVM so I can use it with parameters and modify as needed, but it breaks in execvm
Could very well be my own inattentiveness but just wanted to ask
it needs to be executed every frame
I got that
But I mean, starting the onEachFrame from execVM
Ah, gotcha
and onEachFrame always executes every frame
doesn't matter where you execute it
it's an event handler
and just to be clear, "for testing" doesn't mean "just change the variables and you're good to go"
it means you have to optimize it and fix stuff
what I wrote is naive and slow, and only for testing purposes
I know, I'm just trying to understand it
It gets the basic functionality that I need done in SP, I'm just trying to figure out how to put it in an execVM so I can more easily use it
params ["_obj",["_velo",[100,0,0]]];
p1 = getPosASL _obj;
p2 = getPosASL _obj vectorAdd [0,50,0];
//velo = [0,100,0];
spd = vectorMagnitude _velo;
start = time;
duration = (p1 vectorDistance p2) / spd;
_execCode = {
_obj setVelocityTransformation
[
p1,
p2,
_velo,
_velo,
p1 vectorFromTo p2,
p1 vectorFromTo p2,
vectorUp _obj,
vectorUp _obj,
(time - start) / duration
];
};
addMissionEventHandler["EachFrame",_execCode];
I'm aware this is probably super sloppy, but I'm also super tired 😅
I'm pretty sure that the local variables aren't being passed to the event handler, which is why it's not firing right
yes
if (missionNamespace getVariable ["alreadyExecuted", false]) exitWith {};
movingObjs = [];
alreadyExecuted = true;
addMissionEventHandler["EachFrame", {
{
_obj = _x;
_p1 = getPosWorld _obj;
_p2 = _obj getVariable ["destination", _p1];
_dist = _p1 vectorDistance _p2;
if (_dist < 0.1) then {
movingObjs = movingObjs - [_x];
continue;
};
_speed = _obj getVariable ["speed", 1];
_dir = _p1 vectorFromTo _p2;
_interval = _speed * diag_deltaTime / _dist;
_velo = _dir vectorMultiply _speed;
_obj setVelocityTransformation
[
_p1,
_p2,
_velo,
_velo,
_dir, _dir,
[0,0,1], [0,0,1],
_interval
];
} forEach movingObjs;
}];
there
it'll work with as many objects as you want
and the destination can change too
you just do:
_obj setVariable ["destination", _someASLPos];
_obj setVariable ["speed", _speedInMPS];
movingObjs pushBackUnique _obj;
fixed the vector up
Absolute legend
Thank you, you've saved me so many hours of trying to figure this out so far 😂
remember that this should be executed only once (per client)
and you only need to add it to clients who have local objects they want to move
this is the part that you execute for every object you want to move
I've been trying it, but it just goess at like light speed faster than I can track it
No clue where it's going
what do you put in for the variables and stuff?
this setVariable ["speed", 0.01];```
It goes to light speed even when I put it super low
Orriginally I had it at like 50
did you even make sure that the code executes once?
I'm in singleplayer, and this is object init, so it shouldn't be duplicated
I'm not talking about this
I'm talking about the event handler
I changed the code to make sure you don't mess it up
try it again
OH, hurr durr, I missed that 😅
And yet I still did
Sorry about that, thanks for your patience
I just tested and it works fine
player setVariable ["destination", getPosASL player vectorAdd [0,100,100]];
player setVariable ["speed", 1];
movingObjs pushBackUnique player
change pushBack to pushBackUnique to be safe
wait
wat?
are you executing that in init?
Object init, yeah
you should never put variable names in init
Oh?
they may not even exist
in your case finalPos may not even exist
...Very good point
So
It's somewhat working
So far, only problems are
- The speed is way too fast, definitely not in M/S, more like KM/S, but that's an easy fix
- The vector only moves vertically, think it's due to you putting the vectors as [0,0,1] in the setVelocityTransformation, though as we've proven, I am a dunce, so
no it's not
no
there's nothing wrong with my code
@tidal ferry
literally this plus that EH code
is there an opposite function to BIS_fnc_colorRGBAtoHTML ? ( HTML to RGB(A) )
I keep trying it, and it literally just keeps going up into the air
How are you executing it? Just debug console?
Yeah, I'm trying it from the debug console over and over again with almost the exact code
exit the game
I mean the mission
you've probably broken it
also make sure you've removed the old code
almost the exact code
try the exact code
I have
no change at all
especially this one
even the tiniest change will break it
Yeah, so, works perfectly fine on player unit
But it breaks on the object I'm trying to move
is your mission vanilla?
Nope
It's a very large, collissionless, physicsless, background prop inheriting from house_f
have you disabled its simulation or something?
Simulation is enabled
Essentially, when I fire the script
It basically moves at light speed to a position like
I'd say maybe 10-20km above the posASL I give it
As mentioned, it has no physics and basically just floats in the air
as I mentioned, physics has nothing to do with this
you're moving the object with position and velocity
not physics
Okay
Well, as mentioned it works for the player unit with the exact code you give me, but not with the object
Tbh I can probably just use a workaround with a dummy unit and attachto 😅
what about this?
blablaObj setVariable ["destination", getPosASL player vectorAdd [0,100,100]];
blablaObj setVariable ["speed", 1];
movingObjs pushBackUnique blablaObj
Testing
Also, I'm going to replace player in that code with finalPos, an invis helipad I've got placed that I want it to go to
Alrighty
that's my point
no
And, to be absolutely clear, replace blablaObj with the variable name of the intended object, yes?
yes
Same result
Basically, spinning sideways in a rotation around a position roughtly like... 10km above the player
Rising quickly
Rotational velocity is like, helicopter rotor speed
are you using this code?
Yes
Verbatim, pasted right into the debug console
Then with the second bit of code you just sent executed after that
Tbh I can probably figure out a workaround using attachto and physics objects given we know it works with the player unit
restart the mission and try with this instead:
_oldObj = blablaObj;
blablaObj = createSimpleObject [typeOf _oldObj , getPosASL _oldObj ];
deleteVehicle _oldObj ;
blablaObj setVariable ["destination", getPosASL player vectorAdd [0,100,100]];
blablaObj setVariable ["speed", 1];
movingObjs pushBackUnique blablaObj
This one
But also the EH yeah sorry
this is what that code has become
yes
Cool cool
that one has no problem at all
Do I replace blablaObj with the varname of the target object?
ofc yes 
Just making
Absolutely certain
That did... something different
It shifted position a little ways down from where it was originally at in the air
Rotated maybe like 90 degrees
Correction, now oriented to perfect north
what do you use for speed?
I have no idea then
Same 😆
I'll just cook a workaround with attachto and the player unit
Thanks a ton for your time and patience
I mean my direction code is not 100% correct
but I don't know what that has to do with position
let me fix that too
Up to you
if (missionNamespace getVariable ["alreadyExecuted", false]) exitWith {};
movingObjs = [];
alreadyExecuted = true;
addMissionEventHandler["EachFrame", {
if (isGamePaused) exitWith {};
{
_obj = _x;
_p1 = getPosWorld _obj;
_p2 = _obj getVariable ["destination", _p1];
_dist = _p1 vectorDistance _p2;
if (_dist < 0.1) then {
movingObjs = movingObjs - [_x];
continue;
};
_speed = _obj getVariable ["speed", 1];
_dir = _p1 vectorFromTo _p2;
_interval = _speed * diag_deltaTime * accTime / _dist;
_up = if (_dir#0 == 0 && _dir#1 == 0) then {
[0,1,0];
} else {
_dir vectorCrossProduct [_dir#1 * -1, _dir#0, 0];
};
_velo = _dir vectorMultiply _speed;
_obj setVelocityTransformation
[
_p1,
_p2,
_velo,
_velo,
_dir, _dir,
_up, _up,
_interval
];
} forEach movingObjs;
}];
try this instead
yeah
Same result
if (missionNamespace getVariable ["alreadyExecuted", false]) exitWith {};
movingObjs = [];
alreadyExecuted = true;
addMissionEventHandler["EachFrame", {
{
_obj = _x;
_p1 = getPosWorld _obj;
_p2 = _obj getVariable ["destination", _p1];
_dist = _p1 vectorDistance _p2;
if (_dist < 0.1) then {
movingObjs = movingObjs - [_x];
continue;
};
_speed = _obj getVariable ["speed", 1];
_dir = _p1 vectorFromTo _p2;
_obj setVectorUp [0,0,1];
_obj setVectorDir _dir;
_velo = _dir vectorMultiply _speed * diag_deltaTime;
_obj setPosWorld (getPosWorld _obj vectorAdd _velo)
} forEach movingObjs;
}];
@tidal ferry what about that?
Trying it
No visible effect
Wait I entred it wrong one sec
Same result as before
Just rotates to exact north and lowers by a few hundred meters
WAIT
It's slowly moving
Think we may have got it
this code moves the object
it has nothing to do with velocity transformation and stuff anymore
if your object doesn't still move the problem is your object
you are 
Someone posted this in the armadev subreddit and it got me thinking since I don't really know the true answer to give him.
https://www.reddit.com/r/armadev/comments/rgjdz0/question_about_publicvariable/
My thought is that it is going to send the whole variable over again if he modifies the variable and throws the public again.
Oh my God, @little raptor, thank you 😆
You have no idea how much time you've saved me here
what? did it work?
you said no 
Oh sorry
I said no, but then realized I typed it wrong
Then I corrected it and ssaid it worked
My bad 😅
That last iteration worked
In SP, at least
Going to test it for MP but should be just what I need
Thanks a ton for your time and help and patience
No way I would have been able to sort it with my sanity intact
So sorry if this isnt the right channel for his but if there a script/trigger i can place on a radio for the players to interact with and activate to set off a bunch of explosives?
The players basically mouse wheel on a radio and select a function and it sets off a series of explosives
It sends the whole variable
quick question. whats the best way to execute a slot restriction script for a Dedicated server?
currently i have it as
init.sqf
[] execVM "Scripts\Restrictions\PilotCheck.sqf";
PilotCheck.sqf
https://www.sqfbin.com/bovavopomebalegosuju
on the radio init field
this addAction ["Detonate Explosives","Scripts\Explosvies\Detonate.sqf'];
Detonate.sqf
_Bomb1, _Bomb2, _Bomb3 setDamage 1;
thats probably wrong or at least a round about way of doing it. im sure someone has a better idea of how to do it.
Anyone here know much about Sql work and database work?
yes, it's wrong
The addAction should have some extra parameters so the players can't activate it from the default 50-metre range. (https://community.bistudio.com/wiki/addAction)
The detonation script needs some tweaking. For example, to apply a command to multiple targets, you would need a forEach and an array:
{ _x setDamage 1; } forEach [bomb1,bomb2,bomb3];
But the setDamage command may not be right - it doesn't work with all explosives. You might need to instead use the ol' reliable fallback:
{ _bomb = createVehicle ["Bo_GBU12_LGB",_x,[],0,"CAN_COLLIDE"]} forEach [targetobj1,targetobj2];```
The script also needs some way to remove the action once it's been used. If it's okay to remove all actions from the radio, then `remoteExec` and `removeAllActions` will be all you need. If you want to only remove that specific action and leave others, it gets a little more complicated.
this addAction ["Destroy Charges",{ _x setDamage 1; } forEach [charge1,charge2,charge3]];
Okay... so im using a radio (ground static item) to set off the satchels... im close but now with the above line they just go off when nothing being pressed aka, the Destroy Charges action was not selected
this addAction ["Destroy Charges",{{ _x setDamage 1; } forEach [charge1,charge2,charge3]}];```
I love you
If I take a plane (with a pilot in it), put it in the air in the exact direction I want it to fly in, and give it a waypoint also in the exact direction I want it to fly in, then what type of AI should I disable in order for the pilot to fly in a completely straight line and not make any deviations from the path? anyone have any suggestions?
You could just use unitCapture and unitPlay for that
that was my initial thought, but will I be able to have it fly in a straight line in a random direction?
good question, not sure
ok I will check it out
yeah, I don't think unitCapture is a good option for me. I need it to fly for like 4 minutes
A script was provided to you, what happened to that?
I assume you mean this:
#arma3_scripting message
Yeah I forgot to respond to @tough abyss (my bad, thanks a lot for writing the script) but that script won’t help me since using setDir mid-flight will reset the plane’s velocity to zero.
then modify the code to preserve velocity as well (you will also need setVectorUp, otherwise plane may tilt)
Hello everyone! Havent posted in a while here, and the time has come. I've been making a custom tank composition for a while now, and some problems have stopped me from completing it. Its a Jagdtiger, and ii havent had any issues till the cannon of the tank. Originally i wanted to use a flak36 cannon, but there are no "animateSource ["base_Hide",1]; and so the base of the cannon sticks out. So I used the Pak40, hid the wheels and stands and locked it in place. there are some issues with it too! the cannon is mad tiny and when i try to attach anything to it, and move the tank, the attached item to the pak40 glitches back and forth like crazy. Any solutions to that? Either to use the Flak36 without the base (legs) or to attach a barrel to the >cannon< of the Pak40, so it can turn with the cannon, if it can be done. Thanks in advance! (pls ping if you have any answers)
Very simple question here. How can I get a vehicle to move once people gave boarded it? I'm really lost on how to trigger this properly.
if !(isNull objectParent player)
then {while {speed vehicle player >= 200}
do {addcamshake [5,5,5]; sleep 0.3};};
}```
can someone help me with this, it seems that the statement has no effect at all until i flip the greater than to smaller than
if the player is in a vehicle then do something (else do nothing) and leave
jesus christ that formatting
i still didnt get it, i took the example from the wiki
if (speed _truck1 >= 100) then {hint "You're going too fast!"};
i just changed the _truck1 with vehicle player, no hint appeared after hitting 100
ah ! well that explains it
This is a scripting issue that I'm lost on because I'm just a dumbdumb I guess. What I am trying to do is better understand how in missions you can have transports function well. My goal with the included mission sample is trying to get the transport to pick me up, drop me off, move ahead and wait there, and do that a few times. The only workaround I found was by disabling the AI to move and create a proximity trigger between me and the vehicle, but this is absolutely ineffective because it will only work once and not repetitively. Obviously transports aren't limited in this way, so I want to learn how to accomplish that.
Sample is in the VR map with vanilla assets so I tried to make it available for anybody to give me novice pointers here. Big thanks to anyone who wants to help what's likely one of the easiest questions regarding the editor. :p https://www.dropbox.com/s/50zewz0bmn003nw/WhatOnEarthAmIDoingWrongHere.VR.pbo?dl=0
It's missing triggers btw as I've been messing around the last two hours and still haven't a clue what I'm doing. Ignore that as the "obvious" mistake. Look at it as a template where I'd like to see a working solution.
Waypoints?
Could just set waypoint condition to wait until you're in the transport
Move to scripted location
Repeat arbitrary times
What would be the most efficient way of doing that? Like, the easiest way to set it up that any group that has that waypoint would meet the conditions. I've seen some for the player but I was hoping to better understand groups.
@leaden merlin Depends how you'd want it implemented
Would you want the entire group to be in the transport before it moves or just one or two or ?
Lots is left up to your discretion
whole group, ideally. I'm absolutely lost on it
Well for the most basic implementation of that it'd literally just be this for the condition
_allInVehicle = true;
{
if (vehicle _x != _vehicle) exitWith {_allInVehicle = false};
} forEach (units _group);
_allInVehicle
With _vehicle being the transport in question and _group being the group in question
obviously many ways to implement it and this is just barebones
but it's the general idea
you'd probably want to handle cases where the vehicle can't fit the entire group
I think I understand the conditions of that, but my brain is completely fogging out seeing it all click in the editor. That would be the trigger, yeah?
That would be the waypoint condition for the initial movement
so if that's what you mean by trigger then yes
So, big picture, how would this go? Disable the driving AI at a pickup spot, link the waypoint trigger as above with the condition to move so it can move, and repeat that?
Yup pretty much
as I said the fine details are largely up to you but that's the gist of it
you can write it like this: units _group findIf {objectParent _x isNotEqualTo _vehicle} == -1
technically you could shorten the above code to just
((units _group) findIf {vehicle _x != _vehicle}) == -1;
yup
was just writing that
though I did a forEach because the iteration may come in handy for other checks you may add in the future
cleaner to add more lines to the forEach than to chain conditions in a findIf
The trigger just needs to be linked to the vehicles waypoints too, right?
In 3DEN?
Yes
Not sure about the specifics of how 3DEN does it but that sounds right
I usually only set up waypoints via script
Glad it worked and glad I could be of help
I would heavily recommend looking into the group-related commands on the wiki if you want to get a better grasp on working with them
My issue was trying to understand the start-and-stop logic behind the transport itself. It wasn't so much whom to set as a trigger but more about how the underpinnings of it go.
It did!!!
Hello,I have a simple question. Can a custom function be called inside an event handler? I'm getting an error and I'm just checking I'm not looking for the wrong thing.
sure can
Weird, I'm getting an undefined variable in expression. But both variables are defined and exist. I even tried hardcoding the variables and the result is the same
Show code?
What's coming up undefined?
_unitTargetFunc 🙃
Would make sense if that's the case
local function definition trying to be called from an EH
"Error Undefined variable in expression: _unitTargetFunc"
Yup alright then
_unitTargetFunc is locally scoped
the EH does not get run in the same scope when the player dies
thus the function does not exist and you get that error
if you want to fix that you'll either want to make the function globally scoped via some means or pass it as a param to addEventHandler
nvm thinking of something else for the latter
Thanks for the info, If I make the function global though It seems I have to make a lot of my variables global as well otherwise it throws a similar error but this time for the function. I though it was never a good idea to make anything global am I wrong?
Functions are generally best made global unless you have a good reason to pass them as parameters
Or more simply unless you're not accessing them from outside of the local scope
In your case you need global access to the function for how you're trying to do this
As far as causing more errors
That'd be because you're accessing vars that are part of that file's local scope as part of that function
The thing to understand is that this is what's happening
Your file runs -> file defines locally scoped functions and vars -> sets up Killed EH -> file ends -> locally scoped functions and vars no longer exist
so then when your EH code gets run it's trying to call a function that no longer exists
same with your vars that your function uses such as _Threats
so you need to either make those vars globally scoped or rethink how you're doing things
That's a really good explanation, thanks I'll look into it. Though I might pick the lazy way and just make them all global even though I might regret it later
Global is only evil if you use it poorly
It's more about knowing when/how to use things than avoiding things entirely, they all have purpose
Glad somebody is smarter than me
Hi everyone!
So I can get all nearest tanks using this:
_all = nearestObjects [_this select 0, ["Tank"], 50];
What should I replace "Tank" with to get list of all nearest projectiles/bullets?
I tried "Bullet" and "Projectile" but that's not it.
Is there a doc page with a list of all available object types?
@frozen seal So a couple things to consider here
As I had to do this same sort of detection for my current mod
Firstly, I'm going to assume you're aware that that command only gets the nearest tanks within 50m, not all tanks
Secondly, the command and methodology to use is going to change depending on what you're trying to detect
As far as object types go you're just using class names, so if you look through config viewer that is essentially your list of object types
Combine that with inheritance and you can fine-tune what you detect
Now the main thing for you to keep in mind is that there is no general class that all projectiles inherit from
yeah was about to ask that
Generally all bullets inherit from BulletCore/BulletBase
but projectiles in general vary widely
from RocketCore/ShellCore/etc.
depending on what they are
I see. Let me give you a broader context of my problem. I'm trying to modify this script to work with tanks. Right now it only works with small arms and tank machinegun but not tank main gun:
_projectile = nearestobject [_this select 0,_this select 4];
setacctime 1;
_camera = "camera" camCreate (getpos _projectile);
_camera cameraeffect ["internal", "back"];
while{alive _projectile && alive _camera}do
{
_camera camSetTarget _projectile;
_camera camSetRelPos [0,-13,1.2];
_camera camCommit 0;
sleep 0.00001;
};
if(alive _camera)then{sleep 0.1};
_camera cameraeffect ["terminate", "back"];
camdestroy _camera;
setacctime 1;
I'm super new to scripting (but not to programming in general) so I might be missing some obvious things
I figured _this select 4 returns the current projectile type and it works fine with small arms, but for some reason it fails to work with tank main gun (nearestobject returns null)
Generally nearObjects is better for detecting things like projectiles than nearestObject/nearestObjects
So that could be part of it
Other than that I'm not sure, so I'd give that a shot
Sorry for noob question but scripting synthax melts my brain after years of coding in C#
I can't make getPos work in this case:
_pos = getPos _this select 0;
_projectile = _pos nearobjects [_this select 4];
(the script called from "fired" event, so if the documentation is correct _this select 0; should return the shooter, however I still get type mismatch error)
unary operator has higher precedence than binary
getPos _this select 0;
getPos _this => result
result select 0
change to getPos (_this select 0);
projectile should be passed to fired EH btw
That still gave me errors (something about 1 element provided, 2 expected).
But your advice about fired event having projectile argument is correct. No need for nearestobject. I wonder why did the original author use it.
Thank you!
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
see warnings in: https://community.bistudio.com/wiki/getPos
Is there a good video or tutorial someone could point me to? I wanna get into scripting in Arma, or is the documentation also good enough to learn it?
Would setVectorDir [0,0,0] make an object completely level?
Hey, question
Anyone know what the best way to rotate an object 90 degrees on the Z axis, relative to its current orientation, is?
new dir would be dir-cross-up
Ah nvm, found it
Thanks
On a related note, anyone know the classnames for the MLRS explosion?
Or really just, the largest possible explosion in vanilla arma 😆
E.g. "HelicopterExploBig" but b i g g e r
Also what does this mean?
forward vectorCrossProduct up gets you the right side direction vector
_newDir = vectorDir _unit vectorCrossProduct vectorUp _unit
_unit setVectorDirAndUp [_newDir, vectorUp _unit];
this is kind of a #server_admins question but I think its a bad script or something
what is a normal count of guaranteed messages?
as in, 3000 guaranteed messages in a second. that's really high, right?
How does one go about using https://community.bistudio.com/wiki/BIS_fnc_transformVectorDirAndUp?
Another question here! Looking to see how to get waypoints working in a script. For example...
"waitUntil {leader group player in truck1};"
How can I alter that to clear when a group enters the truck? I can understand individual units, but I wanted to get it working with a group. I tried replacing that with a group name directly, so unless that has to be formatted differently, I'm a bit lost.
how to get waypoints working in a script
what does that have to do with waypoints?
and you can't suspend in waypoint statements so I have no idea what you're talking about
How would I use setVectorDir to make an object completely level to the horizontal?
Sea level…
Why do vectors have to be so confusing 
that would be setVectorUp
not dir
wat?
what's confusing about vectors?
Just terminology, trying to describe rotations and such
Anyways- still having trouble with the thing I'm trying to do
I need to "pitch" an object I have about 90 degrees
Irrespective of rotation
Ohhh right thanks I was confused
Need to execute the script with multiple different objects, each with different rotational orientations
you said you wanted to rotate about Z tho
pitching is not rotation about Z
Sorry, terminology
I'm new to vectors
it's about X
you have to change the vectorDir and Up:
_y = vectorDir _obj;
_z = vectorUp _obj;
_x = _y vectorCrossProduct _z;
_newZ = _y;
_newY = _newZ vectorCrossProduct _x;
_obj setVectorDirAndUp [_newY, _newZ];
this is -90 deg rotation about X
Okay, thanks, I'll try this
if you want +90 negate _newZ
Dumb question- how doess one negate _newZ? Isn't it an array?
vectorMultiply
So like... _newZ = _newZ vectorMultiply -1?
_newZ = _y vectorMultiply -1
Gotcha
and even if you didn't know that you could just do:
_y apply {_x * -1}
Worked like a dream
Fantastic
Well, I'm figuring out now that apparently the model is upside-down 😆
Think I need to roll it 180 on the y-axis
because you put the code in the wrong place
No no, it's because of the model
I thought rotating it 90 degrees would work perfectly
Which it mostly did
But it needs to be rolled 180 degrees after that
So I need to rethink this a bit 
Okay so
Pitching -90 degrees, then rolling 180 degrees will work
My single brain cell is feeling pretty confident in that
Let me see if I can figure this out
Yeah nope clueless
I'm sorry, I'm a writer, not a mathematician
180 deg roll is just reversed up
vectors are mostly about imagination, not math
Okay, so _z multiplyVector -1?
_obj setVectorDirAndUp [_newY, _newZ vectorMultiply -1];
Bless 🙏
It was a gift from my last remaining brain cell
Finally got it working as intended, thanks so much for your help and guidance @little raptor 🙏
how can I parse Line One (something) from string Line One (something)<br/>Some Line two</br> ?
find
quaternions is where it's at. don't need to think about vectors 🙂
not supported in Arma
SQF has native matrix and vector support so it's several times faster
and easier
sqf doesn't offer any matrix interface either though
it does
2 and 3
lame
what a missed opportunity
oh there is matrix multiply and transpose
but you can't get or set the transform matrix of an object can you?
you can make it yourself
well not really
_y = vectorDir obj;
_z = vectorUp obj;
_x = _y vectorCrossProduct _z;
_mat = matrixTranspose[_x, _y, _z];
now do skew
you know what skew is, yes?
Hey, so does anybody know the best way to check what an object's 3den layer is?
I'm working on a script to help our missionmakers optimize their missions, but I'm having trouble finding a simple way to grab 3den layer on a specific object
Is that information available to check from an object in a mission?
https://community.bistudio.com/wiki/Eden_Editor:_Layer Did you read that?
Getting the layer an object belongs to is not possible IIRC.
what about getMissionLayerEntities?
and then finding the object is the list of objects?
That's my current working plan
That would work but it's not a direct way
Just need a way to find all missionn layers
from object to layer
we call it shear in mechanical engineering
to get all layers, use
getMissionLayerEntities layerID together with for
Wait, how would I use that with for?
Wait found it I think
I'd assume you loop until the layer is empty
Ha! Didn't remember that command 🤦♂️
Perhaps I should fix see also on the biki done
lots of fences and walls placed on sloping terrain are skewed
sure, but I don't think it's really needed to take into account 
how's that?
because you can't "set" the shear
right, that's the problem isn't it?
that there is no object setTransform matrix command
Another question for params specifically
So, I want my script to only accept object datatype
So currently params looks something like...
params [["_object",objNull,[objNull]]];
(I'm aware this is bad, will clean it up later)
But, for data type argument
What do I put there?
Do I just put something referencing an actual object? Or do I need to put a string like "object" or somesuch in?
Or well, better example would be like
params [["_trueOrFalse",true,[true]]];
Might've answered myself but still would love to be sure
btw isn't that just a visual thing? (only res lod) 
or all lods skewed?
it's already correct
I don't know
It's no different from rotation
undesired effect or something?
Sick, thanks
You know setting the transform would give you scaling too
well at least you can get it in A3
and set it too
but not as a matrix
it's new
What command is that
using the following
titleCut ["Transport zur Front wird vorbereitet...", "BLACK FADED", 18, false ,false];
*some code*
sleep 16;
*some code*
sleep2;
titleCut ["", "BLACK IN", 2];
in theory it should wait 18 seconds with black screen before returning to normal, right?
depends on what "some code" is
also sleep 2
@winter rose
[west, "HQ"] sideChat "Transport is being prepared!";
sleep 3.5;
player enableSimulation false;
titleCut ["Transport zur Front wird vorbereitet...", "BLACK FADED", -1, false ,false];
[player, ["hmvv", 125, 0]] remoteExec ["say3D", ([0, -2] select isDedicated), false];
sleep 16.0;
titleCut ["", "BLACK IN", 2];
player enableSimulation true;
sleep 2.0;
_player setPosATL (getPosATL createRespawn vectorAdd [random 3, random 5]);
can't you control all that using one titleCut?
I dont know 
basically, the black should last 18 secs before returning to normal
Can you assign variables to simple objects?
such as?
Using setVariable
Yes you can
Sick
I'm pretty sure CBA uses that for their namespace thing
I got it to stay black, but how do I end the black now 😮
How you did should do
why not locations? 
There was bug once where map processed locations even if invisible and it killed map fps
Don't they use location and simple object now? Depending on global or not?
ah yes:
if (_isGlobal isEqualTo true) then {
createSimpleObject ["CBA_NamespaceDummy", DUMMY_POSITION]
} else {
createLocation ["CBA_NamespaceDummy", DUMMY_POSITION, 0, 0]
};
_isGlobal isEqualTo true
well simple objects have local version too... 
why not use that then? 
it's also a (meh) way to check, whatever the provided data type 😬
it somehow cuts it out midway through
Didn't have back then
Is CBA code, they know what do
the meh is more about the fact that a potential non-boolean would reach here ^^

I dream of a super strict language like C# is (was?) and despise JS and its ===…
Let me tell you about a thing called Enforce Script 
harr harr 😁
yeah I heard the legend…
anyone know anything about registering items for ACE Fortify and executing a pushback on fortify_locations?
i have my script for it but it keeps throwing an errors for missing ; or ,
is it still acex? didn't some of that change due to the merge?
yup, seems like it changed https://ace3mod.com/wiki/framework/fortify-framework.html
huh. coulda swore theyd left it backwards compatible but whatever. cool. good looking out.
can we attachto and enable the "Freelook" ?
no
oh we can't thx for your answer Leopard20
can someone please explain to me the syntax for the Vector3D array that I need to use with setVelocity? I just need to set an object's speed to a set amount, say, 500. The other elements I would like to leave as they are. It says it's in the format [x, y, z] but I'm not sure what is what.
where is unit init called/local to? it seems like editor-placed units run their inits on the server
is this true for created units too? or are those created wholly-locally
the "Init" for an object in the editor is run in global so it's run for each clients and the server
Sorry I mean the init in the cfgvehicles def
If you createunit is that also run everywhere?
Yes
in better terms, how would I use the command to simply set the plane's forward speed to what I want, and not have the plane move in any other directions?
The velocity vector is just m/s along each axis
So set the velocity along the direction you want
Which is most easily done by setting the velocity to the vectorDir multiplied by your desired velocity
@plush nova also group locality can mess things up, so even though it's global you should exec the command on the client that the group is local to
And then it should have no issue creating the unit on other clients as well
So I should only call createunit if the group I'm adding it to is local, basically
Yeah, though you could get around that with a remoteExec to the client that it's local to
Right, call createunit directly* is what I meant
Yup
or I could just multiply each component by a certain amount and the direction would stay the same but the magnitude would increase, right?
anyone know what the turret path for the tank commander is?
im thinking its [_veh turretUnit [0]] but im just trynna make sure before i bring a server down to change it just to be wrong
@past wagonMultiplying the entire vector with vectorMultiply would result in the same as multiplying each individual component and putting them back together if that's what you're asking
If you multiply them by differing amounts it will no longer be the same direction
ok
well that doesnt seem to be working for me either
can anyone else come up with a script that just makes a plane fly in the exact same direction at a constant velocity for like 4 minutes? because I've been trying for hours and I seem to not be capable of doing so lmao
just use setVelocityTransformation
I wrote one here
Hmm is it generally a good idea to use setvelocitytransformation instead of setvelocity if you want "smooth" movement over mp with fine control
ok
you can try that too 
what is the interpolation interval?
I've written the full script already
Sorry by manual control do you mean you need to have player control of the unit? Or something else
I mean you have to control everything
well yeah but I wanna use my own script
position, vec dir, up
ik
then figure it out on your own
i mean, thanks a lot for telling me about that command because its literally everything I want in one
I just don't know what the interpolation interval is
i dont like copying other people's scripts
it's the amount of interpolation between two desired values
e.g. if you have two points an interval of 0.5 means midpoint
ok. so what effect does it have on the command in this context?
ohh
is it basically the point at when the changes occur?
or the midpoint between the two sets of states?
no. as I said it's the interpolation value
0 means state 1
1 means state 2
ohh
any value between 0 and 1 is interpolated between state 1 and 2
oh
so it picks which ever stage you give it via the interpolation interval and sets the object to that stage?

the wiki already explains it
just read it
Hey, anyone know ACE interaction framework well enough to help me get ace_interact_menu_fnc_addActionToObject working in multiplayer?
...Wait, hold on
Alright well I've read the wiki a few times and I no longer have a clue what this command does or if it will help me at all
why does a plane flying in a constant direction at a constant velocity have to be this complicated....?
what it actually does isn't set velocity
the velocity you give it is a "hint" for mp sync
basically what you're saying when you call setvelocitytransformation is "this object is on rails between point A and point B"
and the interval is where on the rail it is
so it instantly sets the object to that point on the rail?
the velocity does nothing on SP
yes
on MP the velocity is designed to be a "best guess" of how fast you're moving on those rails
it does
it sets the object velocity
okay then this command has nothing to do with what I need
oh yeah that's fair
although most usages of it i've seen hit it on eachframe anyways
so basically the way you could use it is each point in time you set it to a different place on the rail, and if you do this on every frame this looks like movement
ohhhh now it makes sense
but if I have a specific point in the mission when I want the plane to start flying, then how does the onEachFrame EH work?
wouldn't that be initialized at the start of the mission, so my code would start running right away?
you add the event handler whenever you want
okay
and its a mission eh
okay that makes sense
if I have the starting position, ending position, and direction of my object, what should I put for the velocity? I want the velocity to remain the constant
Is there any way to check from inside of a script if it is called, or spawned?
E.g. if a called function is accidentally spawned, it will abort and return an error
just use setPosWorld, getPosWorld, setVectorDirAndUp, etc. individually
and velocity is _p1 vectorFromTo _p2 vectorMultiply _speed
Can I use hashmaps the same way one would use dictionaries in Python?
Yes
that's what a "dictionary" is - a hashmap
cool, wasn't sure if there was any additional subtlety
Hello! Modding a legacy version of DayZ Standalone, 0.28, fully in SQF, and I'm having an issue. Since DayZ is all Enforce now I figured I'd have luck here. I'm trying to figure out how to allow scripts to run in a loop in the background on my server, first in the form of a debug menu showing FPS, location etc as a hintSilent. I've tried a few different things in my init.sqf, including call compile preprocessFileLineNumbers "debug.sqf" and [] execVM "debug.sqf" and neither method results in my debug menu appearing upon joining my server. debug.sqf is a simple file that starts a while loop and should call hintSilent with information about my name, UID, blood, shock and FPS. This script works perfectly in 0.14 but not in 0.28, is there something I am doing wrong?
This used to be easy as pie when I ran a 0.47 server so I'm probably missing something really simple
I added a diag_log to the sqf file and it isn't being logged so that must mean my script isn't even being called for whatever reason. Meanwhile I have a script in my root directory and use call compile preprocessFileLineNumbers for the hive saving script and it calls and loads just fine
not s ure if right place, but is there a way to edit weapon attributes? like increasing range of MPRL AA?
Resolved! Please disregard. I was attempting to reference a folder incorrectly
not via scripting
can you point me in the right direction?
ty
so i'm using _someUnit attachTo [player, [0, 0.04*25, 0.04*25], "pilot", true]; and it seems to work fine in SP, but on MP the attached object doesn't seem to follow the bone rotation
is there a way to do this onto a specific bone?
it doesn't seem to have that option
yes you're right, I know that it works properly tho
but I think I have found a solution for you
wiki says you could use setDir and then _attachedObj setPosASL getPosASL _attachedObj to synchronize the movement over network in MP
also you have this
_expl1 = "DemoCharge_Remote_Ammo" createVehicle position player;
_expl1 attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"];
_expl1 setVectorDirAndUp [[0.5, 0.5, 0], [-0.5, 0.5, 0]];``` in the wiki, could try adjusting this for your needs to see if it works
thanks, i'll try it out
playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", _house, false, _pos, 1, 1, 150];
How do I increase the volume?
playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", _house, false, _pos, 4, 1, 150];
Can I change it like this?
have you read the documentation?
Yes, but because there are two 1's, it's confusing...
the documentation's syntax does not use ones…
It does, in example 2. But if you look at the Parameters list, you can count the parameters and compare them to the examples to see which is which. Remember: optional parameters can be dropped from the end, but never skipped.
It does, in example 2
sssyyynnntttaaaxxx
The examples are a demonstration of the syntax intended to help people understand it, no?
I mean, the "Syntax" part of the doc doesn't use numbers, it lists parameter names
Note: I'm not saying the example is wrong, I'm saying that's where the 1s came from and it's pretty reasonable
which display IDD should I use for players on dedicated server? Just 46?
it doesn't matter whether they play on a dedi or a player-hosted
then the problem lies elsewhere. In SP and own hosted it works but on dedi it doesn't
what do you even talk about?
uh ye sorry, displayAddEventHandler
Then you can
On players' machine
Atleast I got that part right
, but somehow it is not doing it on dedicated server
that's what's in my init.sqf
doSomeStuff = (findDisplay 46) displayAddEventHandler ["KeyDown", "if ((_this select 1) == 54) then {_nul = [] execVM 'someScript.sqf'};"];
does 46 exist?
46 is just the mission, so I'd assume yes?
assert (!isnull findDisplay 46)
with the "assert" part?
what?
if I should put the assert before the brackets, I have never seen that word
assert (!isnull findDisplay 46);
doSomeStuff = (findDisplay 46) displayAddEventHandler ["KeyDown", "if ((_this select 1) == 54) then {_nul = [] execVM 'someScript.sqf'};"];
that's somehow also not working
anything in the logs?
Nope, it ends with the mods being loaded
well at least we now know for certain that 46 exists
yea
Is there any way to find out how much blood a unit is loosing?
I know about the isBleeding and getBleedingRemaining scripting commands but I would like to know how heavily a unit is actually bleeding as in how many of those blood stains (slop_00.p3d) are getting created by the units injury...
@fervent kettleI doubt it'll change anything, but just out of curiosity it might be worth trying to pass a code param rather than a string
May be a strange side-effect of the string needing to be compiled
I'm modifying an array server side and making it public with publicVariable. If called multiple times in 1 frame in an unscheduled environment, is the game smart enough to only update clients 'once' rather than spamming them?
Right now I'm making all the changes and calling publicVariable once, assuming that it isn't smart enough.
I don't believe so but someone who knows the implementation details might know for sure
how would I go over doing this?
doSomeStuff = (findDisplay 46) displayAddEventHandler ["KeyDown", {if ((_this select 1) == 54) then {_nul = [] execVM 'someScript.sqf'}}];
oh, that's simple and self explanetary
@digital rover Regardless I'd look into rethinking how you're doing things if something you're broadcasting is needing to be updated multiple times per frame at all
Also is there any way to set/give any of the commands returned by currentCommand?
You can run various commands that result in those actions but I'm not aware of any command that allows you to just pass those strings as a parameter
No
The network message is sent when you run the command
And it has to, because publicVariableEventHandler is a thing.