#arma3_scripting

1 messages ยท Page 617 of 1

hallow mortar
#

(including values)

obtuse quiver
#

thanks to both of you guys, leopard i really like your mods, hyped for the super ai

#

don't worry ill find it myself no problem!

hallow mortar
#

just click on the link I just posted

obtuse quiver
#

didn't saw that thanks!

winter rose
#

0,0.5,0,1 - noice!

little raptor
#

@winter rose Why not simply use the eyedrop tool in photoshop or something?! ๐Ÿ˜…

winter rose
#

I wouldn't risk that with Arma :p

obtuse quiver
#

arma scares me

thorn cape
#

Why not: not using markers, and directly selectRandom vehicles?
@winter roseI have no idea how it will work.

But, I think I'll find easier way by using respawn module. How hide respawn module icon on map?

ripe sapphire
#

had to tweak position and size a bit, other than that its perfect

#

thanks a lot!

copper needle
#

Im trying to use ctrlRemoveEventHandler but I cant figure out how to get the ID portion of these syntax control ctrlRemoveEventHandler [handler name,id]

#

Any advice?

little raptor
#

You save the ID yourself

cunning crown
#

Id is an integer returned by ctrlAddEventHandler that you have to save yourself

copper needle
#
//Adds the EH
_zone = findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", 
{
    _this select 0 drawEllipse [
        [13472, 12003], 20, 20, 0, [1, 1, 1, 1], "#(rgb,8,8,3)color(255,0,0,0.4)"
    ];
}];

//Removes the EH
findDisplay 12 displayCtrl 51 ctrlRemoveEventHandler ["Draw", _zone]; 
#

So _zone would be the id?

cunning crown
#

Yes

ripe sapphire
#

leopard i just realized the vanilla uav info panel has a much better resolution compared to the live feed module :/

#

is it possible to resize that instead?

copper needle
#
_xzone = 20;
_yzone = 20;

//Adds the EH
_zone = findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", 
{
    _this select 0 drawEllipse [
        [13472, 12003], _xzone, _yzone, 0, [1, 1, 1, 1], "#(rgb,8,8,3)color(255,0,0,0.4)"
    ];
}];```
#

Im getting an error that says "Type Any, expected Number"

#

I think it is caused by me setting the x and y to variables but Im not sure how to fix this

cunning crown
#

Yes, an EH runs in it's "own" scope, so he doesn't know about variables defined outside of it. One possible solution for that is storing them in global variables

copper needle
#

That worked. Thanks!

little raptor
#

@ripe sapphire I don't know. I don't think so

radiant needle
#

Is there a way to make it so popup targets always stay up?

exotic flax
#

you can try this allowDamage false in the init of the popup target

radiant needle
#

still gets knocked down

#

even with simulation disabled it happens

#
this animate ["terc", 0];
this addEventHandler ["HitPart",
{_target spawn 
    {
        params ["_target"];
        Sleep 3;
        hint "Pop-Up";
        _target animate ["terc", 0];
    };
}];
#

tried this, but it doesn't seem to work

#

I don't get a hint and target doesnt pop back up

high marsh
#

prob because _target doesn't have a definition within the spawn scope.

radiant needle
#

okay, yeah I put it in brackets before the spawn to properly pass it as an argument, but I get undefined variable within the spawn itself now

warm hedge
#

Replace _target _this and use waitUntil to check if terc isn't 0

high marsh
#

[] array . _target is passed directly as the only argument

robust brook
#
private _popupTarget = cursorObject;

_popupTarget animate ["terc", 0];
_popupTarget addEventHandler ["HitPart", {

  [_popupTarget] spawn {
    params ["_popupTarget"];
    uiSleep 3;
    hint "Pop-Up";
    _popupTarget animate ["terc", 0];
  };

}];
``` @radiant needle see if this works at all
copper needle
#

A trigger activates whenever a player is detected within it. How do I find out which player activates it?

robust brook
copper needle
#

does thisList return the player that activates it or a list of all players that trigger it?

robust brook
#

I recommended creating a function that is spawned/called when the trigger is activated

#

defines an array of objects that have been detected by the trigger (same as what is returned by the list command)

radiant needle
#

undefined variable _popuptarget

#

after the hint

copper needle
#

Alright Ill give it a try. Thanks!

tough abyss
#
aa1 setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
aa2 setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
aa3 setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
aa4 setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
aa5 setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
aa6 setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
displayMain setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
uavCam1 = "camera" camCreate [0,0,0];
uavCam1 cameraEffect ["Internal", "Back", "uavrtt"];
uavCam1 attachTo [uavRecon1, [0,0,0], "laserstart"];

"uavrtt" setPiPEffect [3];

uavCam1 camSetFov 0.03;

addMissionEventHandler ["Draw3D", {
    _dir = 
        (uavRecon1 selectionPosition "laserstart") 
            vectorFromTo 
        (uavRecon1 selectionPosition "commanderview");
    uavCam1 setVectorDirAndUp [
        _dir, 
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
    ];  
}];
#

could it have to do something with my config?

#

I have PiP set to ultra

radiant needle
#

@warm hedge So this is me trying to use the waitUntil

this animate ["terc", 0];
this addEventHandler ["HitPart",
{[_target] spawn 
    {
        params ["_target"];
        waitUntil {_target animationPhase "terc" > 0};
        hint "Pop-Up";
        _target animate ["terc", 0, true];
    };
}];

^ is in the init of the target

However I'm getting this error

#

error undefined behavior waitUntil returned nil

warm hedge
#

I said replace _target _this

radiant needle
#

oh yeah I made a whoops

#
this animate ["terc", 0];
this addEventHandler ["HitPart",
{
(_this select 0) params ["_target"];
[_target] spawn 
    {
        params ["_target"];
        waitUntil {_target animationPhase "terc" > 0};
        hint "Pop-Up";
        _target animate ["terc", 0, true];
    };
}];

this works

#

I forgot

(_this select 0) params ["_target"];

before the 'spawn'

#

makes sense, was trying to pass an arg to the spawn that wasn't defined

copper needle
tough abyss
#

Afaik not with the trigger object itself

#

You'd have to use something else to denote that area

#

Unless I'm wrong

exotic flax
#

no, triggers are invisible.
Although you could place a marker so it will be visible on the map

#

and I believe there are some VR objects to create a "virtual wall" which you could place at the borders

copper needle
#

I have a marker on the map right now but I would prefer to also make it visible to the player

warm hedge
#

I made a ticket about visible trigger, and developers claims the suggestion. Let's see if this happens or not

tough abyss
#

Anyone got any idea for my question?

copper needle
#

Are there any objects that I can the size of?

radiant needle
#

mhmm next problem is trying to get what zone the player shot

#

apparently the zone targets, the selection hit is always just "target"

warm hedge
#

You can do that but requires a lot of script that wouldn't fit into Discord

copper needle
#

I want to make a script that creates an array with a list of players within a circular area on the map. Any advice?

tough abyss
#

Ok this is weird, when I switch my PiP setting to disabled, the screens lose the grainy stripes effect

#

nvm, its because the feed cuts out

#

could draw3d be the reason for this?

warm hedge
#

@copper needle inArea or thislist?

radiant needle
#

Anybody familiar with ACE know if it has a scripting command to holster the players current weapon?

radiant needle
#

Is there no way to have && with waitUntil?

exotic flax
#
waitUntil { (check1 && check2) };
jade abyss
#

The "last" entry in waitUntil must be a bool.
So stuff like is also possible:

_a = 1;
waitUntil
{
  _check = false;
  _a = _a + 1;
  if(_a >= 10)then{_test = true;};
  _check  //<-- no trailing ;
};
radiant needle
#

trying to figure out how to tell if player is facing more than 90ยฐ from a certain compass direction

jade abyss
#

getDir?

radiant needle
#

Basically a waitUntil the player faces more than 90ยฐ away (either left hand or right hand) from a set heading

#

I think getRelDir is what I'm looking for

jade abyss
#
_baseDir = _pos1 getRelDir _obj;
_pos = _baseDir + 90
_neg = _baseDir - 90

+you need to check if the baseDir is above 90ยฐ
Since the Dir only goes from 0-360ยฐ -> _neg could result in negative values. So check for that too.

radiant needle
#

Can I get all that in a waitUntil though?

jade abyss
#

sure, see the example i posted above

#

As long as the "last value" in the waitUntil check is a bool, it works

smoky verge
#

I'm trying to make a simple addaction with an addWeapon inside of it
how can I call only the player who activates the addaction so only he recieves the weapon?

jade abyss
#

by using player?

#

addActions are executed localy, iirc ๐Ÿค”

radiant needle
#

I believe addAction gives you params too

smoky verge
#

oh so Player would work in SP

jade abyss
#

Sure.

smoky verge
#

sorry meant MP

jade abyss
#

Also

smoky verge
#

thanks

jade abyss
#

(Effect: local)

radiant needle
#

this is surprisingly hard to calculate

smoky verge
#

most of the parameters are optional

radiant needle
#

I guess I can do abs(course-heading) up to 180 degrees difference

jade abyss
#

Why overcomplicate it? ๐Ÿ˜„

radiant needle
#

so abs(course-heading) % 180

#

that wouldn't work though. If my course was 30 and my heading 345, simple subtraction would give me an error of 315ยฐ. 315%180 would be 135

#

I think I just need to do
abs(Course-Heading)
360-(abs(Course-Heading))
and compare which one is smaller

jade abyss
#

or just simply ignore abs

radiant needle
#

I don't think it'd work if you didn't do the absolute

jade abyss
#

deduct curDir, check if it's negative, add 360 to it, done.

radiant needle
#

I think you'd need to do mod if you did it that way

jade abyss
#

Try around ๐Ÿ™‚

radiant needle
#

yeah looks like you still need the abs

#

If you course is 5, and heading is 20, that'd be negative so you add 360.

#

So I got this working

[] spawn {
_trueBermDir = (bermDir + 180) % 360;
While {true} do {
Sleep 0.25;
_dirRH = abs(_trueBermDir - (getDir player));
_dirLH = 360-abs(_trueBermDir - (getDir player));
Hint "Good";
If ((_dirRH > 90) && (_dirLH > 90) && (isNil (currentWeapon Player))) exitWith {Hint "STOP!"};
};
};
#

however for some reason it seems to ignore the last isNil

#

it'll exit regardless of if I have a weapon or not

jade abyss
#

isNil checks for a string

little raptor
#

isNil can check for both a string and code

#

if you want to check if a weapon is empty:
currentWeapon Player == ""

