#arma3_scripting

1 messages · Page 671 of 1

tidal ferry
#

Ah copy

copper raven
#
{
  private _owner = _x getVariable ["owner", ""];
  if (isNull getAssignedCuratorUnit _x && {_owner isNotEqualTo ""}) then {
    private _ownerObj = missionNameSpace getVariable [_owner, objNull];
    if !isNull _ownerObj then {
      _ownerObj assignCurator _x;
    }
  }
} forEach allCurators;
tidal ferry
#

Uhhhhh

copper raven
#

idk

copper raven
#

i think what you input in "owner" box in editor, is saved in "owner" @ logics namespace

tidal ferry
#

Or sorry, find and un/reassign

copper raven
#

it should assign units to their corresponding curator logics

tidal ferry
#

Okay outstanding, let me try it

#

Server exec right?

copper raven
#

yes

tidal ferry
#

Wilco

little raptor
copper raven
#

ooh

#

meant _owner

sacred slate
#

@robust brook thx

copper raven
#

@tidal ferry edited, sorry brain stopped working

little raptor
#

wasn't owner the player UID?

#

if so it probably won't work

copper raven
#

yea then it won't

little raptor
#

player UID is just a number

copper raven
#

but i implied it's object var

#

did he mention anywhere that it's uids?

little raptor
#

you can just search among players and find the uid

copper raven
#

yup

little raptor
copper raven
#

can also be shit like #adminlogged

#

or something like that

little raptor
#

I think it might work

#
Can be an object's variable name, player UID or you can use #adminLogged or #adminVoted to give access to the server admin. In singleplayer, player will automatically assume control of game master module when this field is left blank.
sacred slate
#

how can i flag or tag some different units in the editor with the same value to send them into a array?

hushed tendon
#

@little raptor Thanks for the huge amount of help you gave me with this. Here is the pretty much finished product.
https://vimeo.com/532711065

little raptor
hushed tendon
little raptor
#

I mean the environment lighting

#

or is that default?

hushed tendon
#

I honestly don't know if that's a mod or not

#

I think it's base game arma just at the "Golden hour" time for arma.

sacred slate
#

this code works, but it seems wrong:

private _hcgroups = [
    [x1],
    [x1a],
    [xbd1],
    [xbd2],
    [xbd3],
    [xbd4],
    [xbds1]
];

{
    _x params ["_xItem"];
    player hcRemoveGroup _xItem;
} forEach _lootTable;
#

yeah i just filled the _loottable with a dummy for now.

#

guerilla coding.

little raptor
sacred slate
#

thx

fair drum
#

how frequent is too much to send a public variable. even if the public variable is something simple like a single string?

#

cause I kinda need to send it every 2 seconds... if that's too much i'll have to think of another way

little raptor
#

2 seconds is ok I guess

#

I think you should also consider the ping
the maximum (normal) ping I've seen is around 350

fair drum
#

i guess i could rewrite stuff so it runs locally on every machine. just wanted to minimize the loops running on each client

robust brook
fair drum
robust brook
fair drum
#

yeah

robust brook
#

Spamming a PVAR every 2 seconds would be worse

fair drum
#

mk gotcha

polar saffron
#

Hello, I have a question, how can I get the AI ​​to make an animation of an addon?

fair drum
polar saffron
fair drum
polar saffron
copper raven
#

use loop animation that stays

polar saffron
#

Thanks

fair drum
#

looking into more advanced module stuff. is there a way I can get all the available stored variables in a logic? I have the logic object to reference it.

copper raven
grand nebula
#

And i'm back, new day new issue; Creating a toggle Follow/Stay add action and keep getting an error about values not created when trying to remove the remoateStay and removeFollow actions, i understand why that's not working however i hope someone has a better idea to getting this working, or how to empty define the remoateStay and removeFollow objects to curb the error

object = _this select 0;
_stay = false;

if (_stay) then {
    removeStay = object addAction ["Stay",
    {
        _stay = true;
        object removeAction removeFollow;
    }];
} else {
    removeFollow = object addAction ["Follow",
    {
        _stay = false;
        object removeAction removeStay;
    }];
};
fair drum
#

whats the context. whats the parameters fed to this?

grand nebula
#

So the removeStay or removeFollow gets called on every run, however the first run it will be blank so errors out

fair drum
#

what will be blank

#

also, why are you using object?

copper raven
#

^ that's the issue if he calls the script multiple times

#

also you get all the arguments required to remove the action on use within the action code itself

fair drum
#

change object to something like _weener. just something else lol

grand nebula
#

For context, (Sorry i missed it). The scripts runs as many times as needed to flip between showing Follow or Stay

grand nebula
robust hollow
#

why not use a single action and just change the text?

(_this#0) addAction ["Follow",{
    params ["_object","","_actionID"];
    private _following = _object getVariable ["following",false];
    _following = !_following;
    _object setVariable ["following",_following];

    _object setUserActionText [_actionID,["Follow","Stay"] select _following];

        // I assume you need to do more than change the action text
    if _following then {/* something */} else {/* something else */};
}];
grand nebula
#

That sounds like a much better way to handle it 😆 Class! will take a look

grand nebula
copper raven
robust hollow
#

that would be for removing that action, but Mac was using one action to remove the other

copper raven
#

ahhh, yeah, mb

grand nebula
#

Well much appreciated peeps!

unborn drum
#

It does look a bit washed out, though, not sure why, as he said its probably just the perfect time

cerulean cloak
#

Is there any way to thicken up lines drawn with drawpolygon and also to make them appear on the GPS display?

robust hollow
#

iirc there isnt any good way. there was a similar question a few months ago about thickness, and the options were to either draw muliple lines (polygons) with a slight offset, or to try modifying the line image
#arma3_scripting message

#

you should be able to draw to the gps by adding the ui event to the gps map ctrl instead of the main map

cerulean cloak
#

Any chance you know that one off the top of your head?

robust hollow
#

uiNamespace getVariable "rsccustominfominimap" displayCtrl 13301 i think

cerulean cloak
#

I don't really know what to do with that. I've got

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw",  
{ 
    params ["_control"]; 
    _control drawPolygon [sector_a, [0.85,0.4,0,1]]; 
}];

drawing out lines currently would I just replace the bit before the event handler with what you sent?

robust hollow
#

replace findDisplay 12 displayCtrl 51 with it

cerulean cloak
#

It's not worked

robust hollow
#

uiNamespace getVariable "rsccustominfominimap" displayCtrl 101 try this instead

cerulean cloak
#

Still not seeing lines on GPS

robust hollow
#

😦 i am

cerulean cloak
#
uiNamespace getVariable "rsccustominfominimap" displayCtrl 101 ctrlAddEventHandler ["Draw",  
{ 
    params ["_control"]; 
    _control drawPolygon [sector_e, [0.4,0,0.5,1]]; 
}];

This is what I'm supposed to have, yeah?

robust hollow
#

yep

cerulean cloak
robust hollow
#

is your sector_e variable defined?

cerulean cloak
#

Yup, works a-ok on the map

robust hollow
#

is your gps display modified? it doesnt have grid lines like mine does

cerulean cloak
#

I can't think of any mods that'd do that. Would ACE/CBA have an influence on it?

robust hollow
#

i wouldnt have thought so.

cerulean cloak
#

Idk then. It still seems to have grid lines at 1 Km intervals though

cerulean cloak
quaint oyster
#

Can someone help me with something? I'm wondering if doing multiple [] call function; 's from a [] spawn { }; will queue them and wait for the call function to end before progressing? I'm having problems with a script which is nothing but call functions, and it seems to be queuing them, not proceeding till it finishes.