tough abyss
#

So I'm having this issue with a PIP UAV screen, all of these screens are grainy as shit except one http://prntscr.com/udyptr
Anyone got any ideas for my question earlier?

little raptor
#

Put a plain white (or grayish) texture on those screens, see if it's a problem with the screens

tough abyss
#

Think I did, textures display just fine on them

#

I'll do it again just for screenshot

little raptor
#

@tough abyss Actually, put an actual image on it to see the distortions too. You can try a flag:

(configfile >> "CfgFactionClasses" >> "CIV_IDAP_F" >> "flag") call BIS_fnc_GetCfgData
tough abyss
#

will try that

#

works perfectly fine

little raptor
#

It looks like some sort of effect (or bug?!)

#

The displays do not have any other textures right?

#

getObjectTextures

tough abyss
#

Nope, emptied in the editor

#

I'll try that too

#

how could I display the getObjectTextures?

#

afaik hint only works with strings not arrays

little raptor
#

hint str ...

tough abyss
#

ah ok

#

aspect ratio is .8 because I was fucking around with that

#

seeing if it does anything

#

I might just try this on another map and see if the bug repeats

little raptor
#

I was acually gonna ask about that! cuz you were using 1

tough abyss
#

no difference, i tired between 0.7 and 1.3

#

im just going to try this on another map, since im doing it on a modded one

#

see if that makes a difference

little raptor
#

ok

tough abyss
#

nope, altis is also fucky

little raptor
#

@tough abyss Why are you using a color correction for the pip?

#

Did you try without?

tough abyss
#

color correction, the
setPiPEffect
?

little raptor
#

yes

tough abyss
#

yep, I just put it in there to set it back to normal effects to see if it made a difference

little raptor
#

normal is [0] tho

tough abyss
#

put it there again just to be sure

#

nothing extra there

#

maybe that's why?

#

I'm not sure how that would make a difference seeing as they have their texture fields cleared in the editor anyways

#

I could try running this without any mods

little raptor
#

I don't think so. How about you tried:

{
  _x setObjectTexture [_forEachIndex, ""];
} forEach getObjectTextures otherDisplay;

Before using your code? (It probably hides them but you can try it if you want)

#

otherDisplay was your aaN monitors

tough abyss
#

what does that do exactly?

little raptor
#

Removes all textures

#

All hidden selection textures to be exact

tough abyss
#

ah ok so in otherDisplay i put the variable name of the monitor i want to clear?

little raptor
#

yes

#

like aa1

tough abyss
#

right, i'll try this without mods first and then test that out

#

no mods, same result

#

let me try that

little raptor
#

Are there no other monitors in the game you can use? Or even a laptop?

tough abyss
#

That's the screen I need as its big enough for a briefing

#

the other one that works only shows the top half of the camera

#

so its not good enough for a UAV locked camera

little raptor
#

@tough abyss Didn't you say this was the reason?

Ok this is weird, when I switch my PiP setting to disabled, the screens lose the grainy stripes effect
nvm, its because the feed cuts out
could draw3d be the reason for this?

tough abyss
#

as in?

little raptor
#

The PiP setting

tough abyss
#

everything but disabled has that effect for some reason

#

disabled just locks the last frame

#

and doesn't continue hte feed

little raptor
#

Try a different monitor (or object). Maybe the monitor is buggy

I don't mean with PIP disabled tho. Try normally

tough abyss
#

I've tested out every other screen I could find, everything has the effect BUT the one that I found that doesn't

little raptor
#

Maybe its a scaling bug. Because that one doesn't seem to be scaled

#

My bad:

{
  otherDisplay setObjectTexture [_forEachIndex, ""];
} forEach getObjectTextures otherDisplay;
tough abyss
#

ahh

#

I was confused why you had the _x in the first place

little raptor
#

Told you it will hide them!

tough abyss
#

welp, im at a loss as to what to do

#

Might be a scaling issue as you said

little raptor
tough abyss
#

Problem is...

#

I've seen videos online with people using that screen with no problems like myself

little raptor
#

Are you on dev build?

tough abyss
#

1.98.146373

#

That's not dev afaik

little raptor
#

No. Its stable.
I asked because they changed something about the shadows recently. Thought it might be related

tough abyss
#

ahh

#

hmm I could try testing that, setting my shadows to min 50 and getting away from the screens

little raptor
#

If you want, you can send me the mission and I'll test on my dev build

#

Maybe its fixed already

#

Or just the monitors

tough abyss
#

sent the script already, the screens are Land_TripodScreen_01_large_F

little raptor
#

ok

tough abyss
#

I just use execvm to execute the file itself

little raptor
#

It doesn't matter

tough abyss
#

ye ye just mentionign it just in case

little raptor
#

Day or night doesn't matter right?

tough abyss
#

tested it on both

#

doesnt make a difference

young current
#

Have you tried other screens?

tough abyss
#

^^read above, all of them BUT Land_BriefingRoomScreen_01_F display the effect

#

I can't use that screen because it weirdly only displays the top half of the camera itself

tough abyss
#

reeeeeeeeeeeeeeeeee

#

It might just be me then

#

something with my config probably

little raptor
#

I don't think so

tough abyss
#

Could you by any chance test it out with the stable build?

little raptor
#

Try this code:

aa1 setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
uavCam1 = "camera" camCreate [0,0,0]; 
uavCam1 cameraEffect ["Internal", "Back", "uavrtt"]; 
uavCam1 attachTo [uavRecon1, [0,0,0], "laserstart"]; 
 
"uavrtt" setPiPEffect [0]; 
 
uavCam1 camSetFov 0.03; 
 
addMissionEventHandler ["Draw3D", { 
    _dir =  
        (getPosASL uavRecon1)  
            vectorFromTo  
        (getPosASL player); 
    uavCam1 setVectorDirAndUp [ 
        _dir,  
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0] 
    ];   
}];

Put the uav directly above the player

#

Also, why do you copy-paste your code?! Use "smarter" methods!

{
  _x setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"]
} forEach [aa1, aa2, ...];
tough abyss
#

Im only in the process of learning sqf, I usually do those things but I don't want to overcomplicate things for myself ๐Ÿ˜›

#

Same result...

little raptor
#

Ok. I recommend trying the dev branch, see if it was an issue that's been fixed. It's like a 2~3 GB download

#

You can switch to dev branch by right clicking on the game in Steam, going to properties and then going to the Betas tab

tough abyss
#

I'll just try that later, if it works on another machine I'm satisfied honestly

#

even if it doesn't its only point is just to look nice lol

#

Thank you so much for your help man, you were very helpful

#

sorry for the headache ๐Ÿ˜„

little raptor
#

No problem!๐Ÿ˜Ž

tough abyss
#

Here to annoy again, is there a command/function/thing to move a unit into a specific position from a certain object before executing an animation?

winter rose
#

yes ๐Ÿ˜

tough abyss
#

how do

#

google is being a bad boy again

#

maybe my queries are too specific

#

guess I was right

tough abyss
#

Ok so.. my issue is that setpos takes set values, while I want the player to move directly infront of an object no matter its orientation/pos before doing an animation

winter rose
#

modelToWorld ๐Ÿ˜‰

#

@tough abyss โ†‘

tough abyss
#

ty ๐Ÿ˜„

vague geode
#

Is there a way to get NPCs to just stand still and look around with binoculars from time to time?

winter rose
#

Maybe with selectWeapon, and disabling some AI features @vague geode

vague geode
#

Ok, I'll try that.

warm hedge
#

//protocol.bikb in mission root

#

Depends on what did you do though didn't you copy & pasted into an sqf?

#

Follow the comment instead

#

Make protocol.bikb and paste it

#

Not entire of course. The part of bikb thing

ripe sapphire
#

hello guys, how can we add JIP players to the zeus editable objects list like in the official zues mission ?
I de-pbo'd the official zues scenario but dont find any addCuratorEditableObjects code at all (either in .sqm, .sqf, or description.ext files)

warm hedge
#

hideOnUse does only hide the action menu IIRC. Use removeAction instead

ripe sapphire
#

no player unit is synced to the game masters, yet in game every player including JIP are added to zeus editable objects?

proud carbon
#

ok so in theory the script will wait until the group's waypoint is finished.

           _wp setWaypointCompletionRadius 50;
           _wp setWaypointStatements ["true", "deleteWaypoint [group this, currentWaypoint (group this)]"];
           waitUntil {sleep 5; (count waypoints _PatrolTeam) = 0};

Is this correct?

copper needle
#

Im having an issue where Im drawing an ellipse within an ellipse but I need the order of the layers switched on the map. Anyone able to help?

warm hedge
#

I need the order of the layers switched on the map
What do you mean?

copper needle
#

I need to switch the bottom and top layer. So the ellipse currently on top needs to be below

warm hedge
#

I don't think there's a command to change Z coordinates. How about to recreate the marker?

copper needle
#

I just decided to make them both similar colors so 1 doesnt tint the other. Sorted

hallow mortar
#

Can markers be moved to different editor layers in the left panel and if so, does that help with the issue?

wet shadow
#

Does anyone here have experience with the "onEachFrame" BIS_fnc_addStackedEventHandler?

I am plannign to use drawIcon3D to have some icons for the player. Is it better for performace to split each different drawIcon3D to its own eventhandler or to have multiple drawIcon3D's in a single "onEachFrame" ?

winter rose
#

I would say multiple in one @wet shadow

#

you can move markers to different layers for organisation, but this won't change anything z-index wise @hallow mortar

bright stirrup
#

does BIS_fnc_moduleAnimals do anything or its deprecated? if it is, any examples on how it works would be great ...
I'm trying to create a large seagulls "flock" via animals module via script and its the only command I've found

winter rose
#

it might do something, if the wiki doesn't say anything try reading the function itself @bright stirrup

bright stirrup
winter rose
#

the Animals module still exists and still works, so I would say it does something

copper needle
#

I'm trying to make a script that waits until the number of players in a trigger is equal to 1 but it isnt working. waitUntil { (count(list _trigger)) isEqualTo 1 };

#

Any ideas?

winter rose
#

did you name your trigger _trigger in Eden? If so, remove the underscore, it is a local variable

#

@copper needle โ†‘

copper needle
#

no thats just an example

#

it is ozoneTrigger in reality

winter rose
#

what are the trigger's settings?

surreal peak
#

probably not the case, but make sure the script is scheduled

copper needle
#

I think my main issue is that(count(list _trigger)) isEqualTo 1does not return true

winter rose
#

isEqualTo / == return a boolean

#