#
[] spawn {
[] call function1;
[] call function2;
[] call function3;
[] call function1;//again
};```
#

example.

robust hollow
#

it will finish one call before starting the next, but they are all executed in scheduled environment so it possibly wont finish them all in a single frame.

quaint oyster
#

ty

hushed tendon
fair drum
little raptor
#

Fsm is no better

#

The main issue is lack of optimization and lots of spawns

lusty rapids
#

Where do I edit the radarTargetSize

warm hedge
lusty rapids
#

O

proven charm
proven charm
torpid quartz
#
 [
VRTable,            
 "Turn on table",           
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",  
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",  
 "_this distance _target < 3",       
 "_caller distance _target < 3",       
 {},              
 {},              
 { TRIGGERWORK=true },     
 {},              
 [],              
 3,              
 0,              
 true,             
 false             
] remoteExec ["BIS_fnc_holdActionAdd", 0, VRTable];

Hey so I was using this on a locally hosted server, players could use it like a normal hold action however when it got completed it just duplicated the action.

So once they completed it there was now 2 hold actions, And on top of that it didn't execute any code.
However when I held the action down, even after they had duplicated the action 10 times, it worked first try every time.

Any ideas? I thought this was the MP compatible version.

willow hound
#

I suspect the issue is that this code block is executed multiple times.

#

TRIGGERWORK = true is not broadcast across the network to the other machines. When one client completes the hold action TRIGGERWORK is set to true on his machine, but not on the server and not on any other machine. If the same client then has the same hold action added again (for whatever reason, probably because the code block you posted is executed multiple times), completing it doesn't change anything on that client machine because TRIGGERWORK is already true.

ornate quest
#

Messing around with the spectrum device and for some reason i can't set #EM_Values using this missionNamespace setVariable ["#EM_Values​", TargetSigsArray]; It actually doesn't set and it's the only one being called. TargetSigArrays is valid array.

finite sail
#

guys... more really large number precision questions

#

whena server has been running for weeks... last session, mine started on 9th march and we stopped it yesterday

#

serverTime was 2.06117e+006

#

if I do something like

#

'''_st = serverTime;
if (_st > serverTime + 30) etc etc'''

#

is that going to fail?

#

in other words ... is 2.06117e+006 + 30 nonsense?

willow hound
#

Why don't you try it lol

finite sail
#

yeah, ill wait another 3 weeks lol

willow hound
#

What

finite sail
#

yes yes, i know what you mean, i intentionally misunderstood for comedy

willow hound
#

Just use 2.06117e+006 + 30 in the Debug Console

finite sail
#

ok so it doesnt appear to be nonsense in that debug does return expected answers

#

i can add 30 to it, and take it away again and I do arrive at the original number

#

I dont understand this way of writing numbers.. I always thought that in order to represent really big numbers, some precision was lost

#

thats why I asked

willow hound
#

It will be lost at some point

#

2.06117e+006 is scientific notation, some online converter told me that it's 2061170

finite sail
#

checks to see if thats more or less the number of seconds in 3 weeks

#

it isnt

#

bah.. im confuzzled.. not even sure if I'm asking the right question now

willow hound
finite sail
#

yes, i think thats part of what I'm getting at

#

I suppose the answer is.. dont leave your mission running for 3 weeks lol

#

thanks for your time, @willow hound 🙂

clever radish
#

Is there any way to force player to witch to AI?

Whenever a player dies, I want him to force spawn into the UAV so he can help his teammates using the UAV

willow hound
manic sigil
#

Think im getting close, though ive had to frankenstein my scripts together, a little publicVariable magic did a lot of work since I was setting important staging variables serverside and waiting for them clientside t_t

I cant seem to figure on this, though; is BIS_fnc_EXP_camp_playSubtitles local? It seems to be, but doesnt specify on the biki.

torpid quartz
#

haven't found anything google wise yet but I'll keep looking

#

would i need BIS_fnc_MP in the code somewhere?

willow hound
warm hedge
#

The goals of BIS_fnc_MP and remoteExec (and remoteExecCall) are completely the same, and remoteExec is advanced/enhanced/improved. No point to use BIS_fnc_MP

torpid quartz
#

ah right need the , 0 parts and stuff

delicate lotus
#

Is there a way to get the idd of a display I am hovering over / interacting with?
I need the display for the briefing screen for MP. I know the IDD for it in SP but it seems to not be the same for MP.

torpid quartz
#

wait no, that's wrong whoops. i'll let you type will i keep reading

proven charm
delicate lotus
#

Ah nice. There seems to also be a command to add tooltips so I can add tooltips to all controls of all displays with idd / idc. Thank you!

willow hound
#

What your code does is it runs BIS_fnc_holdActionAdd with the parameters you provide for it on every machine (indicated by the 0 parameter for remoteExec). So far so good, this needs to be done because BIS_fnc_holdActionAdd has local effect, meaning executing it on one client only adds a hold action on that client (other players won't be able to see it).

#

At this point I have to speculate because I don't know the specifics of your mission, but because you said that the hold action duplicates, I assume (as I also said earlier) that the code block that contains remoteExec ["BIS_fnc_holdActionAdd", 0] runs multiple times, because running that code multiple times will obviously add the same hold action multiple times.
It doesn't need to run multiple times on the same machine though: Again, because of the 0 parameter for remoteExec, BIS_fnc_holdActionAdd is executed on every machine every time that code block runs. So if client A runs that code block, he adds one hold action, if afterwards client B runs the code, he adds another hold action.
So the duplication problem should come from another piece of code, for instance a trigger that runs on multiple machines.

#

When the hold action is completed, it executes TRIGGERWORK = true. As I explained earlier, that sets TRIGGERWORK to true on the machine where the hold action was completed. By using publicVariable afterwards, we can broadcast the current state of TRIGGERWORK to every machine, so then one player completing the hold action will set TRIGGERWORK to true everywhere. After that, we have to find a way to remove the hold action on the other machines, but let's deal with that later.

torpid quartz
#

right gotcha.
Looking at the wiki there should be a way for this to only execute on the server by changing the 0 in ["BIS_fnc_holdActionAdd", 0] to something right? or would that not work because of the hold function needing to do stuff locally?

#

I'm also seeing stuff about it calling a script instead and having that run code on the server instead.

So instead of just having TRIGGERWORK = true you have execVM "SubFolder\test.sqf"

though that's on what I assume is a virtual machine, and I'm running a server locally on my own PC.

#

actually wait no, reading execVM now.

If I just put TRIGGERWORK=TRUE in a file called Script1.sqf and had the hold action execute

(example straight from the wiki lol)
_handle = execVM "test.sqf";

would that work

willow hound
#

What is the effect of TRIGGERWORK = true in your mission?

torpid quartz
#

It just set's a bool to true, and that bool is the condition for another trigger

#

The player is interacting with a computer, and doing so creates a task (trigger linked to task module)

all triggers have the Server only box ticked. is that a problem?

#

had an issue with things only happening for 1 person in the past and server only seemed to fix that

willow hound
torpid quartz
#

right, so do not that then haha

#

I know I could probably just create the task instead of making a bool true.
But I've got other missions I'm working, and PVP modes, and other things where if I can set a bool to true server side with a hold action or even just an addaction that would make a lot of stuff infinitely easier and more stream lined.
another example would be a pallet stacked with boxes is broken down with a hold action button that activates a trigger that would use the hold/show module to hide the original pallet, and then show a dismantled one (and unblocking the way down a narrow hallway)

willow hound
#
[VRTable, "Turn on table",
  "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
  "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
  "_this distance _target < 3 && !TRIGGERWORK", //Lazy solution to hide the Hold Action on all machines after it has been completed once
  "_caller distance _target < 3 && !TRIGGERWORK",
  {}, {},
  {
    TRIGGERWORK = true;
    publicVariable "TRIGGERWORK";
  },
 {}, [], 3, 0
] remoteExec ["BIS_fnc_holdActionAdd", 0, VRTable];
```This way, `TRIGGERWORK` gets updated on all machines.
What this doesn't fix is the hold action duplication, but all duplicates will be hidden after the hold action has been completed once. To properly fix the duplication, you have to find out why the `remoteExec` code runs multiple times.
torpid quartz
#

does the TRIGGERWORK need to be defined as a a public variable in the code, or can i put it in the mission init?

#

like

publicVariable "TRIGGERWORK";
TRIGGERWORK=False;

willow hound
#

Depends on which init file you mean. init.sqf?

torpid quartz
#

uh yeah i should probably be doing it there right? not in the init field in the options menu thing in editor.
esp if I have and init.sqf because that would override the editor one right?

willow hound
#

That's something I don't know; I've never used the Editor one.

#

But if you put TRIGGERWORK = false; into init.sqf, that's going to work (until we start looking at JIP behaviour, then it might not work anymore, not sure).

torpid quartz
#

if we can get the hold action to set the TRIGGERWORK bool to true on the server when a connected client executes the code and the bool being true activates the conditions for a trigger then I am one very happy man

#

I'll have a play around with it when i get home from work tomorrow when I can drag some people along to help me test. I'll post back here with the results

#

thanks a ton for the help ansin11, saving my bacon here

manic sigil
subtle bay
#

Can anyone figure out why this isn't working? Trying to drop the backpack but it doesn't show up on the ground, it works fine with vests and uniforms and hats.

_holder = createVehicle ["GroundWeaponHolder", getPosATL player, [], 0, "CAN_COLLIDE"];
_container = backpack player;
_holder addItemCargoGlobal [_container, 1];
_droppedContainer = (((everyContainer _holder) select 0) select 1);
{
_droppedContainer addItemCargoGlobal [_x, 1];
}forEach (backpackItems player);
removeBackpack player;

tidal ferry
#

Hey, anyone here familiar enough with ACRE2 API to know how to make a rack-mounted radio have speakers? Looking to make an intercom system for our ship

hushed tendon
grave thistle
#

Yeah. finally ended up using lineIntersectsSurfaces [eyePos player, screenToWorld [0.5,0.5]]

Works like a charm when getting the position of "the first surface" the player is aiming at

hushed tendon
#

Actually I figured it out. With optimizing the code and putting a sleep between the targeting and the attack gives the code enough time to realize the animals shouldn't attack each other.

tidal ferry
#

Found a function in ACRE that lets you set speaker audio source for a radio, but it only works for the 148, 152, SEM52, and SEM70

#

Which IIRC aren't rack-mountable

#

Anyone know how to get the specific radio ID of a rackmounted radio?

#

May have got it

quasi sedge
#

Is this correct?

if (playerSide == east) then {
    _plr = player;
};
winter rose
#

maybe? 🤷‍♂️

tidal ferry
#

Unless you've defined it earlier in the script, but no clue what the context or intended function si ;P

quasi sedge
#
if (playerSide == east) then {
    _plr = player;
};
_plr setDir (player getDir centerZONE);
_actionid = _plr addAction ["1", "scripts\spawnvehicle.sqf"];
_actionid1 = _plr addAction ["2", "scripts\getAsGunner1.sqf"];
_actionid2 = _plr addAction ["3", "scripts\getAsGunner2.sqf"];

if (playerSide == resistance) then {
    _dm = player;
};
_dmArsenal = _dm addAction ["VA", {["Open", true] spawn BIS_fnc_arsenal;}];
winter rose
#

@quasi sedge if player is east then { do all the east operations }

quasi sedge
#

@winter rose this good?

if ((side player == east)) then
{
    player setDir (player getDir centerZONE);
    _actionid = player addAction ["1", "scripts\spawnvehicle.sqf"];
    _actionid1 = player addAction ["2", "scripts\getAsGunner1.sqf"];
    _actionid2 = player addAction ["3", "scripts\getAsGunner2.sqf"];
};

if ((side player == resistance)) then
{
    _dmArsenal = player addAction ["VA", {["Open", true] spawn BIS_fnc_arsenal;}];
};
winter rose
#

look better indeed!

#

(just no need for double parentheses 😉)

dreamy kestrel
#

Q: is there better documentation for the https://community.bistudio.com/wiki/BIS_fnc_showNotification function, arguments, etc? for instance, would like to connect string replaced arguments, potentially in the scope of a configuration, i.e. "%1 ... %2 ... %3", are these the actual arguments being passed in?

little raptor
dreamy kestrel
quasi sedge
#

How to "refresh" ammo on this loadout?

onPlayerKilled.sqf:
player setVariable ["Saved_Loadout",getUnitLoadout player];

onPlayerRespawn.sqf:
player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
#

like if i launched all my RPG rounds, but when i respawn i want full backpack

dreamy kestrel
wary lichen
#

can you give an example? afterburner script for jet

dreamy kestrel
#

Q: how might I get the thing, or at least a vector, down the sights of the player weapon, scope, etc? I just need a straight line vector, I think, that can be used to determine what the player might be targeting.

buoyant hare
#

I'm trying to add custom marker that should be shown in the briefing map before starting the mission. However, the code used below won't trigger any actual marker until I'm in-game and run the code through the console. Any tips on what I'm doing wrong? Thanks in advance!

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", "
    _this select 0 drawIcon [ 
    getMissionPath 'media\my_image.paa', 
    [0,0,0,1], 
    [3041.649,7352.639], 
    24, 
    24, 
    0, 
    '', 
    1, 
    0.03, 
    'TahomaB', 
    'right' 
    ] 
"];
little raptor
buoyant hare
#

I've tried on the init.sqf of the mission.

little raptor
#

before that code

buoyant hare
#

@little raptor cheers, will give it a go!

#

@little raptor the code you gave me gave me a "No display" system message.

little raptor
#

so it doesn't exit

#

try a waitUntil:

if (!hasInterface) exitWith {};
waitUntil {!isNull findDisplay 12};
#

put it before that code

buoyant hare
#

Cheers again, will give it a go!

wicked fulcrum
#

How does magic variables behave if you got a loop inside a loop? Will _x always point to the inner most loops variable?
So to get the outer-loop variable I should save it in a private _temp = _x; before going into the inner loop?

winter rose
#

and yes, good solution 🙂

wicked fulcrum
#

Thanks for the quick reply 🙂

winter rose
#
{
  private _array = _x;
  {
    hint _x;
  } forEach _array; // _x would work too
} forEach [
  ["1", "2"],
  ["one", "two"]
];
wary lichen
little raptor
# wary lichen any ideas?

it can't really be scripted
you can try addForce or setVelocityModelSpace (with gradual increase) for the increased speed
the exhaust effects may not be possible. idk

cerulean cloak
#

I have code that's trying to draw on the GPS side panel referencing ```sqf
private _display = uiNamespace getVariable "RscCustomInfoMiniMap";
private _control = _display displayCtrl 101;

cerulean cloak
#

It doesn't draw anything on the GPS

little raptor
#

did you check if the display exists?

cerulean cloak
#

Yup,

 systemChat str (uiNamespace getVariable "RscCustomInfoMiniMap")
``` returns `Display #311`
little raptor
#

what code do you use for draw?

cerulean cloak
#
private _gpsdisplay = uiNamespace getVariable "RscCustomInfoMiniMap";
private _gpscontrol = _gpsdisplay displayCtrl 101;

_gpscontrol ctrlAddEventHandler ["Draw",  
{ 
    params ["_control"]; 
    
    _control drawtriangle [[sector_a select 0,sector_a select 1,sector_a select 2], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 2,sector_a select 3,sector_a select 4], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 4,sector_a select 5,sector_a select 0], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 0,sector_a select 2,sector_a select 4], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
}];
#

Works fine when it's run on the map as

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw",  
{ 
    params ["_control"]; 
    
    _control drawtriangle [[sector_a select 0,sector_a select 1,sector_a select 2], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 2,sector_a select 3,sector_a select 4], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 4,sector_a select 5,sector_a select 0], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 0,sector_a select 2,sector_a select 4], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
}];
little raptor
#

map is not gps

cerulean cloak
#

I know but that shows that the drawing part is fine it's something to do with the display

little raptor
#

draw event handler only works on map

cerulean cloak
#

But it works fine in a different mission file.

little raptor
#

what does ctrlType (_gpsdisplay displayCtrl 101) return?

#

also do sectors exit?

cerulean cloak
#

Yes

#

Doesn't return anything when run in the debug but _gpsdisplay is a private variable so isn't it inaccessible for this?

little raptor
cerulean cloak
#

Still nothing

little raptor
#

I mean systemChat str ctrlType _gpscontrol;

cerulean cloak
#

Still nothing

little raptor
#

then your code has an undefined variable somewhere

#

or _gpsControl is null

little raptor
cerulean cloak
#

No.

little raptor
#

well then how did you expect it to work?

#

it's a local variable

cerulean cloak
cerulean cloak
#

Running it in the main draw thing returns 101. "in that code" is quite vague

#

But yeah, the same code works just fine for the GPS in a different mission file and since _gpsdisplay and _gpscontrol are both private variables I don't see how they'd be impacted by anything outside the script.

little raptor
#

but I'm now 99% sure the problem is the sector_a variable

cerulean cloak
#

What I'm confused by is that

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw",  
{ 
    params ["_control"]; 
    
    _control drawtriangle [[sector_a select 0,sector_a select 1,sector_a select 2], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 2,sector_a select 3,sector_a select 4], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 4,sector_a select 5,sector_a select 0], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 0,sector_a select 2,sector_a select 4], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
}];

works a-ok whilst referencing sector_a in the same way

little raptor
#

try this:

private _gpsdisplay = uiNamespace getVariable "RscCustomInfoMiniMap";
private _gpscontrol = _gpsdisplay displayCtrl 101;
gpscontrol = [_gpscontrol];
onEachFrame {
gpscontrol params ["_control"]; 
    
    _control drawtriangle [[sector_a select 0,sector_a select 1,sector_a select 2], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 2,sector_a select 3,sector_a select 4], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 4,sector_a select 5,sector_a select 0], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
    _control drawtriangle [[sector_a select 0,sector_a select 2,sector_a select 4], [1,1,0,1], "#(rgb,1,1,1)color(1,1,0,0.25)"];
}
#

if it works then the problem is the event handler

cerulean cloak
#

It does not work

little raptor
#

what does this give?

private _gpsdisplay = uiNamespace getVariable "RscCustomInfoMiniMap";
private _gpscontrol = _gpsdisplay displayCtrl 101;
gpscontrol = [_gpscontrol];
onEachFrame {
gpscontrol params ["_control"]; 
hintSilent str _control;
}```
cerulean cloak
#

A hint showing Control #101

little raptor
#

then it should work 🤷

cerulean cloak
#

😕

#

Guess I'm just shafted then.

little raptor
cerulean cloak
#

What could I have done in the mission file that would have changed the GPS display?

little raptor
#

what happens when you do this?
uiNamespace getVariable "RscCustomInfoMiniMap" closeDisplay 2?

cerulean cloak
#

One minute

#

Didn't seem to do anything

little raptor
#

or try this:

uiNamespace getVariable "RscCustomInfoMiniMap" ctrlCreate ["RscText", -1] ctrlSetText "WTF"
cerulean cloak
#

Also not seeing anything

little raptor
#

then you're targeting the wrong display

little raptor
cerulean cloak
little raptor
cerulean cloak
#

?

little raptor
#

is it part of ACE or something?

cerulean cloak
#

The GPS side panel?

little raptor
#

yes

robust hollow
#

its vanilla...

cerulean cloak
#

No? But targeting it with _gps control works just fine in a different mission file with identical mods

little raptor
#

then I have no clue

#

whatever it is it's not the same display

#

either that or you're executing the code wrong (in MP)

cerulean cloak
#

It's single player :/

#

I just wish we could draw polygons in the editor like we can for rectangles and circles.

robust hollow
#

does the gps change if you do this?
uiNamespace getVariable "rsccustominfominimap" displayCtrl 101 ctrlSetBackgroundColor [1,0,0,1]

cerulean cloak
#

It should go red yeah?

robust hollow
#

yea

cerulean cloak
#

It doesn't go red

little raptor
robust hollow
#

and you say it works fine in a new/clean mission?

cerulean cloak
#

Yeah

robust hollow
#

so.. have you considered disabling things in your mission until it works?

cerulean cloak
#

I was thinking about that but wasn't sure what I should start with.

robust hollow
#

anything to do with a ui/hud

cerulean cloak
#

addactions?

little raptor
cerulean cloak
#

I'm not wanting to touch the modlist. I'm planning on making the mission for the unit I play with and I'd rather not have to alter the modlist for this. If it's not gonna work then I'll just need to cut my losses.

winter rose
#

maybe, but if you want to fix an issue you have to identify it first

#

if you identify it's the mods, then keep the mods and forget your script/find another way

copper raven
#
private _displays = uiNameSpace getVariable "igui_displays";
private _ctrlGPS = _displays select (_displays findIf {!isNull (_x displayCtrl 101)}) displayCtrl 101;

try that

drifting sky
#

A2OA: 3 questions. 1) Can I reload a specific mod while in game? Including FSM that are in that mod? 2) Are FSM scheduled or unscheduled? 3) Are _ local variables local to the entire FSM?

little raptor
cerulean cloak
little raptor
#

it's supposed to find the first display that has a control#101

cerulean cloak
#

Doesn't return or change anything

drifting sky
#

can I reload an FSM or the mod in which it is contained, while the game is running? So that it reflects changes that I've made.

little raptor
copper raven
#

gonna take a look in a sec, what exactly are you trying to do?

little raptor
#

_ctrlGPS is your _gpscontrol thing

robust hollow
cerulean cloak
#

IT WORKS!

little raptor
little raptor
drifting sky
#

what do you mean by "you can try your FSM in a mission first"

little raptor
copper raven
#

not fully tested, but the display holding the 101 control seems to be at index 12 in the array, atleast it's hardcoded in my code, but haven't used it for a long time (hence the findIf solution)

drifting sky
#

I cannot determine why I'm getting the error that "_timeout is undefined" in the suppressfor espression. if (_know <= 0.1) then { _timeout = time + 2 + random 3; } else { _timeout = time + 1 + random 1; }; _this suppressFor _timeout; This is in a state's InitCode field.

little raptor
#

@cerulean cloak ```sqf
private _displays = uiNameSpace getVariable "igui_displays";
_disp = _displays select (_displays findIf {!isNull (_x displayCtrl 101)});
{if (uiNamespace getVariable [_x, ""] isEqualTo _disp) then {breakWith _x}} forEach allVariables uiNamespace;

robust hollow
copper raven
#

reading the above chat, you already had the control 101 reference?

#

so display should be the same then

#

🤔

little raptor
#

except it's not. it was a different display

copper raven
#

time for some testing

#
private _displays = uiNameSpace getVariable "igui_displays"; 
_disp = _displays select (_displays findIf {!isNull (_x displayCtrl 101)}); 
_disp isEqualTo (uiNamespace getVariable "rsccustominfominimap")

prints true

little raptor
copper raven
#

ahhh, that explains it then

winter rose
#

I bet ACE?

little raptor
#

if not a mod then it's a game bug

#

it creates a display but doesn't set the variable

digital torrent
#

anyone know if it is possible to spawn a module (Game master) using the console? and set the right(owner) to me with all addon mode?

winter rose
#

@digital torrent seek the curator's functions on the wiki, you should be able to make yourself Zeus I think

copper raven
#
private _logic = createGroup sideLogic createUnit ["ModuleCurator_F", [0, 0, 0], [], 0, "NONE"];
_logic setVariable ["addons", 3, true];
_logic setVariable ["owner", getPlayerUID player, true];
[player, _logic] remoteExec ["assignCurator", 2];

should work i guess? (run on client)

drifting sky
#

can i make a danger.fsm in my mission, and set it to run on a unit, while overriding the danger.fsm implemented by a mod?

digital torrent
#

@copper raven i will teest it out sharp. thx a lot

#

@winter rose thx for the reply

fresh wyvern
#

Hi, anyone who knows how to swap out the 2× Minigun 6.5 mm on the Ghost Hawk for something else?
addWeaponTurret ["2000Rnd_65x39_Belt_Tracer_Red", [-1]]; or
addWeaponTurret ["2000Rnd_65x39_Belt_Tracer_Red", [-0]];
Only creates an imaginary turret shooting straight forward.

pulsar bluff
#

hey fellas, cant remember how to do it with high accuracy ... How to save an object composition so it can be used anywhere? not using BIS_fnc_objectsGrabber (not accurate enough with Z-axis)

#

nm sorta hacked it together

drifting sky
#

anyone here very familiar with FSM's?

robust hollow
#

possibly. what do you need to know?

drifting sky
#

Timer based condition is not firing. I need help figuring out why.

cold glacier
#

What've you got so far?

drifting sky
#

this state is firing (code in initCode):