try```sqf
waitUntil {
private _list = list _trigger;
systemChat str _list;
count _list == 1;
};

#

@copper needle โ†‘

copper needle
#

That still doesnt work which leads me to believe the issue was that I was using list too quickly. Under list on the wiki it says Calling list immediately after creating a trigger via createTrigger (and setting up activation, area, statements, timeout, etc..), will return <null> instead of an array. It seems the trigger needs about 1 second to initialise, after which it will behave as expected: returning an array of all the objects inside the trigger (the ones matching the criteria), or an empty array.

unique sundial
#

this has been fixed not in stable yet probably

velvet merlin
#

is it pointless to make a basic hit counter with HD EH and instead use damaged EH?
or
is caching the time/diag_tickTime (with some rounding) (per selection/hitpoint?) to determine if its still the same hit/penetration or a new hit/projectile?

tough abyss
#

I'm trying to set up randomization for units, now this works for all AI units, server and locally, they get randomized gear, but it does not work for players

class ALiVE_orbatCreator
{
                init="if (local (_this select 0)) then {_onSpawn = {_this = _this select 0;sleep 0.2; _backpack = gettext(configfile >> 'cfgvehicles' >> (typeof _this) >> 'backpack'); waituntil {sleep 0.2; backpack _this == _backpack}; if !(_this getVariable ['ALiVE_OverrideLoadout',false]) then {_loadout = getArray(configFile >> 'CfgVehicles' >> (typeOf _this) >> 'ALiVE_orbatCreator_loadout'); _this setunitloadout _loadout;[_this] call CFP_main_fnc_randomizeUnit;reload _this};};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";
};

It works on:
AI: Singleplayer, locally hosted multiplayer, dedicated server
Player: Singleplayer, locally hosted mp

The problem arises on a dedicated server, it does not want to randomize the loadout

Any help would be appreciated

tough abyss
#

The problem seems to be that this

[_this] call CFP_main_fnc_randomizeUnit;

doesn't seem to run on individual players on a dedicated server

copper needle
#

Context: I am trying to make a script that draws two ellipses, one within the other. It should be able to detect when a player leaves the inner circle, but is still in the outer circle which would then cause the player to take damage every few seconds. This damage would stop whenever they reenter the inner zone. I also want to add players to an array when they are inside marker areas (1 array for each marker) and removing them from it when they leave.

Question: What would be the best way to detect if the player is outside the inner circle but inside the outer circle then causes damage to specifically that player?

fair drum
#

The problem seems to be that this

[_this] call CFP_main_fnc_randomizeUnit;

doesn't seem to run on individual players on a dedicated server
@tough abyss

Now I don't work with alive, but if this is true for you, try remote exec'ing this?

tough abyss
#

I did execute
this call CFP_main_fnc_randomizeUnit;

#

Is there a way I can put this in the actual config of the unit, so it executes on players after they load in?

#

I'm assuming player call CFP_main_fnc_randomizeUnit;

#

It works when I do it that way, but I want it done automatically when someone loads in, so it doesn't have to be done via init field each mission

tawdry harness
#

Does anyone know how to get the pos of your map and also force set a the location of your map pos?

#

If you get what i mean

#

Like if i open my map and move it around, i want it's location and then to copy that information and be able to force a map location, I didn't find much information on the internet

hallow mortar
#

Question: What would be the best way to detect if the player is outside the inner circle but inside the outer circle then causes damage to specifically that player?
@copper needle
use the distance command to check when the player is within [radius] of the outer circle('s centre position) but not within [radius] of the inner circle

winter rose
#

if it is a round trigger, otherwise there is inArea

hallow mortar
#

yeah that would probably work better actually

#

same structure though

#

@tough abyss you should use remoteExec to apply that call, e.g. sqf [[_this],CFP_main_fnc_randomizeUnit] remoteExec ["call",_this]

#

using initPlayerLocal.sqf may be more JIP/locality safe but I'm not familiar with how Alive systems work

copper needle
#

Thanks @winter rose and @hallow mortar Iโ€™ve been trying to work with inAreaArray unsuccessful so Iโ€™ll give those two a go

tawdry harness
#

Alright awesome, thanks @hallow mortar

tough abyss
#

Thanks man! I'll be testing it later on to see if it all works, I imagine I'll have to add a delay with sleep in order for it to override after ALiVE adds their loadout 0.2 seconds after

#

Also I'm trying to randomize weapons with units, the CFP script unfortunately uses removeAllWeapons, that removes ACE medical, flashlights, literally everything

#

They use:

removeAllWeapons _unit;
#

I know there is removeWeapon but then I need to specify which weapon, that creates a problem since I want my own script to be reusable for many roles

#

I would want something that can remove the
Primary Weapon + Magazines
Launcher + Magazines
Handgun + Magazines

these types of things, but as stated before removeAllWeapons deletes things I don't want it to

#

Is there a version of this command, in which I don't have to specify a classname

#

Basically I'd prefer to use

removeHandgun _unit;

And for it to remove the handgun and its magazines

tawdry harness
#

Also, is there a way to find the zoom at which a map is at?

hallow mortar
#

^ and if there are any wiki wizards reading, that should probably be added to Function Group: Map

winter rose
#

pshhht

hallow mortar
#

@tough abyss _unit removeWeapon (primaryWeapon _unit) is a start. You can also detect what magazines are loaded into the weapon and remove matching classes using primaryWeaponMagazine and removeMagazines, although this won't account for similar-but-not mag types like tracer mags, different colours etc. There is probably a way to find what magazine classes a weapon can accept in its magwell, which would allow you to remove all compatible types not just the loaded type, but I can't find what that way is.

winter rose
#

@hallow mortar added

tough abyss
#

Alright, seems like I will be seeing what I can come up with, thanks again for the help!

robust brook
#
// Either use removeWeaponGlobal or removeWeapon depending on what you are doing.

private _itemsArray = ["arifle_MX_ACO_pointer_F", "arifle_MX_ACO_pointer_F", "arifle_MX_ACO_pointer_F"];

{
  private _currentItem = _x;

  // Check if we need to remove
  if (player hasWeapon _currentItem) then { // Checks if a unit has the given weapon in hands or on back/in holster. Weapons inside unit containers such as vest and backpack are not counted.
    player removeWeapon _currentItem;
  };

} forEach _itemsArray; // Loop for each weapon defined in _itemsArray

@tough abyss Here's an example I made for you ๐Ÿ˜„

tough abyss
#

And for some reason I thought that making randomization of weapons and apparel of units would be pretty easy ๐Ÿ˜…

hallow mortar
#

It is easier (less complex but a little more tedious) if you are willing to completely blank-slate the unit and add everything back in your script

tough abyss
#

I thought about rather than having the weapons, grenades and etc in the unit

#

I just have what I want in there, and then add those via randomization, sure is a lot easier

#

I just have to make sure it applies to players on dedicated servers as well otherwise, well no one will have weapons ๐Ÿ˜„

queen cargo
#
private _arr = [];
private _cases = {
    case 1: {_arr pushBack "inside 1"; "a"}; 
    _arr pushBack "past case 1";
    case 2: {_arr pushBack "inside 2"; "b"};
    _arr pushBack "past case 2";
    case 3: {_arr pushBack "inside 3"; "c"};
    _arr pushBack "past case 3";
    default {_arr pushBack "inside default"; "default"};
    _arr pushBack "past default";
};
private _res = switch 2 do {
    [] call {
        [] call _cases;
        _arr pushBack "past cases inner"
    };
    _arr pushBack "past cases call outter";
};
_arr pushBack _res;
systemChat str _arr```
#

could someone check what the output of this is?

#

need the exact output

exotic flax
#

@queen cargo

["past case 1", "past cases inner", "past cases call outter", "inside 2", "b"]
queen cargo
#

crap

#
private _outarr = [];
private _testarray = [0, 1, 2, 3, 4 ,5, 6];
switch (3) do
{
    {
        case _x: { _outarr pushBack _forEachIndex };
    } foreach _testarray
};
systemChat str _outarr```
i guess ... this outputs a fancy and neat `[3]` ... correct?
still forum
#

sets a flag of what the result is

#

after first matching case. makes a exitWith out of the scope

#

then at end of switch scope, execute code that was matched previously, or that was registered as default

queen cargo
#

nope
in that case, ["past case 1","inside 2","past cases inner","past cases call outter",3] is the output

exotic flax
#

@queen cargo it returns an empty array []

queen cargo
#

wut

still forum
#

huh?

#

no its not

#

what I said gives you the output grez posted

queen cargo
#
private _testarray = [1, 2, 3, 4 ,5, 6];
private _a = 3;
switch (_a) do
{
    {
        case _x: { hint str (_testarray select (_forEachIndex + 1)) };
    } foreach _testarray
};``` what is this doing?
still forum
#

it returns an empty array []
yes because _forEachIndex is nil

exotic flax
#

[]

still forum
#

case _x: { hint str [(_testarray select (_forEachIndex + 1))] };
-> [any]

queen cargo
still forum
#

not sure what that was talking about

#

seems like it was in context to some other conversation

queen cargo
#

anyways
stuff is reverted now

lavish stream
#

Anybody know how to detect a hit on a VR wall? I've tried using Hit, HitPart & HandleDamage eventhandlers but they aren't working.

copper needle
#

Would count(allPlayers inArea "triggerName") return the number of players in an area or am I thinking about this wrong?

exotic flax
#

yes and no;
inArea accepts

  • trigger <OBJECT> - result of createTrigger
  • marker <STRING> - name of marker
  • location <LOCATION> - Pos3D <ARRAY>, Pos2D <ARRAY> or object
  • or an array with some parameters [center, a, b, angle, isRetangle, c]
winter rose
#

also, inArea takes one object/position, not an array

#

so

allPlayers count { _x inArea myTrigger }; // or "myMarker" 
``` @copper needle
#

no wait, code count allPlayers, it's the other way around

copper needle
#

Iโ€™ll give that a go

#

Is that the most efficient way to do it? I need to run it every few seconds on a server with around 100 people with about 40 in the zones

#

Seems like it could get intensive

winter rose
#

do you want to know the number of players, or do you want to know if players are in the area?

copper needle
#

both

#

been trying for hours

winter rose
#

then count is the way to go

tough abyss
#

is there an event-based technique for checking if a player is suppressed? as opposed to going over the distances of every bullet near the player on each frame?

sudden yacht
#

Is it possible to have a unit, or vehicle inherit traits of another vehicle through an init?

#

Thing like turn radius, fuel consumption, traction, ect?

copper needle
#

can you use && this way? if (a && b && c)?

unique sundial
#

if a b and c are booleans or b and c are code returning booleans

copper needle
#

If a b and c are true then (something)

#

Also @winter rose the tip really helped. It goes```sqf
{ _x inArea myTrigger } count allPlayers;

unique sundial
#

it is inefficient this way use inAreaArray

#

also depending on what you need you can use list trigger to get detected units in trigger

robust brook
#

@copper needle Why are you needing to count allPlayers?

copper needle
#

@unique sundial count(allPlayers inAreaArray markerName); gives me "Error Generic error in expression". Any idea why?

#

@robust brook I need to count the number of players within the area of a marker

robust brook
#

@copper needle are you needing to see how many players are in the trigger or names of everyone in the trigger

copper needle
#

both

#

and it is a marker if that makes a difference

robust brook
#

[] spawn {

  private _playersInRadius = nearestObjects [(getPos testingTrigger), ["MAN"], 300]; // Pos of trigger, object type, radius of the pos

  {
    systemChat format ["triggerName: %1 | playerObject: %2 | playerName: %3 | playerUID: %4", testingTrigger, _x, (name _x), (getPlayerUID _x)];
    uiSleep 0.1;
  } forEach _playersInRadius;

  hint format ["Array of players inside the radius: \n %1", _playersInRadius];

  {
    if ((_x in _playersInRadius) && (alive _x)) then { titleText ["You are inside the radius", "PLAIN"]; };
  } forEach allPlayers;

};

``` @copper needle
#

did the example with an actual trigger instead of a marker but same concept, hope this helps you a little bit. ๐Ÿ˜„

copper needle
#

Ill give it a try. Thanks!

#

Ill let you know what happens with it

robust brook
#

It just an a example to show you ONE way to find players in the area

#

if ((vehicle player) inArea yourMarkerName) then { hint "You are in the marker radius!"; };

// OR

{
  if ((vehicle _x) inArea yourMarkerName) then { hint "You are in the marker radius!"; };
} forEach allPlayers;

@copper needle Another way you can also try

copper needle
#
  if ((vehicle _x) inArea yourMarkerName) then { hint "You are in the marker radius!"; };
} forEach allPlayers;``` is what Im using right now
#

But since there will be so many players it will likely be more efficient to go with the one above

robust brook
#

Yeah looping all those players isn't the best, calling/spawning a script once a player has entered the marker radius / trigger is your best bet performance wise.

hallow mortar
#

allPlayers includes dead players so be careful with using that for counting (e.g. include an alive check)

#

The simple solution for counting the players, to me, seems to be placing a matching trigger, setting it to player activation, and using count thisList

robust brook
#

Could add a alive check in the if, but also add a check in the forEach from "allPlayers" to {} forEach (allPlayers-[allDeadMen]);

copper needle
#

Added

robust brook
#

@hallow mortar But what Nikko said using thisList magic variable is very useful for calling a function on trigger activation

copper needle
#

Tried and failed using that. I want to try a different route

hallow mortar
#

I'm curious what went wrong with it since it's pretty simple

copper needle
#

I needed the trigger to constantly shrink and did this changing the x and y of the trigger which would cause activation/deactivation issues. I might go back to it now that I have a better understanding of how they work

robust brook
#
// On trigger activation
_triggerFNC = {
  params ["_thisList"];

  if !(player in _thisList) then {}; // Do something

};

// Do something in init on editor or spawn in a trigger and set the conditions there
[thisList] call _triggerFNC;
``` example of using thisList
unique sundial
quasi rover
#

Is there a way to diable pilot ejection seat for player?

winter rose
#

@quasi rover try locking the driver seat when speed > 0?

quasi rover
#

oh... I didn't. If I just lock the door, pilot can't get out before departure. (speed > 0) is good idea.

warm hedge
#

It's really scripted feature. Try to find them in functions viewer, may find something useful, maybe

quasi rover
#

maybe this:BIS_fnc_PlaneEjection ? but no idea how to handle.

warm hedge
#

IIRC so. I'll back to my PC in few so may tell you some. Maybe not

quasi rover
#

thx

warm hedge
#

Probably doing sqf _plane setVariable ["bis_ejected",true]will do? @quasi rover

winter rose
#

that's for getting -if- someone ejected from the plane, right?

warm hedge
#

You see nothing

quasi rover
#

that's prevent pilot from ejecting the flight?

warm hedge
#

Probably

quasi rover
#

I mean ejecting seat.

warm hedge
#

I think there's no way to hide action menu though

#

Eh what?

quasi rover
#

when pilot eject, the ejecting seat is out from plane. I want to disable that thing.

warm hedge
#

Disable what thing?

#

Not really sure what the goal is

winter rose
#

Prevent ejection menu option

#

I would say to lock until the plane is stopped, but there might be something else

quasi rover
#

I want I can disable ejector seats or make ejection unsurvivable forcing a re-spawn.

winter rose
#

setting the variable as Polpox says doesn't remove the option, but it prevents the action to be done

quasi rover
#

not yet. I'll give a try.

winter rose
#

(just tried ^^)

#

locking doesn't prevent ejection.

quasi rover
#

thx guys. ๐Ÿ˜†

warm hedge
#

Yeah...

player in this && {speed this > 1}```

This is the condition of the ejection

winter rose
#

Shame the lock is not considered (was before Jets iirc)

rain mural
#

Is there any way to only display drawIcon3D for a particular side/unit?

I've been looking around and can't see anything on it. Would it be a case of calling the draw3D on that particular client?

finite jackal
#

Correct

rain mural
#

Thought that was the case. Makes the most amount of sense

sterile lintel
#

anybody know of a way to fix planes bouncing as they're taxiing during unitplay?

winter rose
#

weird
were they the same planes that were used and for recording and for playing?

sterile lintel
#

yeah they're on a carrier so that's probably why

winter rose
#

ah yep, perhaps

mortal steppe
#

Afternoon all, is it possible to script a hunter killer system for a tank, ie commander is independent scanning for targets, spots a target hits a button/triggers action and the turret automatically turns and elevates to the target, I know u can with AI but want to try implement this with players in the gunner slot

winter rose
#

โ€ฆwhat would be the gunner's role then?

mortal steppe
#

This is a real life system where you can have the commander and gunner scan for targets

#

And if the commander spots a target he can hit a button and the turret auto rotates and aims

#

To reduce the engagement time

#

Skip to 7:20

#

Explains it

young current
#

dont think its possible to yank the control from player gunner

quasi rover
#
_tt = format ["[""%1"",'succeeded'] call BIS_fnc_taskSetState;", _tsk];

what does 2 double quotes "" ""mean?

warm hedge
#

The way to use " inside ", basically doing the same with '

quasi rover
#

Is it different with

_tt = format ["[%1,'succeeded'] call BIS_fnc_taskSetState;", _tsk];
``` ? @warm hedge
still forum
#

now you're missing the quotes, that's probably a syntax error

crude needle
#

Anyone know off the top of their head if the EntityKilled mission event handler fires for remote units?

unique sundial
#

yes

tough abyss
#

How can I respawn players with a custom uniform texture?

#

Calling setObjectTextureGlobal in onPlayerKilled is not working with dedicated server

exotic flax
#

That's because 'onPlayerKilled' will only be called when people are killed... and when they respawn they'll get a new uniform ;)
Try 'onPlayerRespawn'

tough abyss
#

If I want a script to be applied to everyone on a dedicated server, aka clients and AI

#

I should switch all instances of 'local' to 'global'

#

If they're only on local, this means clients will be unaffected, correct?

quasi rover
#

Is it allowed to use sleep command in trigger activation field?
trigger setTriggerStatements [condition, activation, deactivation]
e.g. ```sqf
_trgcnd = format ["!(alive %1)",_obj];
_trgact = format ["deletevehicle %1; ['%2','succeeded'] call BIS_fnc_taskSetState; sleep 1; deleteVehicle thistrigger;", _obj, _tsk];
_trg1 setTriggerStatements[_trgcnd,_trgact, ""];

tough abyss
#

I meant onPlayerRespawn

#

Thats where I had it

winter rose
#

@quasi rover nope, but you can [] spawn {} your code

quasi rover
#

thx.

#

while do {} is also needed? @winter rose
e.g.

[] spawn {
  while {true} do {
     ..trigger..
  };
};
little raptor
#

what do you want to do?

#

if this:

#

_trgact = format ["deletevehicle %1; ['%2','succeeded'] call BIS_fnc_taskSetState; sleep 1; deleteVehicle thistrigger;", _obj, _tsk];
No

#

What you're doing is wrong tho

#

You can't put the object there with format

#

An "object" is an object. What you do gives you the stringized version of the ingame object ID, which causes the game to throw an invalid expression error

#

Instead, use setVariable to register those variables in the trigger's namespace

#

And use getVariable to get them in your statement

tough abyss
#

player setObjectTextureGlobal [0,"mytex.paa"] is not working in onPlayerRespawn

#

On dedicated

little raptor
#

@tough abyss
You mean it works otherwise?
You can try spawning the code and adding some sleep delay.

copper needle
#

I need to globally draw an Ellipse on the map. How would I do this?

ripe sapphire
#

hello guys is the onPlayerKilled.sqf and onPlayerRespawn.sqf a scheduled environment? if not, is there a workaround to run the codes in them as scheduled?

winter rose
#

@quasi rover no, spawn.

little raptor
#

@ripe sapphire
Is there even such a thing?

winter rose
#

@ripe sapphire I would say yes scheduled
if at any point you want scheduled code from an unscheduled environment, use [] spawn { /* your code */ };

little raptor
#

In any case, you can always check which environment is scheduled using:

canSuspend
#

@winter rose So there are such files?

#

onPlayerKilled.sqf

#

and onPlayerRespawn.sqf

ripe sapphire
#

ahh ok, such as in triggers you'd use []spawn yes?

winter rose
#

@little raptor

#

@ripe sapphire yep!

little raptor
#

I'd never seen them!

ripe sapphire
#

yeah, just realized i actually used sleep in my onPlayerKilled and it worked, so i guess it is scheduled

tough abyss
#

@little raptor what would be a good way to do that? just add a sleep statement before the texture is applied?

little raptor
#

Yeah.

[] spawn {
  sleep 1;
   player setObjectTextureGlobal [0,"mytex.paa"] 
};
tough abyss
#

what will that do exactly to fix the issue?

#

I don't really understand the issue to begin with, so I can't think of a solution

little raptor
#