_stopUntil = 0;
if (_know <= 0.1) then {
    _stopUntil = time + 2 + random 4;
} else {
    _stopUntil = time + 1 + random 2;
};
_this suppressFor _stopUntil;
player sideChat format["PRONE, _stopUntil %1",_stopUntil];```

A condition from this state to the next is:

time > _stopUntil


and for debug purposes it has this action:

```player sideChat "DONE PRONE";```

That message is never displayed.
#

and the code in the next state is never executed

#

I do see the first message "PRONE, _stopUntil: x"

#

but I never see the second message, "DONE PRONE"

robust hollow
#

would probably need to see the fsm file. side note: suppressFor takes the duration in seconds, but you provide elapsed mission time + n + n. is that intentional?

drifting sky
#

this is in a danger.fsm

#

oh right, nice spotting, but that shouldn't prevent the condition from firing, correct?

robust hollow
#

like... if you have played for half an hour, that unit is going to suppress for half an hour and a few seconds

#

no it shouldnt

drifting sky
#

but just in case i'm going to fix that and then test it.

#

if you are willing to look at the file, i'll post it after

#

hmm, i can't post it here, can i?

robust hollow
#

not as a file, no

cold glacier
#

Throw it on somewhere like pastebin or ghostbin

drifting sky
#

Here it is as a text file, if you save it as .fsm, you can see it in the editor.

#

the last state that works correctly is captioned "GO PRONE"

#

the condition that is failing is captioned "go prone timeout"

robust hollow
#

wouldnt it always go to the rest condition as it is true?

drifting sky
#

shit... didn't see that! egg on face

#

thanks for spotting that

#

does anybody know when exactly the danger caused by "can fire" will be triggered?

#

can i call a function defined in init.sqf inside of danger.fsm?

robust hollow
#

yea

drifting sky
#

it's not working for some reason.

robust hollow
#

is your function a global variable? eg TAG_fnc_xyz = {...

fresh wyvern
drifting sky
#

sorry, had a typo in the function name

#

uh, does sleep work inside an fsm?

robust hollow
#

iirc no, but i will double check

#

yea, no. fsms are executed in the scheduler, but they dont support suspending.

drifting sky
#

hmmm...

#

do you know how frequently conditions are tested?

#

or if there is a way to adjust the frequency?

robust hollow
drifting sky
#

but I could spawn a function which itself does allow suspension, and through that piece of code, set a variable used to evaluate a condition in the fsm. Does that check out?

robust hollow
#

if the variable is global then sure, but you would need to be sure the spawn has set the variable before the fsm tries to use it

drifting sky
#

i'm going to use a variable set to the unit

robust hollow
#

just so im clear in what i mean. if you do this in an fsm

diag_log format["fsm 1 %1",diag_frameno];
[] spawn {diag_log format["spawn 1 %1",diag_frameno];};
diag_log format["fsm 2 %1",diag_frameno];

it will log like this

12:09:02 "fsm 1 5200"
12:09:02 "fsm 2 5200"
12:09:02 "spawn 1 5201"

so the spawn may not set that variable before you try to use it. seeing as you are using an fsm i'd go for the time out method like you used elsewhere but if the delay isnt an issue then it doesnt matter 👌

drifting sky
#

the system I've set up is working

#

however, I don't seem to be able to force the ai to stop shooting and to move

dreamy kestrel
#

hmm... so, how do I tell the vector the player is aiming towards?

#

I thought perhaps cursorTarget might possibly tell me, but it is not returning anything useful.

little raptor
dreamy kestrel
#

nice thanks!

drifting sky
#

what's the function to get the sign of a number?

warm hedge
#

Meant plus or minus? Not directly, you can use >or some command to detect

dreamy kestrel
cold glacier
#

['+', '-'] select (_myNumber < 0)

#

Is probably the shortest way to get the sign as a symbol, off the top of my head

#

Otherwise yeah, what POLPOX said if you just need to test

viral rivet
#

does anyone have a halo jump script that works? the ATM airdrop script i had been using broke after an update i think

#

just something simple you can go to a flagpole, select halo jump, set your altitude and location on the map the click to drop

cyan dust
#

Good day. How do you set up event handler order? I want mine to be executed last of all

robust hollow
#

it goes in the order it was added, last added first executed

cyan dust
fair drum
#

huh til

robust hollow
#

remove system events, add yours then readd system events after

#

not at all ideal but there isnt any other way that i know of

fair drum
#

is it necessary to have your events at start? maybe run the event script after a delay?

cyan dust
cyan dust
ornate quest
#

Does anyone know why EM values for the spectrum device is not being set? I'm giving it a single valid array with valid elements and it's not being set. missionNamespace setVariable ["#EM_Values​", TargetSigsArray]; This is called inside a while(true) statement with some maths to generate signal frequency and strength. I can actually set it via triggers and init scripts but not inside my script.

little raptor
robust hollow
#

it may only be for a specific event or type of events, but im sure ive read it somewhere

ornate quest
#

What do you mean?

little raptor
little raptor
#

it's not valid for a variable name

ornate quest
#

It's straight from the wiki

little raptor
robust hollow
ornate quest
#

The variable name is #EM_Values

little raptor
robust hollow
#

yep

#

you just cant reference it directly like #EM_Values = [];

#

needs to use get/setVariable

little raptor
ornate quest
#

Yeah

#

When i systemChat it all i get is namespace

little raptor
#

wat?

ornate quest
#

systemChat str missionNamespace getVariable "#EM_Values"; returns Namespace

#

Should be an array

little raptor
#

that's wrong

#
systemChat str (missionNamespace getVariable "#EM_Values")
robust hollow
ornate quest
#

I'm not getting any errors with it

#

But i tried it and now it's giving me nothing

#

systemChat str (missionNamespace getVariable "#EM_Values");

robust hollow
#

which means the variable isnt defined

little raptor
#

or this one isn't defined TargetSigsArray

ornate quest
#

It is

little raptor
robust hollow
#

what does systemchat str TargetSigsArray show?

ornate quest
#

[140.8,-5,141.8,-30]

#

TargetSigsArray is not the issue

#

100%

little raptor
#

then your code is wrong

ornate quest
#

I've debugged every single line of code

#

And it's working as intended

little raptor
#

set the variable manually in debug console

#

see if it works

ornate quest
#

missionNamespace setVariable ["#EM_Values​",[140.8,-10,141.8,-18]]; no effect

#

I can do it with triggers weirdly enough

#

And the code is the same

#

missionNamespace setVariable ["#EM_Values​",[140.8,-10,141.8,-18]];

little raptor
ornate quest
#

^^ trigger code

little raptor
#

did you stop the loop?

ornate quest
#

Yeah i know

#

It's in a while(true) loop

robust hollow
#

are you doing just that line in debug or in your script? i can set that variable fine in debug

ornate quest
#

Debug

robust hollow
#

kinda sounds like you have something wiping the var

ornate quest
#

That's the only thing that sets it

robust hollow
#

does any contact code wipe it? i dont own it so cant check myself

ornate quest
#

Where would i find it?

#

And i doubt it

robust hollow
#

i imagine there is a functions_f_contact folder or something

ornate quest
#

And it shouldn't

robust hollow
#

maybe try the functions viewer first, if you dont want to mess with the pbos

ornate quest
#

Because the values stay when i trigger it with the trigger

little raptor
robust hollow
#

mmmmmmm 😦

little raptor
ornate quest
#

Yes

little raptor
#

did you try without your loop or the trigger?

#

in debug console

ornate quest
#

Yeah

#

Still didn't set

midnight niche
#

Sorry to butt in,

Any reason why this would work in debug and not when called from a script?

[_vehicle, _weapon] call BIS_FNC_FIRE;```
midnight niche
#

I wish it was that easy

robust hollow
#

well... based on that snippet alone the variables arent defined sooooooooooooo

midnight niche
#

🤦‍♂️

Disregard, I just realized I was exiting before it got called

#

is there any difference for bis_fnc_fire and forceWeaponFire in mp? (or at all)

ornate quest
#

I'll boot up vanilla and make a map so you can play around with it

robust hollow
ornate quest
#

If it was just a mod thing messing with it i'll be extremely mad

midnight niche
ornate quest
#

@little raptor Are you still keen of helping me? I have a vanilla map, same script and it's still not working

little raptor
#

(exec in debug console)

ornate quest
#

Still nothing

#

I'll just write it off as a bug

little raptor
# ornate quest Still nothing
onEachFrame {missionNamespace setVariable ["#EM_Values​",[140.8,-10,141.8,-18]];
hintSilent str (missionNamespace getVariable "#EM_Values​");
};
#

what about that?

ornate quest
#

Nothing

little raptor
#

@ornate quest I think I got it

#

try this:

#
missionNamespace setVariable ['#EM_Values​',[140.8,-10,141.8,-18]];
ornate quest
#

Nothing

little raptor
#

which debug console do you use?

ornate quest
#

Vanilla

#

Executed globally

#

I have no idea what's going on

little raptor
#

hmm thonk

ornate quest
#

But imma take a break and try it again tomorrow

little raptor
ornate quest
#

I closed my game but i'll send you the map

little raptor
#

and this:

onEachFrame {
_str = toString [35,69,77,95,86,97,108,117,101,115];
missionNamespace setVariable [_str,[140.8,-10,141.8,-18]];
hintSilent str [missionNamespace getVariable _str];
};
ornate quest
#

It's just vanilla no mods needed

little raptor
#

try them whenever you can then

#

I have a feeling the game is filtering out the #

ornate quest
#

Will do

robust hollow
#

worked fine for me 😦 BI uses # in variable names in a lot of modules

sacred slate
#

can some one tell me whats wrong here:

{

   if (side _x == "EAST") then {
  
   _x addEventHandler ["Killed",
        {
            _count = 1;
            dreResourcesW = dreResourcesW + _count;            
            hint str dreResourcesW;            
        }];
   };

} foreach allunits;

little raptor
#

did you try the vanilla debug console?

robust hollow
#

yea

little raptor
#

maybe cba's then 😛

#

it makes no sense to me

ornate quest
#

I tried with CBA and vanilla

little raptor
#

this should've given you something

ornate quest
#

With and without mods

little raptor
robust hollow
little raptor
#

it's setting the variable and reading it immediately

ornate quest
#

Yeah it didn't

little raptor
#

unscheduled

sacred slate
#

oh

little raptor
ornate quest
#

Yeah

little raptor
#

and you never tried local?

ornate quest
#

Tried everything

#

Local, server, global

little raptor
#

it will definitely show something

ornate quest
#

I'm not in the game anymore but i'll try it tomorrow

little raptor
#

ok

wispy pond
#

trying to add a flag to a vehicle via the config file in the pbo file

#
        init = "_this forceFlagTexture ""\A3\Data_F\Flags\Flag_red_CO.paa""";
#

is this what needs to go in it because so far its not working and I dont know why

robust hollow
#

sure it isnt (_this#0)?

wispy pond
#

im not sure im fairly new to the whole scripting thing but ill give it a try and see what works

#

doesnt seem to be working either

robust hollow
#

have you put the init line in the right config class?

robust hollow
#

no i dont think thats right

#

needs to be in

class Eventhandlers {
    init = "...";
};```
wispy pond
#

ah so basically needs it own section like cfg vehicles?

#

or am i still backwards

robust hollow
#

no, you put that class in the 102_SdKfz251 class

sacred slate
#

this code works, but the later one not, but its identical for me.


{

   if (side group BLUFORHC == west) then {
  
   _x addEventHandler ["Killed",
        {
            _count = 1;
            dreResourcesW = dreResourcesW - _count;            
            hint str dreResourcesW;
        }];
   };
   
} foreach allunits;

the not working code:



{

   if (side group REDFORHC == east) then {
  
   _x addEventHandler ["Killed",
        {
            _count = 1;
            dreResourcesW = dreResourcesW + _count;            
            hint str dreResourcesW;
        }];
   };
   
} foreach allunits;

robust hollow
sacred slate
#

bluforhc is a west soldier, redforhc is a east soldier.

robust hollow
cosmic lichen
#

also use units <side> instead of allUnits

sacred slate
#

oh boy

#

thx

#

well i just like a count where i get +1 for resi/east kills and -1 for west kills

sacred slate
#

well seems like that code won't take respawned units into account:


{

   if (side group REDFORHC == east) then {
  
   _x addEventHandler ["Killed",
        {
            _count = 1;
            dreResourcesW = dreResourcesW + _count;            
            hint str dreResourcesW;
        }];
   };
   
} foreach units east;
#

i don't understand "EntityKilled" that well. here i have a code, but i can't flag it to sides:


addMissionEventHandler ["EntityKilled",
{
    params ["_killed", "_killer", "_instigator"];
    if (isNull _instigator) then {_instigator = UAVControl vehicle _killer select 0}; // UAV/UGV player operated road kill
    if (isNull _instigator) then {_instigator = _killer}; // player driven vehicle road kill    
    _count = 1;
    dreResourcesW = dreResourcesW + _count;            
    hint str dreResourcesW;    
}];

cosmic lichen
#

side _killed

#

gives you the side

robust hollow
#
addMissionEventHandler ["EntityKilled",
{
    params ["_killed"];
    _count = [-1,1] select (side _killed isequalto east);
    dreResourcesW = dreResourcesW + _count;            
    hint str dreResourcesW;    
}];

🤷

#

you would probably want to take into account the side of the killer too though? maybe.

sacred slate
#

cool thx!

warm swallow
#

Does anyone know how to attach an animation to an addAction script on an object? I am trying to have a person in multiplayer be able to repair something. I have this addAction ["Repair Generator", "addSurvivorScore.sqf"]; but I need to use this code? from a different sqf file? sleep 20; p1 switchMove "Acts_carFixingWheel";.If anyone could give me some guidance that would be great I'm lost at the moment. Thank

warm hedge
#

You're wondering that if there's a way not to use an .sqf file to run that code, right?

warm swallow
#

Im not sure to be frank. I know I need to have an addAction that makes the player switch into an animation, but as far as accomplishing that, I'm confused. My friend earlier helped me setup another script for counting up every time the addAction on the generator is placed. Can you call two in one command line for addAction?

warm hedge
#

Uhh uhh? Can you explain what exactly is your issue and the goal?

little raptor
#

not in MP tho

warm swallow
#

I'm trying to get into scripting atm lol, beginner project. Basically dead by daylight is basic premise. Survivor goes around and turns on generators right. I want the player to be able to walk up to the generator and 1) have an option to enter a animation for repair (20 seconds) and when that is done 2) to add to a counter for all the generators. Once the count is met, the survivors win

#

the anim im using is 20 seconds which is more than enough

deft dock
#

can anyone give me directions where to find the definition / function / whatever to incomingMissileDetectionSystem?
please ping me if one has an idea

little raptor
little raptor
warm swallow
deft dock
#

@little raptor
thx, but i look for the vanilla stuff

little raptor
#

Yeah vanilla meowsweats

warm swallow
#

what does multi require?

little raptor
deft dock
#

@warm hedge
thanks, i know about that. i need to find out how that is build and rewrite it to something else

#

@little raptor
much appreciated

little raptor
warm swallow
#

Does that mean I have to use ExecVM?

#

wait ohhhhhhhhh so it would not be good I see

#

im calling the animation in a seperate sqf

little raptor
#

it wouldn't be good because you get duplicate add actions

warm swallow
#

@little raptor can I call 2 animations from 1 addAction

little raptor
#

Yes

warm swallow
#

How?

little raptor
#

What's your code?

warm swallow
#

this addAction ["Repair Generator", "addSurvivorScore.sqf", "repair.sqf"];

#

Sooorrry

little raptor
#

I mean what is the contents of those files meowsweats

warm swallow
#

ok

#

addSurvivorscore.sqf: scoreSurvivor = (scoreSurvivor + 1); hintSilent str scoreSurvivor; if (scoreSurvivor >= 5) then {survivorsWin = true;};

#

repair.sqf sleep 20; p1 switchMove "Acts_carFixingWheel";

#

i need to change sleep value lol

warm hedge
#

Why you put sleep first and switchMove last?

warm swallow
#

I dont know

#

should it be the other way? I want the animation to play and the player is like locked but can exit the anim

little raptor
#

Anyway, there's nothing special going on. Just append the two codes into a single file

little raptor
warm swallow
#

ok

#

how do i combine the 2 codes??? Aren't they 2 different processes

little raptor
#

Why wait 20 seconds before playing the anim

warm swallow
#

thats a bad idea, youre right

little raptor
#

They're not even related

warm swallow
#

im sorry how do i combine them?

little raptor
#

Copy paste meowsweats

warm hedge
#

Just like you combine several commands in a sqf file

warm swallow
#

ok

#

im sorry my brain is so bad at processing information so I have to keep everything segmented. Should I be combining the SurvivorScore.sqf and the Repair? So the addaction adds 1 to the score AND plays the anim?

warm hedge
#

Yes

warm swallow
#

Ahhhhh

#

1 more question. In multiplayer, is there any other var i can use for the player other than p1? because don't in that case i have to make different copies of the code for each player? p2, p3 etc

warm hedge
#

player is the command to return player unit on their computer

warm swallow
#

i dont understand?

#

so i shouldnt use it?

warm hedge
#

Wha...?

#

Am I not understanding what you're saying?

warm swallow
#

so should I replace the p1 with player or no?

#

scoreSurvivor = (scoreSurvivor + 1); hintSilent str scoreSurvivor; if (scoreSurvivor >= 5) then {survivorsWin = true;}; player switchMove "Acts_carFixingWheel"; sleep 15;

#

thats what I have now

warm hedge
#

Prolly works

warm swallow
#

gotcha

#

ill test now

#

@warm hedge thank you for all you’ve done for me and the community.

#

hmmm it goes into the animation for a second and then quits?

warm hedge
#

Try not to move your mouse and your player unit

#

Basically some animations aren't intended to be used by player, might not work properly

warm swallow
#

alright. Im not moving anything and he quits. Can I somehow lock the player out of controls during the duration of the animation.

#

and force the animation to play?

opal sand
#
private target1 = myAmmoBox;
private charge1 = "DemoCharge_Remote_Ammo_Scripted"; createVehicle position player;  
charge1 attachTo [target1, [0, 0, 0.2]];  
charge1 setVectorDirAndUp [[0.5,0.5,0], [-0.5,0.5,0]]; 
detach charge1;
charge1 setDamage 1;
hint "good!";

Error missing ;
Wut can anyone help please
(messing around with attachto to learn)

warm hedge
#

"DemoCharge_Remote_Ammo_Scripted"; createVehicle position player; More like unnecessary ;

opal sand
warm hedge
#

Should be

#

; is to interrupt the code there

opal sand
# warm hedge `;` is to interrupt the code there
private target1 = myAmmoBox; 
private charge1 = "DemoCharge_Remote_Ammo_Scripted" createVehicle position player;   
charge1 attachTo [target1, [0, 0, 0.2]];   
charge1 setVectorDirAndUp [[0.5,0.5,0], [-0.5,0.5,0]];  
detach charge1; 
charge1 setDamage 1; 

still got the 'error missing ;' 😕 , can u see the issue at all please?

warm hedge
#

Suspect that target1 and charge1, they can't be a global variable if you wanted to use private, so try to put _

wary lichen
#

it is possible hide player model from server?

warm hedge
#

What do you mean by from server?

wary lichen
#

I want hide player model on my dedicated server, for spectating others

#

it is possible?

opal sand
# warm hedge Suspect that `target1` and `charge1`, they can't be a global variable if you wan...

now it backtracks to the initial error , 'local variable in global space'
(original code source: https://community.bistudio.com/wiki/attachTo - Pixinger)
(code below extracted from https://community.bistudio.com/wiki/attachTo)

private _target = myAmmoBox;
// create and attach charge
private _charge = "DemoCharge_Remote_Ammo_Scripted" createVehicle position player; 
_charge attachTo [_target, [0, 0, 0.2]]; 
_charge setVectorDirAndUp [[0.5,0.5,0], [-0.5,0.5,0]];
// now detonate charge
detach _charge; // Important!
_charge setDamage 1;
hint "good!";
wary lichen
#

I found it a second before you

#

re-read hideObject doc

warm swallow
#

this addAaction ["Stop", {if (player getVariable 'anim' != '') then { [player, ''] remoteExecCall ["switchMove", -2, true]; player removeAllEventHandlers "AnimDone"; player setVariable ["anim", ""]}, "", 21, false, true, "", "_target==_this && _this getVariable 'anim' != ''"];
do you guys see an error with this? Arma says im missing a semi colon before Addaction??

warm hedge
warm swallow
#

nevermind

warm hedge
#

How did you run it, fur?

warm swallow
#

@warm hedge now Im getting a blank error Init:

warm hedge
#

?

warm swallow
#

on the code I used ^ up there. I got it off the internet

warm hedge
#

addAaction -> addAction, missing }

warm swallow
#

Bruhhhh. Type code expected if??

winter rose
warm swallow
#

what does over indent mean sir

#

@winter rose

#

i did that

#

i didnt see anything amiss

#

im going too bed gn

opal sand
warm hedge
#

Yeah

cyan dust
#

Why is it not working? 🤔

    _GUI_ListFrom ctrlAddEventHandler ["MouseEnter",
    {
        systemChat "HERE!!!";
    }];
winter rose
#

it's because…

cyan dust
halcyon crypt
#

so, once again, I'm trying to fix the line numbers being reported on a script error in ALiVE but I can't get it fixed.. Moved the #include "script_component.hpp" to the top of the file but it's not doing anything else :/

#

anyone got any clues? 🙁

#

when I preprocessFileLineNumbers the script there's a ton of white space from all the CBA includes and what not

opal sand
warm hedge
#

Now that makes sense... You can't use local (aka _) variable in such places

cosmic lichen
#

I am looking for a way to convert shortcuts[] = {"512 + 0x2E"};
To a string which actually shows the shortcut e.g ALT + X Has anyone ever seen such a function? I don't wanna reinvent the wheel 😄

quasi sedge
#
[missionNamespace, "arsenalClosed", {
    player setVariable ["Saved_Loadout",getUnitLoadout player];
    hint "Selected gear saved!"
    }] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn",{

        0 = [_this select 0] spawn {
        
            params [["_player",objNull,[objNull]]];
                waitUntil {sleep .2; alive _player};
                _player setUnitLoadout (_player getVariable ["Saved_Loadout",[]]);
                
        };
}];
#

if i change "missionNamespace" to "profileNamespace" that means that everytime player join server with this mission, he gets his already saved loadout?

cosmic lichen
#

Doesn't sound right to save that in profileNamespace 😄

#

player setVariable ["Saved_Loadout",getUnitLoadout player];
You can save it to profileNamespace here instead to the player's namespace

quasi sedge
#

@cosmic lichen sqf profileNamespace setVariable ["Saved_Loadout",getUnitLoadout player];
smth like that?

cosmic lichen
#

yes

quasi sedge
#
_player setUnitLoadout (_player getVariable ["Saved_Loadout",[]]);
to 
profileNamespace  setUnitLoadout (profileNamespace  getVariable ["Saved_Loadout",[]]);

? @cosmic lichen

cosmic lichen
#

Yes

verbal saddle
torpid quartz
#
in the init.sqf
publicVariable "PART1"; 
PART1=False;

On the object:
[VRTable, "Turn on table",
  "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
  "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
  "_this distance _target < 3 && !PART1", //Lazy solution to hide the Hold Action on all machines after it has been completed once
  "_caller distance _target < 3 && !PART1",
  {}, {},
  {
    PART1=true;
  },
 {}, [], 3, 0
] remoteExec ["BIS_fnc_holdActionAdd", 0, VRTable];

Uh so I was working through this with ansin11 yesterday. Just trying to get it to work for a player connected to a locally hosted server and it actually change a variable on the server (so it effects all players connected).

this worked fine on both lan and internet when i'm playing by myself. but I just had someone else connect to test it and then I couldn't see the actions. they could though but completing it did nothing. (executing PART1=True on the server though did do what was supposed to happen though)

[this, ["Activate Marker", { PART3=True; }]] remoteExec ["addAction"]

this also didn't work, but showed up for both of us (twice for some reason)

verbal saddle
#

You need to publicVariable after you've made the changes to the variable.

torpid quartz
#

so

in the init.sqf
publicVariable "PART1"; 
PART1=False;

On the object:
[VRTable, "Turn on table",
  "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
  "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
  "_this distance _target < 3 && !PART1", //Lazy solution to hide the Hold Action on all machines after it has been completed once
  "_caller distance _target < 3 && !PART1",
  {}, {},
  {
    PART1=true;
publicVariable "PART1";
  },
 {}, [], 3, 0
] remoteExec ["BIS_fnc_holdActionAdd", 0, VRTable];

uh like this?

quasi sedge
#
[missionNamespace, "arsenalClosed", {
    profileNamespace setVariable ["Saved_Loadout",getUnitLoadout player];
    hint "Selected gear saved!"
    }] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn",{

        0 = [_this select 0] spawn {
        
            params [["_player",objNull,[objNull]]];
                waitUntil {sleep .2; alive _player};
                _player setUnitLoadout (profileNamespace getVariable ["Saved_Loadout",[]]);
                
        };
}];

if i respawn it works just fine, ammo replenished. But if i reload mission, game doesnt give me my saved gear

verbal saddle
torpid quartz
#

getting someone to test with me now

verbal saddle
#

You'll want to test which event handlers don't exist after loading the mission, then setup a way to re-add them once the mission is loaded.

torpid quartz
#

in singleplayer it works fine

verbal saddle
#

Your probably running into an issue where when a player joins, it runs all the code again for them, which means it adds the actions again and publicvariables everything again.

torpid quartz
#

yeah i'd say it was a probably to do with the amount of players on the server

#

we all joined before the mission started, no join in progress

#

which kind of sucks because I am completely out of ideas lol

copper raven
#

why the remote exec in object's init?

#
publicVariable "PART1";
PART1=False;

? broadcasting and then setting? why?

torpid quartz
#

true i guess i could put it somewhere else, wasn't sure that would do anything though.
and I just wanted to make sure it's false

copper raven
#

object's init already runs for every client

#

no need to remoteexec

winter rose
torpid quartz
#

so putting the code in the init.sqf might fix this?

opal sand
#
[] spawn { 
  sleep 15;  
kh1s1 switchmove 'Acts_Executioner_Backhand';
};
hint "good!";

what is wrong with this code? apparently, (ERROR: on activation, type script, expected nothing) (or do i need to go back to arma 3 profiling?)

copper raven
#

no, that's just a thing that doesn't make sense, you remote exec on every client for every client, it's useless(just dont remoteexec there). anyway, if thats all you got in your init.sqf, the two lines, rename it to initServer.sqf, you don't want that code running on clients

#

@torpid quartz

#

oh and public variable after you set the variable(not the other way around)

copper raven
torpid quartz
#

so wait, remove the remote exec part?

copper raven
#

yes

#

assuming you run the code in object's init

torpid quartz
#

how will it change the bool's state on the server then?

copper raven
#

you pvar again when you complete the action

#

like you're currently doing

torpid quartz
#

oooooh, right. I'll give that a go once i can get some people to test it again, thanks so much for the help

warm swallow
#

good morning!

finite sail
#

good afternoon

warm swallow
#

@warm hedge is your mod Virtual Reality replace compatibole with multiplayeR?

cosmic lichen
clever radish
#

Whenever i start an Arma3 mission and open to LAN my friend can join, but if we fail the mission or restart, he keeps disconnecting. Chat says he connects then disconnects. On his screen, he just disconnects.. What can cause this? Nothing really helps on Google

granite zealot
#

Anyone got a creative way to run switchWeapon without any animation or skipping the animation?

cyan dust
#

Good day, is there a way to get all numbers from a string?

proven charm
#

parseNumber maybe

winter rose
cyan dust
final storm
#

How would one get the classname of a dynamic sound?

typeOf (allMissionObjects "#dynamicsound" select 0)

only returns "#dynamicsound"

smoky verge
#

I was using
(get3DENSelected "object" # 0) setObjectScale 2;
to see previews of my scaled objects in eden, but it only works on one object each
is there a way to use it in mass?

winter rose
#
{ _x setObjectScale 2 } forEach (get3DENSelected "object")```
smoky verge
#

oh I guess that exists
I'm not used to using the console in eden so not sure what works and what doesn't

#

thanks

final storm
#

Thanks

little raptor
#

all key codes are less than 256. so the modifier is the number > 256

#

I think it was 512 (ctrl), 1024 (shift) and 2048 (alt) meowsweats

#

so you can read the modifier flags using 2^11, 2^10 and 2^9

#

what remains is the key

#

also that list of dik codes only goes up to 237

#

hashmap variant: (use with createhashmapfromarray)

wind hedge
#

I am unable to change the size of the USS Liberty (Aircraft Carrier) even when turning it into a simple object

#
[ac1] spawn {  
 params [ 
  ["_object", objNull, [objNull]] 
 ]; 
 _position = getPosWorld _object; 
 _vectorDirUp = [vectorDir _object, vectorUp _object]; 
 _model = getModelInfo _object select 1; 
 deleteVehicle _object; 
 _simpleObject = createSimpleObject [_model, _position]; 
 _simpleObject setVectorDirAndUp _vectorDirUp; _simpleObject setObjectScale 0.2; 
}; ```
#

The name of the aircraft carrier is ac1

little raptor
supple cove
#

hey, how do you detect if the player is already done loading and ready to play.. been trying to make mission intros but couldn't find a reliable way to detect this

little raptor
supple cove
#

yea, 'all of them', for some reason my arma has 2 loading screens so idk if this is even normal

little raptor
#

it's normal

#

idk. maybe a loop?

supple cove
#

i do have a waitUntil to detect when the briefing is read

little raptor
#

maybe something like this?

waitUntil {isNull findDisplay 102}
supple cove
#

I'll have to try, don't even know what this does 😆

#

yea well just tested and the loop will end after the briefing is read

#

so the intro stuff will play while the graphics and stuff is loading after the briefing

little raptor
supple cove
#

no, because after the briefing is read, theres another loading screen wich depends on the size of the mission, i guess. I've been trying to find a way to play stuff after this, when the player is actually playing.

#

my current way of doing this is, after the briefing i wait around 10 seconds or so, wich is bad because the loading screen takes an arbitrary amount of time

little raptor
finite sail
#

its so tough to do

#

thr finddisplay isnt good enough

#

theres isbriefingread or similar that is better

#

cant remember the exact command

#

waitUntil {!isNull player};

#

is what I do, but even that isn't quite good enough

#

the power of the player PC has an effect here

#

do you want them to read the briefing? I turn it off

supple cove
#

i got a okish effect with
waitUntil { getClientState == "BRIEFING READ"}; sleep 5; waitUntil {isNull findDisplay 102};
I'm really not sure if it will be consistent

finite sail
#

thats the one, yes

#

my players are teleported to a custom start location

#

so its important they dont get visual until after that happens

#

but even then, a player with a fast PC often sees their original spawn and then teleports to my planned start pos

supple cove
#

yup, well, I got a somewhat good effect by fading the screen to black as the first thing on the init

finite sail
#

yes, another good move

supple cove
#

but i think ACE bugs that

finite sail
#

keep the screen black... ah, i dont use ace

supple cove
#

i dunno if its ACE, but here the fade functions are like a blink, some mod affecting it 😆

finite sail
#

I make the screen black, play an intro movie, black the screen again, dont show briefing, remove their map so they dont see that and then black the screen again with some text. "mission is loading, please wait"

#

its MUCH worse on the first run of the mission, when players JIP after (its persistent battlefield) it's less of an issue

supple cove
#

eh, i guess there's not much we can do

finite sail
#

not really.. theres a couple of good threads on forums, but no definitive answer

#

ask again tomorow lol

supple cove
#

👍 well, ty for explaining why its hard tho

finite sail
#

NP mate, if you make it work reliably across players with differing PC's I'll beer you if you tell me

#

🙂

true frigate
#

Hey there! simple question, when creating a vehicle, how do you set their speedmode and behaviour?

#

also, is there a way to spawn a unit x meters from the ground?

#
_disN = h1 getRelPos [400,0];
_disE = h1 getRelPos [200,90];
_disS = h1 getRelPos [600,180];
_disSW = h1 getRelPos [2000,225];
BRDM1 = "UK3CB_TKA_O_BRDM2" createVehicle _disN;
createVehicleCrew BRDM1;
BRDM1 doMove (getPosATL h1);
BRDM1 limitSpeed 60;

HIND1 = "UK3CB_CW_SOV_O_LATE_Mi_24V" createVehicle _disSW;
createVehicleCrew HIND1;
HIND1 doMove (getPosATL h1);```
#

this is what i have at the minute, but the hind often spawns underwater, and the BRDM only follows roads due to its behaviour mode

finite sail
#

use the other syntax of createvehicle when making the helicopter

#

hind1 = createvehicle ["UK3CB_CW_SOV_O_LATE_Mi_24V", _disSW,[],0,"FLY"]

#

I think brdm1 setbehaviour "SAFE" will make him go cross country.. not sure

true frigate
#

I thought it was Combat

#

Safe means driving on road

#

but i will use the other syntax, thank you

digital vine
#

Evening all!

Trying to get a Scroll Wheel Loadout Selection system to work (very early stages atm)

For background, I'm very inexperienced with scripting.

Using the Script below I can get one action i.e. Remove Headgear to work, but not a string of commands. How would one do this?


this addAction 
[ 
 "Give Rifleman Loadout",  
 { 
  params [Bill, Player, 1, {"RemoveAllPrimaryweaponItems player", "RemoveHeadgear Player"}];  
 }, 
 nil, 
 1.5, 
 true, 
 true, 
"",   
 "true",  
 50,   
 false, 
 "",    
 ""    
];

true frigate
#
h1 allowDamage true;
_dis = h1 getRelPos [400,0];
_disE = h1 getRelPos [200,90];
_disS = h1 getRelPos [600,180];
_disSW = h1 getRelPos [2000,225];
BRDM1 = "UK3CB_TKA_O_BRDM2" createVehicle _dis;
createVehicleCrew BRDM1;
BRDM1 doMove (getPosATL h1);
BRDM1 limitSpeed 60;
BRDM1 setbehaviour "COMBAT";

hind1 = createvehicle ["UK3CB_CW_SOV_O_LATE_Mi_24V", _disSW,[],0,"FLY"]
createVehicleCrew HIND1;
HIND1 doMove (getPosATL h1);

_group1 = createGroup [EAST, true];
    _group1 createUnit ["UK3CB_TKM_O_RIF_1", _disE, [], 25, "NONE"];
    _group1 createUnit ["UK3CB_TKM_O_RIF_1", _disE, [], 25, "NONE"];
    _group1 createUnit ["UK3CB_TKM_O_RIF_1", _disE, [], 25, "NONE"];
    _group1 createUnit ["UK3CB_TKM_O_RIF_1", _disE, [], 25, "NONE"];
    _group1 createUnit ["UK3CB_TKM_O_RIF_1", _disE, [], 25, "NONE"];
    _group1 createUnit ["UK3CB_TKM_O_RIF_1", _disE, [], 25, "NONE"];
    _group1 setFormation "LINE";
    _group1 setSpeedMode "FULL";
    _group1 setBehaviourStrong "COMBAT";
    _wp1grp1 = _group1 addWaypoint [(getPosATL h1),0];
    _wp1grp1 setWaypointType "MOVE";
    
_group2 = createGroup [EAST, true];
    _group2 createUnit ["UK3CB_TKM_O_RIF_1", _disS, [], 25, "NONE"];
    _group2 createUnit ["UK3CB_TKM_O_RIF_1", _disS, [], 25, "NONE"];
    _group2 createUnit ["UK3CB_TKM_O_RIF_1", _disS, [], 25, "NONE"];
    _group2 createUnit ["UK3CB_TKM_O_RIF_1", _disS, [], 25, "NONE"];
    _group2 createUnit ["UK3CB_TKM_O_RIF_1", _disS, [], 25, "NONE"];
    _group2 createUnit ["UK3CB_TKM_O_RIF_1", _disS, [], 25, "NONE"];
    _group2 setFormation "LINE";
    _group2 setSpeedMode "FULL";
    _group2 setBehaviourStrong "COMBAT";
    _wp2grp2 = _group2 addWaypoint [(getPosATL h1),0];
    _wp2grp2 setWaypointType "MOVE";
    ```
added some more reinforcements
robust hollow
spark turret
#

Parse this select 0 into 1? DUH

digital vine
# robust hollow what is `params [Bill, Player, 1, {"RemoveAllPrimaryweaponItems player", "Remove...

I want to start by removing pretty much everything from the player on command, and then replacing uniform/weapon/etc with a chosen loadout from scroll wheel selection.

The passage selected is to remove all attachments from main Weapon and then Remove all headgear. Was trying to get a multiple to work before I go in-depth

As I said, I'm really new to scripting so any pointers would be extremely helpful 🙂

true frigate
#

can i ask, is it something that you specifically want or are you able to use the virtual arsenal? I know its not what youre asking for, but im just making sure you know there is an easier way of choosing a loadout 😄

robust hollow
#

mmmkay. and what were you trying to do with [Bill, Player, 1... specifically?

digital vine
digital vine
robust hollow
#

i see. replace

{ 
  params [Bill, Player, 1, {"RemoveAllPrimaryweaponItems player", "RemoveHeadgear Player"}];  
 }

with

{
    params ["_target","_caller","_actionID"];
    removeAllPrimaryweaponItems _caller;
    removeHeadgear _caller;
}

and that should make what you have so far work as intended

digital vine
#

Do we not have to specify the to's and who's? Genuine Question

digital vine
true frigate
#

Can someone explain the difference between setBehaviour and setBehaviourStrong?

hallow mortar
#

behaviour sets the behaviour mode for each unit. strong does that, plus it also sets the behaviour mode for the group

true frigate
#

Alright, thank you

cosmic lichen
true frigate
#
createVehicleCrew HIND1;
HIND1 doMove (getPosATL h1);```
Why is this not working? it was until 5 minutes ago
#

I havent changed anything in that part, but now its not spawning

#

Ah

#

ignore me

#

its because the variable name isnt capitalised...

#

so the vehicle is spawned. the crew isnt 😄

#

god i can be an idiot sometimes

winter rose
#

…variables are case-insensitive?

true frigate
#

It may not be a variable then

#

i dont know what its called 😦

#

i just guessed

#

but the script works soooo 😂

winter rose
#

it is a variable

#

but you could name it hind1, Hind1, HIND1 or hInD1, it should work

true frigate
#

hmm

#

thats odd

#

because it works after i changed it thonk

#

aand its stopped working again

#

what the hell

winter rose
#

use BIS_fnc_spawnVehicle

true frigate
#

Ill try that

winter rose
#

…it hopefully works with flying vehicles

true frigate
#

the helis in arma are decent at working out that they need to take off to move

#

Yep, works, but spawns on the ground

dense hound
#

Hello All. Came here hoping to get some help. Starting a server using the RHS warlords missions with a few extra mods. Everything is working great but for some reason the VA is not showing up on the asset buy menu. how do i fix this? someone said the VA script might not be running?

true frigate
#

I just gotta hope when my units pilot actually flies this, it wont spawn in the ground 😄

solar chasm
#

Looking for the command to get a relative position between 2 given objects. In my dream world, it would be a relative [x,y,z] in meters - so if Obj 1 was five meters South of Object 2, it would return [0,-5,0].

I'd like to use it for two things:
1> replace an existing script that does brute-force animation/movement (i.e. "obj1 attachTo obj2 [0,0,0]; sleep 0.03; obj1 attacTo obj2 [0,-0.5,0], sleep 0.03...." etc, etc) with a simplified loop.
2> have the script check for a threshold and stop the loop once obj1 has reached a certain distance (8m?) from obj2 ... or [0,-8,0], relative, if the intent is direct South.

I was looking at GetRelPos in the wiki, but that doesn't seem to do quite what I'm hoping, unless I'm misreading.

Does my hoped for command exist, or will I need to do a work around with getPos on both objects and having them subtract from each other?
And if I need to do a work around, is there a way to feed that back into an 'attachTo'?

robust hollow
#

im no expert, but something like this might be what you want getpos a vectordiff getpos b

solar chasm
#

Hmmm. Thanks, I'll look into vectordiff - not familiar with it!

#

And then, if VectorDiff is returning in [x,y,z], if could obj1 attachTo obj2 [((getPos obj1) VectorDiff (getPos obj2)) select 0, (((getPos obj1) VectorDiff (getPos obj2)) select 1)-0.5,((getPos obj1) VectorDiff (getPos obj2)) select 2] to move it straight south, yes? (or simplify 'obj1 VectorDiff obj2' into a variable to check on iteration?)

robust hollow
#

getPos obj1 vectorDiff getPos obj2 vectorAdd [0,-0.5,0] to do it only using vectorDiff once but yea sounds right to me

solar chasm
#

Thanks!

solar chasm
#

Sorry for the additional questions - I'm learning new things and definitely stretching my minimal knowledge ("just enough to get in trouble").
I'm putting all the above into a function so it can be addressed flexibly in the script, and eliminate several hundred duplicated lines on repeat items.

I am defining three parameters with private variables - "_VicName", "_VicVel", "_IRPlace"... The lest two are x,y,z Arrays. Can private variables as parameters hold Arrays, or do I need to somehow define the variable type?
If so, I assume I'd call it as nested arrays on the function, so something like:
["VIC1",[0,-20,0],[0,-0.2,1.1]] call PABLO_fnc_EjectVic (or ExecVM spawn, as appropriate)

robust hollow
#

im not entirely sure what you're asking, but yes you can use arrays as arguments like any other data type

solar chasm
#

Yeah - maybe worrying over nothing. Reading the 'Functions' page, I was just unclear whether the param using a generic private variable could take an array, or if I needed to define it as a data type, which would require a bit more head scratching on my part.
Thanks for your help and speedy replies, @robust hollow !

solar chasm
#

Aaaaannnndddd... Getting an error on my waitUntil: "undefined behavior: waitUntil returned nil. True or False expected."
Not sure why, as I feel like _VicDistance should give an integer that can be compared w/ 7.99 easily?
the 'attachTo' loop doesn't seem to work, but maybe it's progressing ahead and throwing an error before it executes the movement?

params [["_VicVel","[0,-15,0]",[],3], ["_IRPlace","[0,0,1]",[],3]];
_VicPlace = [VIC1 modelToWorldWorld [0,0,0]];
_PlanePlace = [plane01 modelToWorldWorld [0,0,0]];
_VicDistance = ((_PlanePlace select 1) - (_VicPlace select 1));
hint str _VicDistance;

for "_n" from _VicDistance to 8 step 0.5 do
{
_VicName attachTo [plane01, [(_VicPlace select 0), ((_VicPlace select 1)-0.5), (_VicPlace select 2)]];
sleep 0.03;
hint str _VicDistance;
};

waitUntil {(_VicDistance) > 7.99};
....etc...
};```

(Side note, tried making the "for/from/to/step" a "while/do/else" loop, and that was also throwing errors...)
robust hollow
#

you never update _VicDistance after you set it?

solar chasm
#

Ah. Nope. I could see how that could be a problem.
I should.... Insert it at the front of the loop?

#

I guess none of those update.

#

Hrm.

robust hollow
#

there is a few things wrong in your snippet. wait 1 ill fix

#

what is _VicName?

solar chasm
#

Ah. _VicName is a variable between the two slots the vics can spawn in. I had it defined in the function as a param at first.

#

Ah, I spotted another error, that would have bit me later. VIC1 is the same as _VicName at this point.

#

(That's what I get for 4am amateur coding, I should probably sleep and look with fresh eyes tomorrow...)

robust hollow
#

yea you probably should. im going to explain all the issues instead so you can fix it yourself later

solar chasm
#

Thanks - honestly, that's better than fixing it. As I said, I'm trying to learn, albeit clumsily.

robust hollow
#

ended up doing both because the issue may not make sense on their own

#

These parameters are positions but you set their default value as strings and you don't provide any accepted data types (though I think you intended for it to accept arrays only)

params [["_VicVel","[0,-15,0]",[],3], ["_IRPlace","[0,0,1]",[],3]];
// vs
params [["_VicVel",[0,-15,0],[[]],3], ["_IRPlace",[0,0,1],[[]],3]];

You try to subtract the Y value from both position arrays but you have put the modelToWorldWorld command in an array, so it would return [[0,0,0]], not having a select 1. I'm also not sure you need to use modelToWorldWorld at all but i'll leave it.

_VicPlace = [VIC1 modelToWorldWorld [0,0,0]];
_PlanePlace = [plane01 modelToWorldWorld [0,0,0]];
// vs
_VicPlace = VIC1 modelToWorldWorld [0,0,0];
_PlanePlace = plane01 modelToWorldWorld [0,0,0];

You are attaching _VicName to plane01 using _VicName's position as the offset, which is wrong. You should be using some method to get _VicName's offset relative to plane01 (maybe vectorDiff as mentioned earlier) otherwise the object could end up attached thousands of meters away. You also don't update the offset in the for loop after reattaching so _VicName will only ever be (_VicPlace select 1)-0.5 behind plane01.

The waituntil wont be necessary once you fix the above issues because the loop will set the offset to -8 before exiting.

#

so the function might work properly if it did something like this

PABLO_fnc_EjectVic1 = {
    params [["_VicVel",[0,-15,0],[[]],3], ["_IRPlace",[0,0,1],[[]],3]];
    
    private _offset = getPos plane01 vectorDiff getPos VIC1;
    while {(_offset#1) < 8} do {
        _offset set [1,_offset#1 - 0.5];
        VIC1 attachTo [plane01,_offset];
        sleep 0.03;
    };
    
    ....etc...
};
astral hamlet
#

how would a command look to change stance of a whole group in trigger?

cosmic lichen
#
units <unit> apply {_x setUnitPos "UP";};
astral hamlet
#

thanksalot

cosmic lichen
#

yourewelcome

hoary halo
#

Hey guys, looking for a way to teleport the player and his AI squad, but with the AI actually teleported a bit further from the player so they don't all clip into each other and cause a big freeze, help would be much appreciated, here iswhat my current script looks like
this addAction ["Fast travel to C.O.P Mike", {
params ["", "_caller"];
{
_x SetPos getMarkerPos "marker_cop1";
} forEach units _caller;
}];

robust hollow
strong thunder
#

hi all! sorry for noob question. im trying to force unit throw smoke grenade, if it has any.
skipTime 3; this forceWeaponFire ["SmokeShellMuzzle","SmokeShellMuzzle"]; [this, "SmokeShellMuzzle"] call BIS_fnc_fire; this fire "SmokeShellMuzzle"; this fireAtTarget [player,"SmokeShellMuzzle"];
nothing of above works if i put it in unit`s "Init" field in editor.

little raptor
#

you don't use the init field for something like that meowsweats

#

and let's say it worked

#

what'd you expect to happen?

#

just some smoke going in some random direction

strong thunder
#

thx for answer, Leopard! well, actually i've tryed that commands in script. but as it didnt work, i try to just get it work in editor.
i want to force unit throw any smoke grenade if it has some in its inventory. direction of throwing is the next task. 🙂 if it will just throw, i`ll be very happy already.

little raptor
#

your player unit should throw the smoke if he has some

strong thunder
#

yes, it works for player. should it work fo side unit?

little raptor
#

yes

#

but you shouldn't put it in the init field

strong thunder
# little raptor yes

thx! i'll try. btw, got your Adv DevTool! it looks very COOL! it encourages to try scripting even such noob like me. 🙂

winter rose
#

run, while you still can and SQF hasn't eaten your soul!

strong thunder
dusky pier
#

Hello, working with camera and stacked on problem.
My camera is placed above object,.

I needed to set dir of my camera to object direction, but something going wrong:

cameraObj = "camera" camCreate [0,0,0];
cameraObj camPreparePos _pos;
cameraObj camPrepareTarget targetObj;
cameraObj cameraEffect ["internal", "back"];
cameraObj camCommitPrepared 0; 

_objDir = (targetObj modelToWorld [0,-20,0]) vectorFromTo (targetObj modelToWorld [0,20,0]);

cameraObj  camSetDir _objDir;
cameraObj  camCommit 0; 

maybe i doing something wrong?

dusky pier
#

@winter rose little bit changed, but still - camera direction is not same to direction object (visual)

winter rose
#

what exactly do you want - the camera to be 20m behind the object, right?

dusky pier
#

no, i trying to get direction of model (vector) to set camera direction

winter rose
#

what is the end goal?

#

you are setting the cam's target @dusky pier, no need to camSetDir?

dusky pier
#

there is screenshot, i hope that will better show - what's going wrong 🙂

winter rose
#

(yum)

dusky pier
#

i don't change object direction, cuz is not local (another players can see changes when player doing something with object)

#

i understand - rotate camera is not best solution, but i need to save direction of object

winter rose
#

if you set the camera's target, you cannot camSetDir - the object will be targeted by the camera automatically

dusky pier
#

hm, understand

#

but if i will not set target?

winter rose
#

then you can do whatever you want?

#

but I still don't get what you want to do

do you want to have the camera above the thing?

dusky pier
#

i create display and manipulate this object (with animations etc)

winter rose
#
  • prepare target targ
  • prepare rel pos [0,0,10]
  • commit
  • ????
  • profit
dusky pier
#

when close display - camera getting destroyed

dusky pier
#

idk why, but camera still don't get direction of target :\

winter rose
#

why do you want it, I really don't get it

you want camera from above, here you go?

dusky pier
#

yep, camera above object

winter rose
#

then by doing

  • prepare target targ
  • prepare rel pos [0,0,10]
  • commit
    you have it?
dusky pier
#

yep, but visual - their directions is not same

winter rose
dusky pier
#

nah, is the same

winter rose
#

post simplest code plz?

dusky pier
#
_pos = getPosATL targetObj;
_pos set [2,1.8];

cameraObj = "camera" camCreate [0,0,0];
cameraObj camPreparePos _pos;
cameraObj camPrepareTarget targetObj;
cameraObj cameraEffect ["internal", "back"];
cameraObj camCommitPrepared 0; 

cameraObj camPrepareRelPos [0,-0.01,1.8];
cameraObj camCommitPrepared 0; 
winter rose
#

and what is the end result plz?

dusky pier
#

the object is located on a hill (small slope), probably problem in that

winter rose
#

aaah, yes

dusty whale
#

why was i half expecting atan2 to return radians instead of degrees

dusky pier
# winter rose aaah, yes

i find the way 😄
just added :

[targetObj,0,0] call BIS_fnc_setPitchBank;

before camera creation

and used camPrepareRelPos

winter rose
winter rose
winter rose
#

mind, if it is in on a big slope, the object will then partially go through it

dusky pier
#

ye, probably :\

i will make with attachto then

winter rose
#

or prevent players to place BBQs on slopes, it's dangerous anyway ^^

dusky pier
dusky pier
cyan dust
#

Good day. Why can this be not working?

_someButton ctrlSetTooltip "Click or use mouse wheel";
warm hedge
#

Might the control type doesn't support it?

cyan dust
#

It's a button, so it should be working according to biki

copper raven
#

can you do systemChat str [ctrlType _someButton]?

cyan dust
#

Checked documentation - yeah that's a correct value then

copper raven
#

🤔

cyan dust
#

Could it be related to enabling/disabling this thing over the script flow?

willow hound
#

What does ctrlTooltip _someButton give you?

#

After you used ctrlSetTooltip.

warm hedge
#

Make sure you're running the script, might sounds stupid but should double check it

royal gyro
#

Algun programador español para comentarle una cosilla??

winter rose
foggy hedge
willow hound
#

It doesn't.

#

date gives you 0 instead of 00.

foggy hedge
#

ah I was under the impression that it would display 00

For anyone reading this with the same problem: since my current mission has the starting time always be the top of the hour, I've successfully modified the code to be

str (date select 3) + ":00"]
tough abyss
willow hound
#

Groups are the thing to use, Teams were never finished as far as I'm aware.

dusty whale
#

with artillery units, there are the firemodes like Single1 with different charges and so on. How can i make the artillery select the specific firemode (charge) ?

true frigate
#

Hey guys, is there a way i can spawn an AA missile to fire at a helicopter but delete it before it hits?

#

I dont want the missile to actually do any damage to the heli, that will be handled by another script

sacred slate
#

can some one help me with formating this:


addMissionEventHandler ["EntityKilled",
{
    // params ["_unit", "_killer", "_instigator", "_useEffects"];
    params ["_killed","_killer"];
    _count = [20,1] select (side _killed isequalto resistance, side _killer isequalto west);
    dreResourcesW = dreResourcesW + _count;
    hint str dreResourcesW;
}];
winter rose
#

it's not formatting, it's scripting that is required here

#

select takes Code as a right-hand argument for what you want to do btw

true frigate
#
_disM = h1 getRelPos [1000,60]; 
_missile = createVehicle ["Missile_AGM_01_F",_disM,[],0,"FLY"];  
_missile setDir getDir player;  
_tgt = h1; 
[_missile,_tgt] spawn {  
 params ["_missile","_tgt"];  
 sleep 0.1;  
 _missile setMissileTarget _tgt;  
};  
``` h1 is a helicopter, this doesnt appear to be shooting at it, and i cant find why
winter rose
#

if the missile is not meant to lock on the target, it won't (don't know if that's the case here)

true frigate
#

I'm gonna keep editing values and see if i can even see the missile

#

at the moment all i hear is a small explosion

true frigate
#

However, i may be using the complete wrong function