Does the command setObjectTextureGlobal work in general?

tough abyss
#

yes

little raptor
#

You're using onPlayerRespawn.sqf?

tough abyss
#

Yes

little raptor
#

So there's no need for spawn either

#
params ["_player"];
//sleep 1;
_player setObjectTextureGlobal [0,"mytex.paa"];
tough abyss
#

what does params ["_player"] do vs just saying player?

copper needle
#

I need to globally draw an Ellipse on the map. How would I do this?

tough abyss
#

As in during the mission?

#

An elipse marker needs to pop up?

copper needle
#

yes

#

on all players maps

tough abyss
little raptor
#

@tough abyss That's what the onPlayerRespawn gives

#

Not sure if it's different

tough abyss
#

Set the alpha to 0 at the beginning, then have a trigger that sets it to 1 when they get to the point where it should pop up

little raptor
#

But it's safer to use my code

ripe sapphire
#

this select 0 returns player on onplayerRespawn

#

so i think player should work

little raptor
#

He said it doesn't work

tough abyss
#

no it works

ripe sapphire
#

works on my mission

tough abyss
#

The issue is it doesn't work on dedicated

#

It works in local

#

So the word player isn't the issue

ripe sapphire
#

try the sleep maybe like leopard suggested?

little raptor
#

@tough abyss Just try this code with sleep:

params ["_player"];
sleep 1;
_player setObjectTextureGlobal [0,"mytex.paa"];

It probably will work.

faint oasis
#

how can i replace specifics word of my string ?

#

example : "abc cba abc" i want to replace all "abc" in my string

#

how can i do that ?

little raptor
#

You'd have to select a number of chars in your string that is equal to the number of chars in the word you're searching for. If they match, pushBack the new replaced word, otherwise the original

faint oasis
#

but a function exist for that ?

little raptor
#

Not sure

faint oasis
#

ok

little raptor
#

It's not difficult to make one

faint oasis
#

@little raptor i have already a function to do that

#
_stringReplace = {
        params["_str", "_find", "_replace"];
        
        private _return = "";
        private _len = count _find;    
        private _pos = _str find _find;

        while {(_pos != -1) && (count _str > 0)} do {
            _return = _return + (_str select [0, _pos]) + _replace;
            
            _str = (_str select [_pos+_len]);
            _pos = _str find _find;
        };    
        _return + _str;
    };
#

it's not made by me

little raptor
#

So why do you ask?

faint oasis
#

i want to know if a vanilla function exist

#

i prefer to use vanilla function

little raptor
#

If it did, it wouldn't be any different

faint oasis
#

ok

little raptor
#

That function is not good tho

#

I think

faint oasis
#

why ?

little raptor
#

Its search method is case sensitive

#

Not sure if you want that

faint oasis
#

no i don't want that

#

ok but thx

#

i will create my function

winter rose
#

There are string replace fnc on the forums

little raptor
#

His func is one of them

faint oasis
#

yes

#

@little raptor but to make a function how can i do ? because i need to check letters or word ?

little raptor
#

non-case sensitive right?

faint oasis
#

wait

#

yes

little raptor
#

does the string have a mix of uppercase and lowercase?

#

Or is it just one type of case?

faint oasis
#

@little raptor thx for your help but i will search how can i do that because it's very complex

#

it's lowercase and uppercase

#

and it's not a letters

#

it's a word

little raptor
#

Then you should use the method I said.

#

You'd have to select a number of chars in your string that is equal to the number of chars in the word you're searching for. If they match, pushBack the new replaced word, otherwise the original

faint oasis
#

yes

#

but the string is not an array

little raptor
#

create an empty array

#

pushBack

#

joinString at the end

#

Something like that

faint oasis
#

ok

little raptor
#

I didn't test it

#

Hold on!

#

It was wrong!

#

There's no "find"

#

lol

#

corrected

#

@faint oasis I tested it and it works now

faint oasis
#

ok

#

thx but i have tested my function and it work

#

so thx

little raptor
#

ok

faint oasis
#

@little raptor why you have deleted your function ? i want to see it

little raptor
#

ok

_a = []; 
_cnt = count _find; 
for "_i" from 0 to count _str - 1 do { 
_testStr = _str select [_i, _cnt]; 
if (_testStr == _find) then { 
_a pushBack _replace;
_i = _i + _cnt - 1; 
} else { 
_a pushBack (_str select [_i,1]) 
} 
}; 
_a joinString ""
faint oasis
#

ok thx @little raptor

little raptor
#

@faint oasis Actually, there's even a faster method

#
_stringReplace = {
    params["_str", "_find", "_replace"];
    
    private _return = [];
    private _len = count _find;
    
    private _strL = toLower _str;
    
    _find = toLower _find;
    private _pos = _strL find _find;
    while {(_pos != -1) && (count _str > 0)} do {
        _return append [_str select [0, _pos], _replace];
        
        _str = (_str select [_pos+_len]);
        _strL = toLower _str;
        _pos = _strL find _find;
    };
    _return pushBack _str;
    _return joinString ""
};
faint oasis
#

yeah

#

but it's in toLower

#

but don't worry i have understand the code

#

so now i understand

little raptor
#

No it's not

#

It works exactly like the last one

faint oasis
#

yes

#

but my code is in "not case sensitive"

#

i will add an option to select the "lower" or "upper"

#

but thx

little raptor
#

toLower is to speed up the search

#

It has nothing to do with what you say

faint oasis
#

yes but if i have "E" and "e"

#

it's not the same letters

little raptor
#

I know

#

I don't think you understand what's going on

#

You can try the code

#

It's 6X faster than the last one

faint oasis
#

yes i know

#

don't worry

#

but if you convert the word in "tolower" for find

#

yes

#

it will be more faster

little raptor
#

Not because of that

faint oasis
#

ok

little raptor
#

Because I use the find command

faint oasis
#

no problem

#

so thx

#

no i must leave

#

i'm sorry

sullen pulsar
#

๐Ÿ˜‘

faint oasis
#

@little raptor if you want we can speak tomorrow

#

thx for your help

little raptor
#

np

copper needle
#

How do I make this global on multiplayer? sqf {if (_x in playersOut && !(_x in playersIn)) then { _x setHitPointDamage ['hitBody', ((_x getHitPointDamage 'hitBody') + 0.1)];}; } forEach playersOut-[allDeadMen];

faint oasis
#

@copper needle

[[], {
{if (_x in playersOut && !(_x in playersIn)) then {
        _x setHitPointDamage ['hitBody', ((_x getHitPointDamage 'hitBody') + 0.1)];};
    } forEach playersOut-[allDeadMen];
}] remoteExec ["BIS_fnc_spawn", 0, true];
still forum
#

only if playersOut and playersIn are global and public variables

tropic willow
#

ive been trying to make a mission for peer to peer, and i got 2 questions, for the CBRN mod, do i need to use a dedicated server to be able to run scripts? and also, i keep getting an error although everything is in place, im just now dipping into codes, with help from my friend for finding the right scripts for the job. any help would be appreciated!
if you respond ,ping me so i can see the message!

#

...cant seem to post images. but lemme text it out..

#

Include file C:\Users(username)\documents\Arma 3- Other Profiles(username)\mpmissions\CBRN%202.chernarusredux\scripts\cbrn\funcs.hpp not found

copper needle
#

I'm using a script where if a player is in the "playersOut" array but not in the "playersIn" array then they will be damaged. The script works fine on my screen and I see the player slowly get damaged and then eventually die, but on their screen they don't. They can even shoot while dead on my screen and I can see/hear the bullets.

Damage Script:

 [[], { {if (_x in playersOut && !(_x in playersIn)) then { _x setHitPointDamage ['hitBody', ((_x getHitPointDamage 'hitBody') + 0.1)];};} forEach playersOut-[allDeadMen]; }] remoteExec ["BIS_fnc_spawn", 0, true];

How do I keep the damage consist on a server?Anyone able to help? Thank you in advance!

robust hollow
#

I'm not sure that snippet is doing what you want it to. It is making all players loop through all players (in playersOut) to set damage. setHitPointDamage apparently only works for local arguments so each player can only set their own damage, not anyone else's. Are you sure that is correct? Or are you looking for something more like this where it only sends the remoteexec to players who need their damage modified, and only sets the damage once.

[[],{
    player setHitPointDamage ['hitBody',(player getHitPointDamage 'hitBody') + 0.1];
}] remoteExec ["call",playersOut - playersIn - allDeadMen - [objNull]];
copper needle
#

Iโ€™ll give it a try, thanks!

#

also is there something for the opposite of arrayIntersect. So something that returns array of uncommon elements

robust hollow
#

_a - _b

#

ehh, thats not right

#

i think there would be a command for it but this the best i can think of right now
_c = (_a + _b) - (_a arrayIntersect _b);

#

not entirely right either ๐Ÿ˜Ÿ

copper needle
#

The wiki says: "The subtraction will remove all elements of second array from the first array:

_myArray = [1, 2, 3, 1, 2, 3] - [1, 2]; // _myArray is [3, 3]"

#

so _c = _a - _b? I cant test right now

ionic orchid
#

_c = (_a - _b) + (_b - _a); ?

robust hollow
#
_c = [];
{_c pushBackUnique _x} forEach ((_a - _b) + (_b - _a));

maybe ๐Ÿคทโ€โ™‚๏ธ idk. it is possible somehow.

copper needle
#

will give each one a go and see if any work lmao

#

Thanks for the help the both of you

astral carbon
#

How can I force the player to lower their weapon? Not put on back but sorta force lower it so they have to double control to raise it back up

#

Looked up on the wiki but couldn't find anything (I was looking over at Actions and stuff)
edit: Ah got it

ripe sapphire
#

@astral carbon can you post the code? im interested also

astral carbon
#

player action ["WeaponOnBack", player]

#

Guess "WeaponOnBack" just lowers it in his hand

ripe sapphire
#

does that work for both primary and secondary wep?

astral carbon
#

however it isn't working for some odd reason with people who are walking to a waypoint

#

Not sure, I just tried it for secondary

#

I got this one dude with a pistol walking to a waypoint and the only time it works is if I exec it from the console

#

Executing it via a file doesn't work for example

ripe sapphire
#

exec it from the waypoint before that?

astral carbon
#

Should I delay the waypoint by like a sec?

copper needle
#

@robust hollow @ionic orchid Ended up just doing: ```sqf
outsiders = [];
{ if (_x in playersOut && !(_x in playersIn)) then {outsiders pushBackUnique _x;} } forEach playersOut;

[[],{player setHitPointDamage ['hitBody',(player getHitPointDamage 'hitBody') + 0.1];}] remoteExec ["call",outsiders];``` Avoided figuring out how to do it using subtraction. Thanks again!

ripe sapphire
#

im thinking you can set a variable, and while this variable is true, execute that script

ionic orchid
#

you could probably just use outsiders = playersOut - playersIn;

ripe sapphire
#

in player's init:
lowwep = true
and in init.sqf:

while {lowwep} do {
    [player action ["WeaponOnBack", player];
    }

and then in player's waypoint's onAct:
lowwep = false

copper needle
#

@ionic orchid Didn't work the first time but now it does. Not sure what happened lmao

ripe sapphire
#

this way game will check every 3ms if lowwep=true and if it is, force player to lower his weapon, once player reach his waypoint, it turns to lowwep=false and script stops

#

i think thats how it should work, im still very new tho so please cmiiw

astral carbon
#

Oh okay

#

thanks, I'll try it

little raptor
#

@ripe sapphire Never use an indefinite while loop like that without sleep.
And what you say is absolutely wrong. It checks multiple times every frame until it burns out through the 3 ms period and doesn't let other scripts do their jobs either.
First of all, there is waitUntil that does this.
Second of all, if you still wanted to use while:

while {...} do {
...
sleep 0.001;
};

will pause the code until the next frame.

Third of all, for something so slow such as player movement, you must use even bigger sleeps. The player (infantry) moves at most at 6 m/s so the value of sleep should be rather large. I'd say anything between sleep 0.1 and sleep 1 is small enough.

ripe sapphire
#

thank you for the correction ๐Ÿ™

little raptor
#

No problem! ๐Ÿ˜…

ripe sapphire
#

what will happen if we dont use sleep? for a while control structure

little raptor
#

The while loop keeps checking in that frame

#

until the 3 ms period is up

#

So basically it's wasting performance

#

For conditions that change over time, you must always use sleep

#

Such as this case. Your condition doesn't need to be checked multiple times every frame. Because the player cannot move until the next frame. So you must suspend the code and wait for the condition to change.

#

There's no need for sleep in waitUntil. It automatically waits until the next frame

ripe sapphire
#

i see so we add the sleep as big as possible before any change is done to the condition?

little raptor
#

Yeah. The sleep period should be as big as possible (minimum period where you expect the condition to change).

#

If it's a condition that is expected to change very often, use sleep 0.001. It means "until the next frame"

#

Any value smaller than that won't work

ripe sapphire
#

so that means, after it checks, it will wait until the 3ms period is done before restarting?

little raptor
#

It will wait until the next frame

#

The 3ms period is the maximum time in each frame that is given to scheduler

#

But since FPS in Arma is typically low, your next check will be after 1/FPS seconds later

#

@60FPS : 1/60: 0.0167 seconds later

#

or 16.7 ms

#

3 ms is a safe period which is impossible to reach: 333 FPS

ripe sapphire
#

and with waituntil, is this the correct code?

waituntil {lowwep};
    player action ["WeaponOnBack", player];
little raptor
#

yeah, but you should remove the first [

ripe sapphire
#

ah right xD
so that means, a sleep 0.001 @60fps will wait for 0.016 seconds?

little raptor
#

Yeah. It cannot wait shorter than your FPS

ripe sapphire
#

and if we do sleep 5 that means it doesnt check condition every frame?

little raptor
#

No

#

It puts a timer on the current code

#

So the scheduler continues processing it after 5s

ripe sapphire
#

ok, so @60fps, thewhile loop without sleep, will use the entire 3ms to keep checking the condition, but with sleep 0.001 then it checks the condition every 0.016 seconds?

little raptor
#

Exactly

#

The 3ms belongs to everyone! Without sleep, your script consumes it all! ๐Ÿ˜„

ripe sapphire
#

Thanks a lot leopard! you have been super helpful! ๐Ÿ™

little raptor
#

No problem! ๐Ÿ™‚

ripe sapphire
#

leopard, so i tried using this code

while {lowwep} do {
    [player action ["WeaponOnBack", player]];
    sleep 1
    }

and it doesnt work, however this one does, do you know the problem?

waituntil {lowwep};
    player action ["WeaponOnBack", player];
while {lowwep} do {
    [player action ["WeaponOnBack", player]];
    sleep 1
    }
little raptor
#

you're still keeping the [

#

Do you want to do it in the loop?

ripe sapphire
#

also, the "WeaponOnBack" action seems to work BOTH raising and lowering the gun, so when looped what it does is alternate between the two, any ideas on how to force players to keep the gun down?

#

yes the idea is to force their guns down so they cant fire, so i guess must use while loop

#

you're still keeping the [
@little raptor omg xD

little raptor
#

keep the gun down? or put it on the back?

#

It's different

ripe sapphire
#

ok i tried this, still doesnt work

while {lowwep} do {
    player action ["WeaponOnBack", player];
    sleep 1;
    }
warm hedge
#

Not sure the context though is the lowwep even declared?

ripe sapphire
#

put gun to safety here's from wiki Description: Soldier 'unitName' does nothing, 'target unit' moves his weapon from/to the safety position (gun held across chest pointing at the ground).

little raptor
#

Ok

ripe sapphire
#

yes, what i did:
in player's init: lowwep = false
and then trigger radio alpha onACT: lowwep=true

warm hedge
#

And when the while executed? Of course if lowwep is false, won't work

little raptor
#

@ripe sapphire
You should use the reverse condition

#

for waitUntil

#

waitUntil{!condition}

ripe sapphire
#

while is executed right at init, but shouldnt it keep checking ?

little raptor
#
waitUntil {
  if (animationState player select [13,3] != "low") then {player action ["WeaponOnBack", player];};
  !lowwep
}
#

what do you mean?

#

Anyway, this does what you wanted

#

Keeps checking until lowwep is false

#

And keeps the weapon lowered

warm hedge
#

Oh yes, that actually is a smart way

ripe sapphire
#

i mean, the while loop is gonna keep checking if the condition is met right?

little raptor
#

yes

#

so does the above code

#

Add a 1 second sleep to it tho

#

I checked it and it's still bugged

ripe sapphire
#
waituntil {lowwep};
    player action ["WeaponOnBack", player];

while {lowwep} do {
    player action ["WeaponOnBack", player];
    sleep 1;
    }

with this one, the while code is executed, however this one below has no effect?

while {lowwep} do {
    player action ["WeaponOnBack", player];
    sleep 1;
    }
#

roger will try that one

warm hedge
#

If lowwep is false when the while is called, it won't do anything

little raptor
#

@ripe sapphire

waitUntil {
  if (animationState player select [13,3] != "low") then {player action ["WeaponOnBack", player];};
  sleep 1;
  !lowwep
}
#

@ripe sapphire The better way is to use animStateChanged event handler

#

Do not use loops when you can do something with eventhandlers

#

They're wayyyyyy better

#
player addEventHandler ["AnimChanged", {
  params ["_player", "_anim"];
  if (!lowwep) exitWith {_player removeEventHandler ["AnimChanged", _thisEventHandler]};
  if (_anim select [13,3] != "low") then {_player action ["WeaponOnBack", _player];};
}];
ripe sapphire
#

If lowwep is false when the while is called, it won't do anything
@warm hedge but after i activated the trigger with onAct: lowwep = true, it still doesnt fire?

little raptor
#

This one does what your loop did. And it's both faster and better

ripe sapphire
#

nice!!! perfecto leopard ๐Ÿ˜„

warm hedge
#

If the while is already executed even if didn't anything, won't be executed again

ripe sapphire
#

wait, actually its making me stuck into a loop of gun transition lol

little raptor
#

yeah

#

It shouldn't! ๐Ÿ˜„

#

It can be fixed

ripe sapphire
#

ohhh, this right?
If CONDITION is false from the beginning on, the statements within the block of the loop will never be executed.

#

so that means the loop should be triggered right as lowwep becomes true ?

warm hedge
#

Yes, if you still wanted to do with while

ripe sapphire
#

i see, leopard's solution is much better, just wanted to know why code didnt work, i see the reason why this code worked, was because script was suspended by waituntil until the lowwep=true, so when while loop is called, lowwep is already true ?

warm hedge
#

Yes

ripe sapphire
#

thank you !

#

btw leopard is there a way to like disable input from aim and fire button? i think that would be an easier solution to prevent bringing gun up?

little raptor
#

@ripe sapphire

player addEventHandler ["AnimStateChanged", { 
  params ["_player", "_anim"]; 
  if (!lowwep) exitWith {_player removeEventHandler ["AnimStateChanged", _thisEventHandler]}; 
  if ((_anim splitString "_") findIf {_x select [13,3] == "low"} == -1) then { 
 _player action ["WeaponOnBack", _player] 
  } 
}];
#

Fixed

ripe sapphire
#

niceee, however when aiming i can still fire 1-2 shots ?

warm hedge
#

Maybe make a condition if the anim hasdisableWeapons or some config is better?

little raptor
#

The action simply doesn't work if it's not possible to lower the weapon

#

I noticed there's a bug. If you run and bring out the weapon, you'll get stuck in a loop! ๐Ÿ˜…

#

I think the loop method is still better

ripe sapphire
#

ahh yes i just reproduced, my legs wont stop ๐Ÿ˜‚

#

found a fix tho, just hit ' to make ur char sit

#

and the anim resets

#

so that's taken care of, only thing left is that you can still fire 1-2 rounds if you click fast enough

little raptor
#

I just realized why that bug occurs. It's an engine issue. It keeps sending the request so that the player can keep the gun up.

ripe sapphire
#

i see, well this should be good enough, thanks mate

little raptor
#

I can't find a fix for the firing either

#

It keeps looping

ripe sapphire
#

hmmm, found another problem, player can still fire when prone

#

Found a safezone script, it utilizes allowdamage and fired EH to delete any projectile shot.

if (isNil "inSafezone") then {
    inSafezone = false;
};
while {
    true
}
do {
    private["_safeZoneDamageEH", "_safeZoneFiredEH"];
    waitUntil {
        inSafeZone
    };
    player allowDamage false;
_safeZoneDamageEH = player addEventhandler["HandleDamage",{false}];
    _safeZoneFiredEH = player addEventHandler ["Fired", {
   deleteVehicle (_this select 6);
systemChat ("You can not fire your weapon in a safe zone.");
    }];
    waitUntil {
        !inSafeZone
    };
    player allowDamage true;
    player removeEventhandler["HandleDamage", _safeZoneDamageEH];
    player removeEventHandler["Fired", _safeZoneFiredEH];
}; 
#

i guess i'll use this + leopard's script

little raptor
#

You can also use:

player addEventHandler ["AnimStateChanged", {  
 params ["_player", "_anim"];  
  
 _anims = _anim splitString "_";  
  
 if (_anims findIf {_x select [13,3] == "low"} == -1) then { 
  _lastAnim = _anims#(count _anims - 1); 
  _anim = [_lastAnim select [0,9], "stp", "slow", _lastAnim select [16, 5], "non"] joinString "";  
  if (isClass (configFile >> "cfgMovesMaleSdr" >> "states" >> _anim)) then { 
   _player switchMove _anim; 
   _player playMoveNow _anim; 
  };
 }; 
}];

It still loops, but you can unloop by pressing fire again

#

The player can't fire with this script (except for prone)

#

And with missiles

#

@ripe sapphire Hold on!

#

What are you doing?!

#

Don't use that script!

#

never mind

#

My bad!

ripe sapphire
#

o.0 its something i found on the net lol

#

damn got me in the first half not gonna lie lol

oblique arrow
little raptor
#

You can simply use triggers

#

What I don't get is why it is deleting some vehicle

#

And doesn't recreate it again!

#

That's a bug

#

Maybe?

ripe sapphire
#

it deletes the projectile?

#
this addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
}];
little raptor
#

Oh it's inside the EH

#

My bad

#

๐Ÿ™ƒ

ripe sapphire
#

xD

little raptor
#

I can't read code if it's not properly indented! ๐Ÿ˜…

ripe sapphire
#

leopard that script works good but veery unnatural, my guy just yeeted himself into crouching form prone ๐Ÿ˜‚

little raptor
#

yeah

ripe sapphire
#

but it gets the job done, i will use it! ๐Ÿ™‚

little raptor
#

It switches the animation. It's a dirty method

#

it can be fixed if you want

ripe sapphire
#

well the goal is to make player not try to shoot, so making it look weird is not really a bad idea i guess

little raptor
#

I can provide a better solution

#

If you want

#

Just remove the ammo

#

Gimme a sec

ripe sapphire
#

xD for sure

little raptor
#

Do you want to use safezones?

#

I mean no firing zones

#

If so, I can do it with triggers

#

If it can happen in any place, then I'll just use eventhandlers

ripe sapphire
#

yeah i implemented your last code into trigger areas

little raptor
#

so triggers it is

ripe sapphire
#

when player enters are, lowwep=true

little raptor
#

ok

ripe sapphire
#

when outside, false, and its already coded in your script to delete EH when its false

#

so its working properly now curently

little raptor
#

@ripe sapphire

MY_fnc_SafeZone =
{
  params ["_trigger"];
    _lastPlayers = list _trigger;
    waitUntil {
        _players = list _trigger;
        {
            _x enableReload false;
            _player = _x;
            _ammoArray = [];
            _lastAmmo = _player getVariable ["MY_lastAmmo", [0,0,0]];
            {
                _ammo = _player ammo _x;
                if (_ammo > 0) then {
                    _player setAmmo [_x, 0];
                };
                _ammoArray pushBack (_lastAmmo#_forEachIndex max _ammo);
            } forEach [primaryWeapon _x, secondaryWeapon _x, handgunWeapon _x];
            
            _player setVariable ["MY_lastAmmo", _ammoArray];
        } forEach _players;
        
        {
            _x enableReload true;
            _player = _x;
            _lastAmmo = _player getVariable ["MY_lastAmmo", [0,0,0]];
            {
                _player setAmmo [_x, _lastAmmo#_forEachIndex];
            } forEach [primaryWeapon _x, secondaryWeapon _x, handgunWeapon _x];
        } forEach (_lastPlayers - _players);
        
        _lastPlayers = _players;
        
        !triggerActivated _trigger
    }
};

_trigger setTriggerStatements ["this", "[thisTrigger] spawn MY_fnc_SafeZone", ""]
#

Not tested

#

Updated and fixed some issues

ripe sapphire
#

so in trigger onAct i run this?
this setTriggerStatements ["this", "[] spawn MY_fnc_SafeZone", ""]

little raptor
#

You mean initbox?

#

Yes

ripe sapphire
#

or do i copy the whole thing

little raptor
#

updated again btw

ripe sapphire
#

triggers dont have initbox?

winter rose
#

in OnActivation field, place

[thisTrigger] spawn MY_fnc_SafeZone
```*edited
little raptor
#

[thisTrigger] spawn MY_fnc_SafeZone

winter rose
#

IF you define your function before.

ripe sapphire
#

ok tested it nice, though it means people actually lose 30rnds of ammo

#

both this and the EH one works, but i think i prefer the EH one

little raptor
#

@ripe sapphire It gives the ammo back

#

Just "borrows" it

ripe sapphire
#

strange, it doesnt for me?

#

so i put this code in the onACT of my trigger yes?

MY_fnc_SafeZone = 
{ 
  params ["_trigger"]; 
    _lastPlayers = list _trigger; 
    waitUntil { 
        _players = list _trigger; 
        { 
            _x enableReload false; 
            _player = _x; 
            _ammoArray = []; 
            _lastAmmo = _player getVariable ["MY_lastAmmo", [0,0,0]]; 
            { 
                _ammo = _player ammo _x; 
                if (_ammo > 0) then { 
                    _player setAmmo [_x, 0]; 
                }; 
                _ammoArray pushBack (_lastAmmo#_forEachIndex max _ammo); 
            } forEach [primaryWeapon _x, secondaryWeapon _x, handgunWeapon _x]; 
             
            _player setVariable ["MY_lastAmmo", _ammoArray]; 
        } forEach _players; 
         
        { 
            _x enableReload true; 
            _player = _x; 
            _lastAmmo = _player getVariable ["MY_lastAmmo", [0,0,0]]; 
            { 
                _player setAmmo [_x, _lastAmmo#_forEachIndex]; 
            } forEach [primaryWeapon _x, secondaryWeapon _x, handgunWeapon _x]; 
        } forEach (_lastPlayers - _players); 
         
        _lastPlayers = _players; 
         
        !triggerActivated _trigger 
    } 
}; 
 
_trigger setTriggerStatements ["this", "[thisTrigger] spawn MY_fnc_SafeZone", ""];

[thisTrigger] spawn MY_fnc_SafeZone
little raptor
#

It has a bug hold on

ripe sapphire
#

roger

#

leopard mate i found a very easy code to prevent shooting but still keep weapon xD

#

basically since the lower weapon anim is buggy af, we can use another "holster" anim which works perfect

#

trigger onAct:

hint "In Safe Zone";
player allowDamage false;
isSafe = true;

while {isSafe} do
{
    derp = player action ["SwitchWeapon", player, player, 100];
    sleep 1;
};

onDeact:

isSafe = false;
hint "Leaving Safe Zone";
player action ["SwitchWeapon", player, player, 0];
player allowDamage true;
little raptor
#
MY_fnc_SafeZone =
{
    params ["_trigger"];
    _allUnits = [];
    waitUntil {
        _players = list _trigger;
        {
            _x enableReload false;
            _player = _x;
            _ammoArray = [];
            _lastAmmo = _player getVariable ["MY_lastAmmo", [0,0,0]];
            {
                _ammo = _player ammo _x;
                if (_ammo > 0) then {
                    _player setAmmo [_x, 0];
                };
                _ammoArray pushBack (_lastAmmo#_forEachIndex max _ammo);
            } forEach [primaryWeapon _x, secondaryWeapon _x, handgunWeapon _x];
            
            _player setVariable ["MY_lastAmmo", _ammoArray];
            _allUnits pushBackUnique _x;
        } forEach _players;
        
        {
            _x enableReload true;
            _player = _x;
            _lastAmmo = _player getVariable ["MY_lastAmmo", [0,0,0]];
            {
                if (_x != "") then {
                    _player setAmmo [_x, _lastAmmo#_forEachIndex];
                };
            } forEach [primaryWeapon _x, secondaryWeapon _x, handgunWeapon _x];
            _player setVariable ["MY_lastAmmo", [0,0,0]];
            _allUnits = _allUnits - [_x];
        } forEach (_allUnits - _players);
        
        !triggerActivated _trigger
    };
};

trigger setTriggerStatements ["this", "[thisTrigger] spawn MY_fnc_SafeZone", ""]
#

Yeah that one is also possible

#

This one works too

ripe sapphire
#

roger testing now

#

poggers mate it works, though it looks like you must be careful not to reload inside the trigger, coz reloaded mags doesnt get returned

#

can you remove the grenades too?

little raptor
#

If the units are not expected to change their gear inside the trigger, you can just save their whole loadout

#

grenades are mags

#

I can just remove all their magazines

#

only keep the weapons, uniforms, backpack, etc.

#

basically only their clothes will remain! :p

calm bloom
#

hello everyone! Do you guys have an idea how can i tell that certain vest have iteminfo inherited from iteminfo or vestitem?
i.e.

    class BHD_TACV1DSS: Vest_Camo_Base
    ...
        class ItemInfo: VestItem```
```cpp
class rhsusf_iotv_ocp_base: Vest_Camo_Base
{...
    class ItemInfo: ItemInfo```
ripe sapphire
#

Well, i kinda prefer the EH and loop ones as they add the nice lower / holster weapon effect... but you have created some nice scripts here mate, you should post them in BI Forums, someone might be looking for it :p

timid niche
#

Is there a way to stop the player from being able to hold the key with KeyDown and instead have them actually press it every time?

copper raven
calm bloom
#

thank you @copper raven , hope it works for subclesses!

obtuse quiver
#

im doing a scenario where one man is escaping from a city and a team is trying to track him down, when the searching team is near the runner they hear a sound, is it possible?

winter rose
#

Yes

obtuse quiver
#

teach me master

jade abyss
#

translated: Write me the code ๐Ÿ˜„

winter rose
#

ok, but you should wear this schoolgirl uniform first

waitUntil { units group _team findIf { _x distance _runner < 20 } != -1 };
hint "ping!";
obtuse quiver
#

XD

#

thanks alot!

smoky verge
#

is that better than an eventhandler?

winter rose
#

does such EH exist though?

still forum
#

waitUntil { units group _team findIf { _x distance _runner < 20 } };
notlikemeow
inAreaArray maybi

winter rose
#

!= 1 *
fixed

obtuse quiver
#

Roger roger

fair drum
#

now the question is, do you understand what he wrote?

winter rose
#

because I don't

smoky verge
#

oh weird I was sure there was an eventhandler for "detected"
was wrong

jade abyss
#

back to the shamecorner again!

smoky verge
#

I live there anyway

winter rose
#

plus it would be a distance EH ๐Ÿ™ƒ

smoky verge
#

also true

obtuse quiver
#

a hint it's ok too

#

20 stands for meters?

warm hedge
#

Basically every โ€œdistancesโ€ are based on meters

obtuse quiver
#

phew good to know

#

i have another idea, a marker on the map that appears every minute?

young current
#

and โ“ green_question blue_question

obtuse quiver
#

i don't know how to do it ๐Ÿ˜…

jade abyss
#

Don't expect us to write all the code for you.

#

Check the last 3 Pinned messages.

obtuse quiver
#

Absolutely! just wanted to know if it's possible

jade abyss
#

If you show 0 effort to try, you will have a hard time to find any help.

timid niche
#

Can you que moves?

jade abyss
#

Yes, it's possible.

warm hedge
#

Que what?

timid niche
#

moves/anims

little raptor
#

you mean queue?

timid niche
#

lol yes

jade abyss
#

Can you que moves?
@timid niche I think one of the commands does that, erm...

warm hedge
#

playMove

obtuse quiver
#

fantastic, ill search on the wiki now thx for the help!

jade abyss
#

playMove? idk atm

little raptor
#

playMove

warm hedge
jade abyss
#

ha, it was ๐Ÿ˜„

little raptor
#

If you do playMove one after the other it will be queued

jade abyss
#

Description:
When used on a person, smooth transition to given move will be done.
The difference between playMove and playMoveNow is that playMove adds another move to the move queue, while playMoveNow replaces the whole move queue with new move (see Example 2).

obtuse quiver
#

i found a better, easy way! a flare gets launched every now and then

little raptor
#

For what?

#

I mean randomly? Without an event?

#

If so, find one of my scripts I wrote for exocet (where I thought him how to fire an rpg)

#

Here:

_pos = getPosASL player; 
_rpg = createVehicle ["r_pg7_f", _pos]; 
_rpg setPosASL _pos; 
_dir = _pos vectorFromTo (aimPos aheli vectorAdd (velocity aheli vectorMultiply (_pos distance aheli)/200) vectorAdd [random 1, random 1, random 1]);  
 _xx = _dir#0;  
 _yy = _dir#1;  
 _up = _dir vectorCrossProduct [-_yy, _xx, 0];  
 _rpg setVectorDirAndUp [_dir, _up]; 
_rpg setVelocity (_dir vectorMultiply 200);
#

Just create a flare "ammo" instead of rpg

#

And of course, it should fire up, not at something. So it's simpler

harsh vine
#
addction1 = [

    stan1,                                            // Object the action is attached to
    "CASH TRANSPORT ",                                        // Title of the action
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",    // Idle icon shown on screen
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unloaddevice_ca.paa",    // Progress icon shown on screen
    "_this distance _target < 3",                        // Condition for the action to be shown
    "_caller distance _target < 3",                        // Condition for the action to progress
    {},                                                    // Code executed when action starts
    {},                                                    // Code executed on every progress tick
    {[] execVM "STAND1.sqf";
    [stan1,addction1] call BIS_fnc_holdActionRemove;
    },                // Code executed on completion
    {},                                                    // Code executed on interrupted
    [],                                                    // Arguments passed to the scripts as _this select 3
    1,                                                    // Action duration [s]
    10,                                                    // Priority
    false,                                                // Remove on completion
    false                                                // Show in unconscious state 
] remoteExec ["BIS_fnc_holdActionAdd", 0, stan1];    // MP compatible implementation

how comes hold addaction remove doesnt work?? i put it in code completion just to see if it will work .

obtuse quiver
#

I mean randomly? Without an event?
@little raptor i used triggers, thanks for the script tho i'll try it!

little raptor
#

@harsh vine if you set the

// Remove on completion

part to true it will be removed automatically

exotic flax
#

or change the completion code to

params ["_target", "_caller", "_actionId", "_arguments"];
[] execVM "STAND1.sqf";
[_target,_actionId] call BIS_fnc_holdActionRemove;
little raptor
#
addction1 = [

    stan1,                                            // Object the action is attached to
    "CASH TRANSPORT ",                                        // Title of the action
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",    // Idle icon shown on screen
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unloaddevice_ca.paa",    // Progress icon shown on screen
    "_this distance _target < 3",                        // Condition for the action to be shown
    "_caller distance _target < 3",                        // Condition for the action to progress
    {},                                                    // Code executed when action starts
    {},                                                    // Code executed on every progress tick
    {[] execVM "STAND1.sqf";},                // Code executed on completion
    {},                                                    // Code executed on interrupted
    [],                                                    // Arguments passed to the scripts as _this select 3
    1,                                                    // Action duration [s]
    10,                                                    // Priority
    true,                                                // Remove on completion
    false                                                // Show in unconscious state 
] remoteExec ["BIS_fnc_holdActionAdd", 0, stan1];    // MP compatible implementation

or what Grezvany13 said

harsh vine
#

i knw how to do that ... i was trying to see if if would work, and it still doesnt work while using the script.

timid niche
#

Can you enable buttons while being in animation/playing move?

young current
#

depend on animation and method of animating

timid niche
#

Okay well what way allows you to then?

fair drum
#

question:

Automatically fail the mission once all players are dead (for NONE, BIRD, GROUP and SIDE respawn types) or when all respawn tickets are exceeded (for INSTANT and BASE respawn types with Tickets template)

will this fire when tickets reach 0 even if there are players still alive? or will it only fire once all players are dead AND tickets reach 0

winter rose
#

I believe the latter

little raptor
#

@timid niche What do you mean by enable buttons? Buttons are not disabled. (?!)
If you mean like move around and stuff, no, you can't (at least not while the current move is in progress).

hallow mortar
#

What's the correct lock command for locking the copilot seat of an unarmed helo? Is it a cargo seat or a turret?

winter rose
#

I suppose it is locking a turret

hallow mortar
#

It seems that is the case

vague geode
#

Is there a way to reload a weapon instantaneously (without reloading action or waiting period)?

little raptor
#

Remove the weapon, then readd it (don't forget the attachments!)

#

You'd have to remove one of the compatible mags from the unit's inventory as well

#

If you want a "cheat-like" reload, just use

unit setAmmo [weapon, 1e9]
exotic flax
#

setAmmo will refill the current magazine instantly

little raptor
#

This method doesn't work on Launchers tho

#

The "remove weapon, then readd" method does

obtuse quiver
#

hey guys, i wanted to finish a mission once a cache is destroyed, i think i need to use these two scripts

if (!alive cache1) exitWith {};

"SideScore" call BIS_fnc_endMissionServer;

But i don't know how :/ (p.s. i wanted to get into scripting in arma, any guide?)

little raptor
#

no

#

That's not how you do it

#

Add a "killed" event handler to the cache.

#

Once it's dead, end the mission

obtuse quiver
#

what's that?

#

ok

obtuse quiver
#

thank you

little raptor
#

As for guides, there are several on the forums and Armaholic

obtuse quiver
#

thanks! i will check them out

little raptor
#

And this is from the wiki

#

Read the links on that page

obtuse quiver
#

will do!

little raptor
#

Especially "Terms"

#

For Editing, use Notepad++ and the SQF plugin

obtuse quiver
#

i will read all of them, notepad++ is my jam

little raptor
#

Do you know any programming?

obtuse quiver
#

no but i know some few things inherent to each other

#

yeah let's say no

little raptor
#

If you did it would be a lot easier.

#

But it won't be difficult either

obtuse quiver
#

let's see, first i'll read some scripting and if i don't understand im going to read some guides about programming

winter rose
#

scripting mostly, programming logics are not needed at first

obtuse quiver
#

oki doki

little raptor
#

I used the "Focker's guide" when I started. It wasn't bad for starters I'd say

obtuse quiver
#

im writing everything down so launch everything at me

winter rose
#

*throws bugs at @obtuse quiver*

little raptor
#

The two links I gave you are good starting points

obtuse quiver
#

a software bug or a literal bug?

winter rose
obtuse quiver
#

thanks really helped!

winter rose
#

like, how they are already? ๐Ÿ˜„

#

(except for Functions)

#

sorry, how do you mean?

#

pin something in this Discord or make a wiki page?

#

well two of the three you mentioned are pinned, but you mean one message with them all, right?

little raptor
#

Derp

#

๐Ÿ˜…

#

I didn't notice them!

#

sorry

winter rose
#

np, I really didn't get what you meant ๐Ÿคฃ

fair drum
#

Can I get a code check? Just want to make sure I have the right idea about updating a global variable then making it public to the server so it votes can be tallied later.

https://sqfbin.com/elolovadaqazuhugipok

jagged mica
#

I made a quick video on arma scripting, is it a good place to post it ? ๐Ÿ˜‚

fair drum
#

i don't see why not. maybe the armadev subreddit might be better since many new mission makers frequent there first? @jagged mica

#

plus, that juicy karma

jagged mica
#

Juicy karma indeed

#

good call

#

I'll leave the link here too though

fair drum
#

is it beginner or veteran

jagged mica
#

it's hard for me to judge tbf, but I think it's rather beginner-ish

fair drum
#

id lean more towards reddit then, heck, even the normal arma subreddit. Go ahead and post it here first that way the vets can give feedback or request changes that way you have the most up to date info

jagged mica
#

Gotcha, thanks

#

cheers

winter rose
#

@fair drum why the need to make _voted a string, especially if it is to store "false" or "true" in it? ๐Ÿคจ

fair drum
#

i think it was left over from the condition of the addAction... I was trying "voted == true" and I kept getting comparison errors

winter rose
#

wait, _voted and voted ๐Ÿ˜

fair drum
#

and i got frustrated and just turned to to true period

#

what do you mean and? It should all be global so that I can change it within the inside scope

#

did I miss one?

#

I did...

winter rose
#

params ["_target","_caller","_actionID","_arguments"];
_voted = _this select 3;
#

also, _this select 3โ€ฆ
is _arguments

fair drum
#

yeah I think that was when I was trying to keep it all local but had trouble updating _voted from within the addaction scope.

#

cause I wanted the second addAction to see the _voted from the first one

winter rose
#

also, please indent >.<

fair drum
#

what do you mean? Maybe its a view difference when I copy it over from VSC?

#

too big of spaces?

winter rose
#

no, just your if isServer that is lacking one level

fair drum
#

oh probably cause I added it after I realized i needed it lol