#arma3_scripting

1 messages ยท Page 746 of 1

open fractal
#

I believe it can also be found in the virtual arsenal from the main menu

#

just click the garage icon once you're in it

grim cliff
#

nto quite what i meant. im looking for the pylon editor thing

open fractal
#

oh

grim cliff
#

i used it before but i cant remember how to get there

open fractal
#

is it not in the right-click context menu?

grim cliff
#

of the #den editor?

open fractal
#

yeah

still knoll
#

double click the placed aircraft

#

it's under object pylon setting

grim cliff
#

im dumb

#

its been in the attreibutes

#

i cant read with a headache, sorry

#

is there any way i can copy the heli to a clipboard to use in a script

still knoll
#

assign it to a variable, use the object's init field
HELICOPTER = this;

#

or assign it a variable name

grim cliff
#

ok so heres my dilema now. how can i attach missile_at_03_fly_f.p3d to a heli to act as a dummy rocket so i can detect if it is hit by a bullet to make it blow up to take the helicopter down in the mission that i am making

#

correction. if i create M_Scalpel_AT with create vehicle it creates A LIVE MISSILE and i dont want that. how can i make it an inert object?

open fractal
#

it might not allow you to attach it to and move it with the helicopter

grim cliff
#

i cant even get model info out of getmodelinfo

#

to use with that command

open fractal
#

sorry, model name

grim cliff
#

from the config veiwer

open fractal
#

what vehicle fires it?

noble zealot
#

To ensure that the path generated by calculatePath is on the street, can I combine forceFollowRoad command with it?

open fractal
#

["missile_at_03_fly_f.p3d","a3\weapons_f\ammo\missile_at_03_fly_f.p3d",true] @grim cliff

#

I just slapped ```sqf
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
copyToClipboard str (getModelInfo _projectile)
}];

#

it also attaches and moves

#

unfortunately because it is a simple object it will not take damage

little raptor
#

You have to create an agent yourself and issue the path to this agent instead, and use PathCalculated EH

grim cliff
#

@little raptor can i pushback the results of weaponitemscargo into the first slot of this array:

[[],[],["hgun_Pistol_heavy_01_green_F","muzzle_snds_acp","acc_flashlight_pistol","optic_MRD_black",["11Rnd_45ACP_Mag",11],[],""],["U_B_FullGhillie_lsh",[["FirstAidKit",3],["11Rnd_45ACP_Mag",3,11]]],["V_PlateCarrierGL_wdl",[["HandGrenade",2,1],["130Rnd_338_Mag",2,130]]],["B_Bergen_tna_F",[["Medikit",1],["optic_NVS",1],["HandGrenade",4,1]]],"H_HelmetO_ViperSP_ghex_F","",["Laserdesignator_03","","","",["Laserbatteries",1],[],""],["ItemMap","B_UavTerminal","ItemRadio","ItemCompass","ItemWatch",""]]

so that i can use results in setunitloadout

grim cliff
#

nevermind. i used the set command to pushback the items i need after filtering them through a switch.
in the interest of simplifying the cod, is there a way that i can flat out check if a weapon goes in your primary or tirtiary weapons slot

#

this code runs on Killed event so i want it to be seamless. currently just collecting the players weapons off the ground takes 33 lines and 901 characters
i want to know if i can cut about 20 of those lines

grim cliff
#

please somebody tell me that i can delete a body from a vehicle

willow hound
tough abyss
#

Anyone know how to disable Ace fall damage?

limber panther
#

Thanks

noble zealot
#

Thanks

distant oyster
torpid pewter
#

Got a quick question, within an array say i have 3 classnames so [classname1, classname2, classname3] . Is there a way that for any given classname I can select between an arbitrary amount of classnames?

For example something like this [classname1 OR classname 2, classname3, classname4] so that way for the first element it'll pick between classname1 and 2, but the rest are un affected. For my purposes, simply adding another element is not desired.

fair drum
earnest finch
#

hi guys, maybe a bit off topic question but i have no experience with game dev. Is it possible to read some info like vehicle speed or something like that from the game without need to somehow modify the game with mods?

#

what i mean is to process data with external software

fair drum
earnest finch
#

Do you mean current speed in game? Or just max speed of vehicle. To be clear i am thinking about making software to read values such as speed rotation and position of vehicles and translate that to visual representation on second monitor. For example when flying heli to show its current speed value with fancy graphics on second monitor.

fair drum
#

you can do either

earnest finch
#

so you think this is possible to make? I have no experience with this so can this be done without affecting game so you can play on any online server without some type of mod?

rare ether
#

hello, does anyone know if i can toggle the jump lights in an rhs c130 via script?

fair drum
#

its possible yes, to send the information out of the game, but to get through battle eye is another issue

earnest finch
#

ok thank you for help

winter rose
grim cliff
# winter rose so what will you use?

well currently what i have in the debug console that IS NOT working:

player addEventHandler ["Killed", {  
  body = _this select 0;  
  [body] spawn   
  {  
   waitUntil { alive player };  
   body = _this select 0; 
   if (vehicle body != body) then [{ 
 VBDY = vehicle body; 
 VCHK = VBDY getCargoIndex body; 
if (VCHK != -1) then { 
VBDY deleteVehicleCrew body; 
}; 
},{};  
 }  
];
fair drum
#

also, don't use global variables like body in this. use private _body = blah

grim cliff
grim cliff
fair drum
#

the , {}; is what is throwing the error

#

are you using a linter to look at your code?

#

cause that's what its throwing for me

grim cliff
#

Linter>?

#

i think i already found the issue though

#

hear me out

winter rose
#
this addEventHandler ["Respawn", {
    params ["_unit", "_corpse"];
    if (vehicle _corpse != _corpse) then
    {
        vehicle _corpse deleteVehicleCrew _corpse;
    }
    else
    {
        deleteVehicle _corpse;
    };
}];
grim cliff
#

yeah i had that part but i stripped it so i could focus. im high functioning autis, so extra stuff in what im tying to work out is extra noise that make it difficult for me

#

so vehicle _corpse returns the same as corpse.

#

so i loed up a command i read a while ago called objectparent.

#

and now the vehicle is returned

#

so i can use delete vehicle crew.

#

if the player is not in a vehicle the return is <Null-object>

winter rose
grim cliff
little raptor
cold cloak
#

Could anyone help me with a equipment randomizing script?

copper raven
cold cloak
#

gotta love when the official arma discord doesn't have answers

fair drum
#

or have you not started yet?

cold cloak
fair drum
cold cloak
#

Kinda prefer the first to be honest

fair drum
#

ill give you a framework but you'll have to edit what you want in it tho. about to head to dinner though.

cold cloak
#

Aight, sounds good :)

fair drum
cold cloak
#

Just uniforms, vests, headgear

#

Anyways, it's 1am for me so i'll talk to you later

fair drum
#

kk ill get on it when i get back

#

should only take a couple of min

rare oasis
#

Can someone please help me with a flight record path script thing i'd really like some help, and is there a way to show the script without filling up the entire chat cause its a bit long? The error that pops up is as follows

'...= _this select 1;
_totalFrames = (count |#|_capturedFireData);

and theres more code but i dont think its relevant

willow hound
#

That's the error position, but what's the error message?

rare oasis
#

you mean the text that appears after it? sorry i dont usually mess around with this stuff.

#

_startedTime = time...'
Error Undefined variable in expression: _capturedfiredata
File A3\function_f\scenes\fn_UnitPlayFiring.sqf..., line 36

#

that it?

willow hound
#

Yes.

rare oasis
#

sure

#

so

#

do you got a diagnosis

willow hound
#

I'll need the link to your script on sqfbin first so I can look at it ๐Ÿ™‚

rare oasis
#

like a link to the sqfbin with my code

#

sorry that wasnt right

#

give sec let me figure out how this works

willow hound
#

https://sqfbin.com/about.us:


How To Use
Enter or paste your code, click "Save", and then copy the URL. Send that
URL to someone and they'll see what you see.
To make a new entry, click "New" (or press 'CTRL + N' on your keyboard).
rare oasis
#

there we go

willow hound
#

You forgot an underscore here (it should be _firingdata):

[heli1, firingdata] spawn BIS_fnc_UnitPlayFiring;
rare oasis
#

thank you so much

#

ill go fix it

opal zephyr
#

Having problems with editable objects, trying to remove a list of objects for each curator. It does nothing.

removeObjects = {
  {        
    _x removeCuratorEditableObjects [[objects],false];
  } foreach curators;    
};
fair drum
opal zephyr
#

I do call removeObjects under a onEachFrame. I know that portion works because my other functions call just fine

#

I can send it all, just figured it would fill up the chat

fair drum
#

what did you store in curators

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
fair drum
#

please use

opal zephyr
#

    FrameTick = 150;
    frameCounter = 0;
    
    
    
    
    grab_allCurators = {
    
        curators = allCurators
    
    };
    
    grab_editableObjects = {
    
        _list = entities [["Man"], [], false, true];
        men = _list select {side _x == east};
    
    
        {
        
            objects = curatorEditableObjects _x;
                
            systemChat (format ["%1",men]);
            
            objects = objects - men;
            
            systemChat (format ["%1",objects]);
            
        } foreach curators;
        
    };
    
    removeObjects = {
    
        {
            
            _x removeCuratorEditableObjects [["tMap"],false];
        
        } foreach curators;
    
    };
    
    debug = {
    
        {
            
            _x removeCuratorEditableObjects [[objects],false];
        
        } foreach curators;
        
    };
    
    
    onEachFrame {
        frameCounter = frameCounter + 1;
        if (frameCounter >= FrameTick) then{
            call grab_allCurators;
            call grab_editableObjects;
            //call removeObjects;
            
            call debug;
            frameCounter = 0;    
        };
    };
#

thanks

fair drum
#

what is "tMap"

opal zephyr
#

that was a quick test, I named an object tMap to see if I could remove just it. It didnt work. In that code example there im not actually calling removeObjects, but I am calling debug which has identical code apart from the tMap bit

#

is it possible that zeus ehanced or achilles or something is interfering with it?

opal zephyr
#

I know one of those mods let you right click and add/remove editable objects, but I cant imagine its adding them every frame or something. So I dont see how that would interfere with it

versed leaf
grim cliff
#
player addEventHandler ["Killed", { 
  _body = _this select 0; 
  [_body] spawn  
  { 
   waitUntil { alive player }; 
   _body = _this select 0;
    removeAllWeapons player;  
    removeAllItems player;  
    removeAllAssignedItems player;  
    removeUniform player;  
    removeVest player;  
    removeBackpack player;  
    removeHeadgear player;  
    removeGoggles player; 
   _testarray = getunitloadout _body; 
   { 
   Content1 = weaponsItemsCargo _x select 0; 
   Content2 = Content1 select 0; 
   Content3 = Content2 call bis_fnc_itemtype; 
    switch (Content3 select 1) do { 
     case "AssaultRifle"; 
     case "Rifle"; 
     case "SniperRifle"; 
     case "MachineGun"; 
     case "SubmachineGun"; 
     case "Shotgun": { 
     _testarray set [0, content1];  
     }; 
     case "Launcher";  
     case "MissileLauncher";  
     case "RocketLauncher";  
     case "GrenadeLauncher": { 
    _testarray set [1, content1];  
 }; 
 default {""}; 
 }; 
  } foreach nearestObjects [_body, ["WeaponHolderSimulated"],5]; 
  player setUnitLoadout _testarray;
   if (!(isnil {objectparent _body})) then [{
  _vbody = objectparent _body;  
    VCHK = objectparent _body getCargoIndex _body;
   if (driver _vbody == _body) then {
   objectparent _body deleteVehicleCrew _body;
    player moveInDriver _vbody;};
    if (Commander _vbody == _body) then {
   objectparent _body deleteVehicleCrew _body;
    player moveInCommander _vbody;};
   if (gunner _vbody == _body) then {
   objectparent _body deleteVehicleCrew _body;
    player moveInGunner _vbody;}; 
   if (VCHK != -1) then { 
   objectparent _body deleteVehicleCrew _body;
   player moveInCargo [ _vbody, VCHK]; 
   }; 
   },{
   player setposatl [getPosATL _body select 0, getPosATL _body select 1, getPosATL _body select 2]; 
   player setdir getDir _body;
     deleteVehicle _body;1
    }];
    player setUnconscious true;
 player setCaptive true;
 player setDamage 0.9;
 player allowdamage false;
  } 
 } 
]; 
slim stag
#

Hi!

#

Sorry to bother everyone but does anyone know any ideas on how to have an enemy group spawn with a waypoint once a blufor unit has entered a trigger area?

#

I wanna have it so after you talk to an informant he sets you up and you're ambushed.

open fractal
#

and in the trigger field set to server only and write

{
_x enableSimulationGlobal true;
_x hideObjectGlobal false;
} forEach units _grp;
#

this will make every unit in the group _grp appear and carry out whatever waypoints they have

slim stag
#

Hmm.

#

Thank you.

#

How do I specify which unit doe?

fair drum
grim cliff
#

any ideas why waituntil is barfing out a genirc error for anything i put in it?

#
waitUntil { stance player == 'prone' };
21:19:56 Error in expression <"lefthand"];

waitUntil { stance player == 'prone' };
detach shield;

shield set>
21:19:56   Error position: <== 'prone' };
detach shield;

shield set>
fair drum
grim cliff
#

is the debug console a scheduled environment?

fair drum
#

no, not unless you use leo's mod

grim cliff
#

.....

fair drum
#

so you'll have to spawn it

grim cliff
#

let me guess.... while loops are scheduled too

fair drum
#

well, not necessarily, but they are typically in scheduled

#

they have an iteration cap when they are in non scheduled

#

just wrap your code in a spawn

#

if you want to use debug

#

or use Leo's Advanced Developer Tools mod

#

and hit the start in scheduled button

grim cliff
#

if i use, say.....

[player, _object] spawn {
params {"_player","_object"};
some code here
waituntil { stance player == 'prone' };
some more code
};

would this get my rocks in any environment?

fair drum
#

you want waitUntil {stance _player == 'prone'};

#

since you already are feeding it in there elsewhere

#

but yes, that's a correct way to spawn it for your debug menu

#

params needs []

#

not {}

#

@grim cliff

grim cliff
#
player addEventHandler ["Respawn", {  
 params ["_unit", "_body"];  
  
 
  removeAllWeapons _unit;    
  removeAllItems _unit;    
  removeAllAssignedItems _unit;    
  removeUniform _unit;    
  removeVest _unit;    
  removeBackpack _unit;    
  removeHeadgear _unit;    
  removeGoggles _unit;   
     
  _testarray = getunitloadout _body;   
  {   
   Content1 = weaponsItemsCargo _x select 0;   
   Content2 = Content1 select 0;   
   Content3 = Content2 call bis_fnc_itemtype;   
   switch (Content3 select 1) do {   
    case "AssaultRifle";   
    case "Rifle";   
    case "SniperRifle";   
    case "MachineGun";   
    case "SubmachineGun";   
    case "Shotgun": {   
     _testarray set [0, content1];    
     };   
    case "Launcher";    
    case "MissileLauncher";    
    case "RocketLauncher";    
    case "GrenadeLauncher": {   
     _testarray set [1, content1];    
     };   
    default {""};   
   };   
  } foreach nearestObjects [_body, ["WeaponHolderSimulated"],5];   
  _unit setUnitLoadout _testarray; 
  
   if (!(isnull objectparent _body)) then {   
    _vbody = objectparent _body;    
   VCHK = objectparent _body getCargoIndex _body;  
  if (driver _vbody == _body) then {
 //issue is here
_unit moveInDriver objectparent _body;  
  objectparent _body deleteVehicleCrew _body;  
   };
  if (Commander _vbody == _body) then {  
  objectparent _body deleteVehicleCrew _body;  
   _unit moveInCommander _vbody;};  
  if (gunner _vbody == _body) then {  
  objectparent _body deleteVehicleCrew _body;  
   _unit moveInGunner _vbody;};   
  if (VCHK != -1) then {   
  objectparent _body deleteVehicleCrew _body;  
  _unit moveInCargo [ _vbody, VCHK];   
  };   
  };   
   _unit setposatl [getPosATL _body select 0, getPosATL _body select 1, getPosATL _body select 2];   
      _unit setdir getDir _body;  
  
 
 deletevehicle _body;
  }   
   
];
#

having an issue with this..... _unit wont get in as driver and there is no error in the .rpt

#

same for commander and gunner

tough abyss
#

is it just me or is attachtorelative super buggy

#

i don't remember it being this buggy, and it causes a lot of lag too

little raptor
#

Also the farther the attached object, the more visible the movement gap (if that's what you mean by "lag")

open flume
#

anyone know a script so I can make a Vehicle more resistant? especially to AT. im trying to make a titanfall mission but the titans die in one hit from AT. As well im using Ace3 if it matters.
Preferably i would like maybe 6-8 shots to take it down as they are supposed to be menacing.
pls ping me if so XD

little raptor
open flume
#

Ive been tryin but i cant rly figure it out, only guide i found was for player dmg

little raptor
#

same goes for everything else

little raptor
# grim cliff ```sqf player addEventHandler ["Respawn", { params ["_unit", "_body"]; ...

_unit setposatl [getPosATL _body select 0, getPosATL _body select 1, getPosATL _body select 2];
why?? just do
_unit setPosATL getPosATL _body

Content1
Content2
Content3
VCHK
all these global vars can be local

Commander
gunner
these are specific seats. general seats in arma are driver, cargo, and turrets (turrets include gunner, commander, and FFV).

_unit wont get in as driver and there is no error in the .rpt
you have to remove the bodies first

#

removeAllWeapons _unit; removeAllItems _unit; removeAllAssignedItems _unit; removeUniform _unit; removeVest _unit; removeBackpack _unit; removeHeadgear _unit; removeGoggles _unit;
why do you waste so much performance when you're doing setUnitLoadout after?

austere granite
#

@little raptor is there some way you can use your Dev tools in the map view and set a global keybind for it to appear? Not sure if I'm missing something potentially obvious there

Nvm, grabbed my glasses and miraculously the "Console Shortcut key" option started showing up under the advanced tab ๐Ÿ˜„

little raptor
#

I suppose it doesn't hurt to add it to display 12 as well

hollow thistle
#

Would be nice to have debug console in briefing.

#

It might not be 12 despite being a map too.

austere granite
#

it also works in map ๐Ÿ™‚

#

"It just works" when unexpected is always nice

#

To be fair... its not perfect (Cant drag the map around and all that) but its good enough for what i need so no worries. Map doesn't block IDD 46 keybinds

still forum
little raptor
#

oh right meowsweats

#

haven't tried that feature yet ๐Ÿ˜…

austere granite
#

Is that already in?

#

And will CBA switch over?

little raptor
#

I don't thing they will

#

unlike CBA keybinding, modded keybinding needs config modification

limber aurora
#

Is there a forum or somewhere I can request help building a script?

Spent too many hours trying different things, so I need some help with it.

turbid crag
#

CBA's keybinding offers combos with ctrl, shift and alt, whereas the modded keybindings don't, do they? I checked during on the 2.06 dev branch and couldn't get it to work with a combo of ctrl+alt+anyKey, but I might have done it wrong.

still forum
limber aurora
little raptor
still forum
#

your arma profile

#

same as normal keybinds

brazen lagoon
#

@limber aurora if you post some stuff here about what you're having issues with I can help out

#

just ping me w/ it

limber aurora
#

@brazen lagoon will do!

brazen lagoon
#

are there any easy ways to determine if a classname is a backpack?

still forum
#

I think there is isBackpack=1 config entry?

#

isKindOf "Bag_Base"

#

or isBackpack=1 entry in CfgVehicles

brazen lagoon
#

@still forum does iskindof only work on objects

#

or can you do it by classname str

still forum
#

dunno, look on wiki

brazen lagoon
#

yes you can

quasi sedge
#

initplayerlocal.sqf
i want to transfer from virtual arsenal loadout system to ace arsenal on my mission

[missionNamespace, "arsenalClosed", {
profileNamespace setVariable ["Saved_Loadout123",getUnitLoadout player];
saveProfileNamespace;
    hint "Selected gear saved!"
    }] call BIS_fnc_addScriptedEventHandler;
#

onPlayerRespawn.sqf

_plr setDir (player getDir centerZONE);

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

so i change "arsenalClosed" to "ace_arsenal_displayClosed" and some error present, scipt don't working

ruby bronze
#

Question. Instead of using thisList (returns everyone inside the trigger) how can I return just the players in the player's group?

open fractal
#
_playersInThisList = []
{
if (isPlayer _x) then {_playersInThisList pushBackUnique _x}
} forEach thisList;
#

something like this?

ruby bronze
#

Here, some context will probably help us. What I have now is

call{_loadoutWeightsInfo = thisList apply { format ["<t align='left' color='#BADA55'>%1: </t> <t font='PuristaMedium' size='.8' align='left' color='#32CD32'>%2</t> <t font='PuristaMedium' align='left' size='.7' color='#696969'> %3lbs</t>", name _x, roleDescription _x, (round ((loadAbs _x) * 10)) / 10 ^ 2] };
          _loadoutWeightsInfo joinString "<br/>"};

But this lists all players inside the trigger area. I want each player to only see the other players that are in their group. I hope that makes sense.

#

Then I take that and turn it into a hint, but that part is irrelevant lol

little raptor
ruby bronze
#

For real?? I'm going to give it a try and get back to you in about 15 mins
Thank you

quasi sedge
#

no error in rpt, just previous loadout doesn't load

little raptor
prime aspen
#

Hi! Can I create ropes with different 3ds for each? I had seen the possibility in a changelogue, or I misunderstood

slate bone
#

Hi, i need a helmet with heli extraction

#

I want to make a heli whitch could take me whenever I am to point on map, like arma 2 red harvest campaign

#

Enyone know how can I do?

stone roost
slate bone
#

Heli

#

Sorry for my polish autocorect

#

:)

stone roost
#

You could add an AI pilot to the heli, and when you get in, have some kind of option to select which point you want to go to, then add a waypoint/task for the pilot's group to go to that location and drop you off

slate bone
#

I want to make much more clean, I don't want to have a pilot in my team

nocturne canopy
#

Anyone aware of a way to attach items to a tanks turret?
Similar to the attachToRelative function but turning with the turret. I'm not too fussed about it elevating with the gun though.

open fractal
slate bone
#

I want to use a map to create extracion

open fractal
#

that can be complicated

#

someone else can probably give you a better method, I would add a custom radio "extract" line, then create a function so that when the unit that used the radio call clicks on the map a marker is placed and the helicopter comes and lands

#

this would take some effort regardless of how you go about it

graceful kelp
#

anyone able to give me some insite into the incoming missile event handler, we used to thing it was always called twice so we cancelled one of them, but recently are having issuies were its anyware from 1-3

grim cliff
#

i have this code in a condition statement for an addaction

vehicle _this == _this && alive _this && lifeState cursorObject == 'INCAPACITATED' && group _this == group cursorObject && _this distance2D cursorObject <= 2.5 && ((typeof _this) == 'B_medic_f' && !('Medikit' in itemcargo _this))

and it works just fine, until i add the last part that is in the ()
is there any way that i can check to make sure that the medic doesnt have a medikit while still having the players that are not medics be able to use the action too?

still knoll
ruby bronze
#

So this works just fine. It's in the init of a crate. But rather than have to name multiple crates and change the variable name in this code (supply1, supply2, etc), is there instead a generic way to write this so I could make an unlimited number of crates with the same code? I tried replacing supply1 with this but it didn't want to work. =)

addMissionEventHandler ["Draw3D", 
{  
if (supply1 distance player > 2) exitWith {}; 
if ([supply1, "VIEW", player] checkVisibility [eyePos supply1, eyePos player] < 0.3) exitWith {}; 
drawIcon3D ["", [1,1,1,1], visiblePosition supply1 vectorAdd [0,0,.3], 0.2, 0.2, 45, "Supply", 2, 0.03, "PuristaMedium"]; 
}];
fair drum
#

and then iterate through it

warm hedge
#

Unfortunately there's no straightforward way to, say like โ€œsupplyXโ€ (there actually is tho). What Hypoxic says, also this won't work in a EH

ruby bronze
#

Thank you!

noble zealot
#

I have a set of points and I would like to calculate a smoothed line passing through them. How can I do this?

warm hedge
#

Smoothed, like bezier?

noble zealot
#

Yes

noble zealot
#

thanks

willow hound
gusty lantern
#

Hey guys, so i've created a rope from vehicle to my character code:

myRope = ropeCreate [veh, [0,0,0], me, "lefthandmiddle1"];
ropeUnwind [myRope, 3, 50, true];
me enableRopeAttach true;

and somehow my character is with the rope much faster than without. Any fix?

little raptor
nocturne canopy
little raptor
#

maybe

#

ยฏ_(ใƒ„)_/ยฏ

brazen lagoon
#

oh yes memory point

tough abyss
#

Iโ€™m learning scripting I got a helicopter crash but the one thing I want is smoke and fire effects anyway to add this?

mortal latch
#

Hey I am curious if it would be possible to change the description.ext during game to change respawn=3; to respawn=1;

distant oyster
#

you can handle your own respawn with onPlayerKilled and onPlayerRespawn scripts

low remnant
#

trying to spawn a drone a bit above a position, but

_veh= 
    createVehicle ["B_UAV_01_F", [(getPosATL _this) select 0, (getPosATL _this) select 1, ((getPosATL _this) select 2) + 10], [], 0, "FLY"];
};
``` throws  
```Error in expression _veh= 
    createVehicle ["B_UAV_01_F", [(getPosATL>
Error position: _veh= |#|createVehicle ["B_UAV_01_F", [(getPosATL>
Error Type Any, expected Number```.
Far as i can tell this is correct syntax, can anyone see/tell me what i'm missing?
low remnant
#

its being called from another object, shouldn't it be?
weird. guess _this isnt availeable here then. huh. thanks!

little raptor
#

depends how it's called and from where

misty osprey
#

any commands to determine what the current target for an AI unit is?

frail vault
#

could someone check on this code real quick?

{[objNull, _x] call ace_medical_treatment_fnc_fullHeal} forEach thisList
#

i am trying to get it to heal anyone who enters the trigger zone, but it's not doing so

misty osprey
#

I donโ€™t use ace much but couldnโ€™t you use
setDamage 0;

fair drum
#

^ no

fair drum
acoustic abyss
warm hedge
#

Not even sure if it works at all

#

Most likely this is just for Operation Flashpoint

#

What exactly is your goal?

acoustic abyss
#

My aim is to have players listen to the briefing, instead of having to read a block of text.

#

I've made a soundfile that narrates part of the briefing. And I'd like to play it, preferably, when the player clicks the appropriate briefing (eg Mission, Situation, Notes).

late parrot
#

Any help with trying to merge these two together? The objective is to have the obj complete with the text to show as well in system chat.

this addAction ["Inspect", { 
    params ["_object","_caller","_ID"];
      ["task1","SUCCEEDED"] call BIS_fnc_taskSetState; 
     _object say3D "01";
 }];
 
 this addAction ["Interact", {systemChat (selectRandom  
[ "Text1", "Text2", "Text3", "Text4" ])},  
nil, 1.5, true, true, "", "alive _originalTarget", 4, false, "", ""];
acoustic abyss
#

This of course in a MP Dedicated setting (although I suspect whatever the script is, can easily run initplayerlocal)

warped marten
#

Is there any way to draw custom overlay in Zeus view, like is done for Squads/Teams (line and e.g. BLUFOR icon on top)? I could not find any information on whether this is possible using a mod/script and what to hook into, I'd appreciate any pointers

modest temple
#

hello people I have an addaction on a laptop that switches off the lights in the ship for the briefing

#

but that apparently doesn't work in multiplayer

#

I found no examples on how to execute a .sqf file with addaction in a way that it works globally on a server

#

ยดยดยด
this addAction ["<t color='#FF0000'>On</t>",{player execVM "ln.sqf";}];

this addAction ["<t color='#FF0000'>Off</t>",{player execVM "lf.sqf";}];
ยดยดยด

#

this is what is what in the init now, how do I make that work in multiplayer?

copper raven
modest temple
#

with addaction

warm hedge
#

tldr: remoteExec and remoteExecCall do some scripts in every connected computers (you can adjust the range if you need to)

midnight niche
#

sorry to butt in,

having a blank here,

How to efficiently determine the number of specific items a player has?

tried,

_intelCount = {_x isEqualTo _intelItems} count _playerInv;```
```sqf
_intelCount = {_x in _intelItems} count _playerInv;```

_intelItems is an array of classnames
copper raven
#

in is the correct way

#

keep in mind it's case sensitive

copper raven
#

you're adding the action to this which makes me think init fields(which are run on every machine already), do you want to run the execVM on every machine or what?

modest temple
#

[this, ["Lights on", { execVM "lo.sqf"; }]] remoteExec ["addAction"];

#

would putting this on the init of the object work?

#

the lo.sqf turns on the specific lights

copper raven
#

you'd add 5 actions for every player if server had 5 players

modest temple
#

ah

#

so will that work on a server

#

what I did in the start

copper raven
#

what do you do in the sqf file exactly?

modest temple
#

l1 switchLight "ON";
l2 switchLight "ON";
l3 switchLight "ON";
l4 switchLight "ON";
l5 switchLight "ON";
l6 switchLight "ON";
l7 switchLight "ON";
l8 switchLight "ON";
l9 switchLight "ON";

#

then lf is the same but with off

copper raven
#

so remote exec the execVM

midnight niche
copper raven
#

not the addAction

modest temple
#

but I wanna exec the file with a scrollwheel action

copper raven
copper raven
midnight niche
copper raven
#

i don't see anything wrong then ๐Ÿค”

modest temple
#

I don't get how to do it

#

sorry im a pleb

copper raven
#

the same way you did with addAction, but instead execVM

modest temple
#

[this, ["Lights on", { addAction; }]] remoteExec ["execVM ln.sqf"];

copper raven
#

no, don't make stuff up

#

you just have to edit the execVM part in your initial code

#

look at the message link i sent, example with unary command

midnight niche
copper raven
midnight niche
copper raven
#

_intelItems is an array of classnames
are you sure then? meowsweats

midnight niche
copper raven
modest temple
#

like this?

copper raven
#

[player, "on"] execVM "file.sqf" >
[[player, "on"], "file.sqf"] remoteExec ["execVM"]

#

or, for example, unary execVM
execVM "file.sqf" >
"file.sqf" remoteExec ["execVM"]

modest temple
#

this addAction ["<t color='#FF0000'>On</t>",{[[player, "on"], "file.sqf"] remoteExec ["execVM"], player]; }];
?

copper raven
#

file.sqf was literally an example, it's supposed to be whatever file you want to execute

modest temple
#

yeah

#

when I put that in the init it says missing ;

copper raven
#

["execVM"], player]; , player]; part doesn't make sense

#

so delete that part

copper raven
#

so you can get rid off them

modest temple
#

I just assumed I needed to fill the arguments with something

copper raven
#

no

#

the alternative takes no arguments, arguments passed to the script (on the left)

modest temple
#

this addAction ["<t color='#FF0000'>On</t>",{"file.sqf" remoteExec ["execVM"];}];

so it is as simple as this then?

copper raven
#

no

#

originally you had: player execVM "ln.sqf";

#

we've found out that you don't need to pass arguments

#

which means, execVM "ln.sqf";

#

then we need to remoteExec this

#

execVM "file.sqf" >
"file.sqf" remoteExec ["execVM"]

#

so
"ln.sqf" remoteExec ["execVM"]

#

i really hate just giving straight solutions to people, as this usually doesn't make them learn anything ๐Ÿ˜„

#

but hope you understand all of that

modest temple
#

just need to put both of my braincells together and process this for a second

midnight niche
# copper raven `(_x in _intelItems) count _playerInv` `BOOL count ARRAY` does not exist https:/...
Result:
0.0646 ms

Cycles:
10000/10000

Code: 

_Inv = Magazines player;
_intelItems = [
    "FlashDisk", 
    "SecretDocuments", 
    "SecretFiles", 
    "Files", 
    "Laptop_closed", 
    "Money", 
    "ItemRadio", 
    "Wallet_traitor", 
    "SatPhone", 
    "SmartPhone", 
    "MobilePhone"];

if ( _intelItems findIf { _x in _Inv} > -1) then {
    _a = {_x == "FlashDisk"} count _Inv;
    _b = {_x == "SecretDocuments"} count _Inv;
    _c = {_x == "SecretFiles"} count _Inv;
    _d = {_x == "Files"} count _Inv;
    _e = {_x == "Laptop_closed"} count _Inv;
    _f = {_x == "Money"} count _Inv;
    _g = {_x == "SatPhone"} count _Inv;
    _h = {_x == "SmartPhone"} count _Inv;
    _i = {_x == "MobilePhone"} count _Inv;
    _total = _a + _b + _c + _d + _e + _f + _g + _h + _i;
    systemChat (format ["You hand over %1 Intel items.", _total]);
} else {
    systemChat "You have no intel items to handover!";
};```

It ain't pretty but it works, I'm sure there's a more line efficient method, but I'll leave that for a later date
copper raven
#

?

#

use in

#

(_x in _intelItems) count _playerInv you used wrong brackets here, your left argument evaluates into a boolean, not code

mystic shell
#

Hi, having trouble with the following:

null = Stone addAction
["<t color='#FF0000'>START MUSIC!</t>",
{playSound3D [getMissionPath "sfx\Music.ogg", [S1, S2, S3, S4, S5, S6, S7, S8, S9, S10]]; Stone removeAction (_this select 2);}]
spawn BIS_fnc_MP;

I'm not getting any errors, the description.ext is sound:

//Custom Sounds
class CfgSounds
{
sounds[] = {};

class Music
{
    name = "Music";
    sound[] = { "sfx\Music.ogg", 10, 1, 100};
    titles[] = {};
};

};

and the folder in the mission file and the file are named correctly and in the correct .ogg format.

For some reason when the addAction is activated, nothing happens...

acoustic abyss
mystic shell
#

I didn't have that on, let me restart real quick

mystic shell
little raptor
#

2nd of all, as far as I remember the playSound3D syntax, yours is wrong

mystic shell
little raptor
#

What you wrote is wrong

mystic shell
#

care on being more specific?

#

As for the Syntax, I'm using what's available on the biki as a template

acoustic abyss
#

...

#

Does the playSound3D syntax work locally?

mystic shell
#

nope

acoustic abyss
#

And again, didya open the RPT file when you fired it in Eden Editor Debug console?

acoustic abyss
#

%localappdata%\Arma 3

little raptor
#

the syntax is wrong

#

as for BIS_fnc_MP, you're doing: Stone addAction [...] spawn BIS_fnc_MP

#

which is wrong

little raptor
#

not playSound3D [string, array], which is what you have

mystic shell
#

it's not supposed to be an array, it's supposed to be multiple objects

little raptor
#

it is an array

#

what do you think [] means?

mystic shell
#

I'd rather help from someone else, you're not even trying to be constructive.

little raptor
#

ok

#

ยฏ_(ใƒ„)_/ยฏ

mystic shell
warped abyss
#

i guess insulting people that use their time giving you tips about solving your problems is never the right way.
if he wouldnt try to help you he wouldnt even talk to you

mystic shell
warped abyss
#

my friend you are the one insulting others and no one else here

#

doesnt make a good impression of you

mystic shell
#

k

#

removed it.

acoustic abyss
#

I don't think it's that black and white. But if people wanna talk anything else than scripting, we'll go to another channel.

#

You find the RPT yet?

mystic shell
#

no, sorry. I've never done that before so I haven't even found the debug console yet

#

I did enable the log thing in the launcer, like you said

acoustic abyss
#

Ha! Bub, you are jumping into the deep end with playing sounds and multiplayer scripting.

mystic shell
#

quickest way to learn, right?

warped abyss
#

nothing is quick in arma :]

#

sadly

acoustic abyss
#

Didya do algebra before arithmetic in school? ๐Ÿ˜„

#

Pardon.

mystic shell
#

lol, true

#

I've never had to use the debug before because usually I'd have a friend help me

#

but he's on deployment so I can't really ask him anymore

#

is the debug the console when I run the mission and press esc?

acoustic abyss
#

Before bumping into other people on this channel and getting another headup from the wizards, I'd recommend two sources for popular things (like ingame sounds)

  • Youtube
  • The BI forums (for example code you can copy+paste)
acoustic abyss
#

Sorry about the timing but I gotta run. Goo dluck

mystic shell
warped abyss
#

yeah debug console and unit init are the ways to go iirc

#

otherwise @mystic shell there are a few interesting links and so on in the pinned messages if you havent seen them yet

mystic shell
#

I'll have a look, thanks

#

Assuming you mean the intro to SQF and others?

warped abyss
#

exactly. using the debug console will most likely end in some more scripting and sqf is the way to go for that

warped marten
#

I want to attach a "Killed" event handler to any OPFOR unit, no matter how it was spawned in (MP; Zeus can spawn, scripts may spawn). What is the best way to go? One solution I tried was using a loop every couple of seconds, getting all units via units opfor, but that would repeat the event handler addition on all non-new units. I could not find unique IDs or similar for non-player units.

acoustic abyss
warped marten
little raptor
warped marten
#

Ah thanks, I had not thought about get/setVariable in this context. And of course you are right, I need to use MPKilled. Very helpful! ๐Ÿ™‚

opal sand
#

how long does it take to learn scripting? or just to learn and create 1, or 5 working scripts?

still forum
#

Depends on how good you are at learning and what prior experience you have

#

between an hour or two, and weeks (including hospital visit because you banged your head against your table too hard)

Also "1 or 5 working scripts" is so unprecise. What scripts?
A script can be a one-liner teleport player to other position script. Or a 2000 liner MP gamemode.

young current
#

lifetime.

winter rose
#
player setDamage 1
```do it 5ร— and you're good to go
warped marten
warped marten
#

Do you know of any mod using that of the top of your head? I will dive deep, thank you!

little raptor
#

if you've ever created GUIs before the basics are the same

warped marten
#

I did, but I have no mental model of how to have an element "connected" to an on-screen element (do I have to move/set position or is there a mechanism), instead of having it static on screen

little raptor
#

you can convert world coords to screen coords via worldToScreen

warped marten
hollow lantern
#

what's the way of programmatically get units in an existing trigger?

little raptor
#

list _trigger/thisList

hollow lantern
#

thanks list seems usable. I wonder how you would use the magic variable in a script since the wiki does not really state if thisList can be directed towards a specific trigger

little raptor
half moon
#

Hmm.. I've been trying to have a trigger condition with OR value, so the trigger can activate when any of the three variables (units) are present. I put:
(sl1 in thisList OR sl2 in thisList OR sl3 in thisList) and also tried it without the () and with two | instead of "OR". Isn't working

#

Any clues? Probs something very basic

slender beacon
#

Can I use BIS_fnc_stringToMarker in Eden?

little raptor
#

also using inAreaArray might be faster here

#
this && {count ([sl1, sl2, sl3] inAreaArray thisTrigger) != 0}
little raptor
slender beacon
#

getting players to mark things in-game and seeing/editing them in 3den

#

part of a persistence script I made, trying to make it into Eden to change the procedures a bit

#

As I'm bound to a dedicated server and cannot save operations, and it's cool to be able to change the progress or adapt the mission to it in Eden

little raptor
#

you might see the marker in Eden, but not in mission

slender beacon
#

That makes sense

little raptor
#

you can write your own script based on that function that works in 3den

slender beacon
#

yeah

#

Thanks

digital rover
paper jay
#

Does anyone know of a way to ignore weight carry limit with ACE?

paper jay
#

Found a function that does excatly what I'm looking for

[_resupplyCrate, true, [0,2,1], 0, true] call ace_dragging_fnc_setCarryable;
opal zephyr
#

Revisiting this, I cant seem to figure out whats wrong with it. Its grabbing all the editable objects for each curator, then subtracting anything with the class "Man" and then it should be removing the objects from the list of editable objects, but the objects remain editable via zeus.... Any help is greatly appreciated. So far all I can think of is a conflict with Achilles or eden enhanced or something


    FrameTick = 150;
    frameCounter = 0;
    
    
    
    
    grab_allCurators = {
    
        curators = allCurators
    
    };
    
    grab_editableObjects = {
    
        men = entities [["Man"], [], false, true];
    
    
        {
        
            objects = curatorEditableObjects _x;
                
            systemChat (format ["%1",men]);
            
            objects = objects - men;
            
            systemChat (format ["%1",objects]);
            
        } foreach curators;
        
    };
    
    removeObjects = {
    
        {
            
            _x removeCuratorEditableObjects [[objects],true];
        
        } foreach curators;
    
    };
    
    debug = {
    
        
        
    };
    
    
    onEachFrame {
        frameCounter = frameCounter + 1;
        if (frameCounter >= FrameTick) then{
            call grab_allCurators;
            call grab_editableObjects;
            call removeObjects;
            
            //call debug;
            frameCounter = 0;    
        };
    };
graceful kelp
#

your misssing a ; on curators = allCurators

#

that might be issuie

opal zephyr
#

Unfortunately that doesnt seem to be it, it looks like that line was working correctly even without the ; which is weird...

#

The systemChats I use in this code both output the correct data, so I know the items are added to objects correctly

graceful kelp
#

also the _objects will only contain the objects of the last curator in the array

opal zephyr
#

hmm thats true, I only have one curator right now so that shouldnt affect it for the time being. If a curator adds an item to editable objects, doesnt it get added for all curators? Making the list the same?

graceful kelp
#

as far as im aware its local otherwise you could just do
objects = curatorEditableObjects _x#0;

opal zephyr
#

^what does the #0 do?

graceful kelp
#

selects the 1st index in the array

#

here

FrameTick = 150;
frameCounter = 0;

grab_allCurators = {
    curators = allCurators;
    men = entities [["Man"], [], true, true];
    {
        objects = curatorEditableObjects _x;
        objects = objects - men;
        _x removeCuratorEditableObjects [objects,true];
    } foreach curators;
};

onEachFrame {
    frameCounter = frameCounter + 1;
    if (frameCounter >= FrameTick) then{
        call grab_allCurators;
        frameCounter = 0;    
    };
};
#

that will work with multiple curators

#

that being said that would need to be initialized local on all clients with curator

opal zephyr
#

Im not familiar with scripting for servers, I know some things can be different. Why does it have to be initialized local?

graceful kelp
#

because the grab_allCurators will only be local to were it was init

#

1 sec

#

changed it

#

you can stick that anyware and that should work

opal zephyr
#

making the function public makes it work for calling on the server?

graceful kelp
#

if you stick that script in the mission init that should work for all curators

#

or anyware really

#

it makes the script available to all players

opal zephyr
#

And it would work on a dedicated server for example?

graceful kelp
#

actualy you dont evan need that bit

#

stick it in the mission inti should work

#

this script itself isint that intensive either you could have that run every frame

opal zephyr
#

Thanks for your help, im making these in singleplayer and then will be converting it to work in a multiplayer environment. Now I just gotta figure out why the actual script isnt working haha

graceful kelp
#

it worked for me

#

it removed all object except players

opal zephyr
#

let me try what you posted

#

jeez it worked

#

so where do you think mine went wrong?

graceful kelp
#
grab_allCurators = {
    curators = allCurators;
    men = entities [["Man"], [], true, true];
    {
        objects = curatorEditableObjects _x;
        objects = objects - men;
        _x removeCuratorEditableObjects [objects,true];
    } foreach curators;
};

onEachFrame {
    call grab_allCurators;
};
#

no idea

#

i just reformated

opal zephyr
#

well thankyou again, you've been incredibly helpful!

graceful kelp
#

also the script took 0.0014ms to run

#

you dont need the wait counter

opal zephyr
#

ooo thats a useful piece of info, where do I check its time

#

Im clearly new to scripting lol

graceful kelp
#

in debug menu on the left is a perf button to evaluate script

#

so you have the local button, 3 buttons to the left

opal zephyr
#

would the time it takes to perform it be a accurate way to measure the performance cost of running the script?

graceful kelp
#

not always

#

because it uses values at that moment which for eg
1 curator
and only a handfull of objects

opal zephyr
#

mine took 0.003ms haha

graceful kelp
#

in a mission 3-4 curators & thosands of objects maybe

opal zephyr
#

understandable

graceful kelp
#

that being said since your removing them 99999/100000 times the object count is only the players

opal zephyr
#

Im just calling the script like I do in a trigger for example in that debug console right?

graceful kelp
#

mission init would work fine

opal zephyr
#

I mean to check its run time

graceful kelp
#

dont know how to check time on a server

opal zephyr
#

this is what ive written in the debug console "call J3FF_fnc_editableObjects"

graceful kelp
#

but you shouldnt need to

#

in any init field place the script, it only needs to be called once
but for a mp mission, should be placed in mission.init

little raptor
little raptor
#

you're not really running anything. that's why

opal zephyr
#

Can you elaborate on that?

little raptor
#

you're only measuring the performance of:

  1. creating a global var grab_allCurators
  2. creating the each frame loop
#

ofc it practically takes no time

opal zephyr
#

oh ok, is there a way to see how long it actually takes?

little raptor
#

measure the performance of the function itself

#

call grab_allCurators;

opal zephyr
#

ah ok, and id have to do that for each and then add them up to get the total time?

little raptor
#

just write them one after the other

opal zephyr
#

writing just "call grab_allCurators;" came back with 0.0007ms

little raptor
#

you hadn't defined it then

opal zephyr
#

im not sure what you mean

little raptor
#

the var wasn't defined

opal zephyr
#

oh, hold on, I made a mistake

#

ok it came back with 0.0328 this time
For this:

#
remove_Objects = {
    
        //Gets curators and gets seperate lists of all vehicles and men
        curators = allCurators;
        men = entities [["Man"], [], true, false];
        veh = entities [["allVehicles"], [], false, false];
        veh = veh - men;
        
        occupiedVeh = [];
        
        
        //Determines if vehicles have crew in them to decide if they should be hidden or not
        {
        
            manPresent = fullCrew [_x, "", false];
            
            if !(manPresent isEqualTo []) then{
                occupiedVeh pushback _x;
            };
            
        } foreach veh;
        
        
        //Adds all men and all occupied vehicles to new array to make them exempt from list of objects to hide
        voidObjects = men + occupiedVeh;
        
        
        //Checks which objects the curator can currently edit and then makes them uneditable (keeping occupied vehicles and player editable)
        {
        
            objects = curatorEditableObjects _x;
            objects = objects - voidObjects;
            _x removeCuratorEditableObjects [objects,true];
            
        } foreach curators;
        
    };
little raptor
#

Why do you use so many global vars...oof meowsweats

opal zephyr
#

do they have any affect on performance or something?

warm hedge
#

Could be easily overwritten, unexpectedly and accidentally.

opal zephyr
#

I normally have multiple functions being called with variables between them, so using globals has been useful for that

little raptor
#

Why do you use entities?

opal zephyr
#

hmm I guess I didnt think of it, It looks like it doesnt include dead units though, which I need

bronze temple
#

Trying to make a custom sound click for a gui but the sound simply does not play

#
        class settingsButton: CBX_RscButtonInvisable
        {
            idc = 2404;
            onButtonClick = "[] call life_fnc_settingsMenu;";
            soundEnter[] = {"",1,1};
            soundPush[] = {"",1,1};
            soundClick[] = {"\sounds\pbclick",1,1};
            soundEscape[] = {"",1,1};    
            x = 25.15 * GUI_GRID_W + GUI_GRID_X;
            y = 19 * GUI_GRID_H + GUI_GRID_Y;
            w = 2.54433 * GUI_GRID_W;
            h = 2 * GUI_GRID_H;
        };
#

Here's one of the classes and pblclick is a .wss in the sounds folder

warm hedge
#

With/without the first \ and .wss extension?

bronze temple
#

this is the default

#
    soundEnter[] = 
    {
        "\A3\ui_f\data\sound\RscButton\soundEnter",
        0.09,
        1
    };
    soundPush[] = 
    {
        "\A3\ui_f\data\sound\RscButton\soundPush",
        0.09,
        1
    };
    soundClick[] = 
    {
        "\A3\ui_f\data\sound\RscButton\soundClick",
        0.09,
        1
    };
    soundEscape[] = 
    {
        "\A3\ui_f\data\sound\RscButton\soundEscape",
        0.09,
        1
    };
#

These are .wss's in the files

warm hedge
#

Make sure the name is correct. pbclick or pblclick?

bronze temple
#

pbclick

warm hedge
#

Double check time

bronze temple
#

ree cant post image

warm hedge
#

You don't need to. I didn't asked you to post it

bronze temple
#

but yeah is correct for the mission file

warm hedge
#

It is possible that the sound is playing with just a low volume perhaps

bronze temple
#

I've cranked my volume to max and not even a fairy's fart of audio

warm hedge
#

How did you make the wss?

bronze temple
#

Maybe it would help to define CT_SHORTCUTBUTTON

#

Through arma tools

#

Did not help

bronze temple
#

I wonder

#

Is it cause the UI changes so fast

#

Is there anyway to make it sleep before it executes the function

#

put sleep 1; in the function will see how it works

#

grrr didnt work

bronze temple
#

why wont it just be simple AND DO THAT THING

#

Even resetting it to defaults, the sound doesnt work

warped abyss
#

Itโ€™s ArmA

gloomy aspen
#

Hey guys, could anybody who is fluent in RPT tell me what this might be alluding to?


 9:37:18 (CAV) [RANGES] LOG: UpdateUI: ["rr","shooter"] - [] - C:\Users\44746\Documents\Arma 3 - Other Profiles\Stirling\missions\AsDesigned.VR\cav_ranges\fnc\fn_updateUI.sqf:195
 9:37:18 Error in expression < 1]]} else {
_shooter = _shooterPlayers select _forEachIndex;
if(!isNil "_shoote>
 9:37:18   Error position: <select _forEachIndex;
if(!isNil "_shoote>
 9:37:18   Error Zero divisor**

winter rose
#

_shooterPlayers select _forEachIndex โ† _shooterPlayers may not be big enough

gloomy aspen
#

That would make sense, the visual error caused by the script error means the GUI that displays _shooterPlayers is not as big on screen as it needs to be

warm hedge
#

Error Zero divisor can happen when the select operation tried to look a bigger number than the array's count

#

...But the Zero divisor part doesn't make sense to me, actually. It's a badly named error

acoustic abyss
#

Is it supported to define multiple sounds in description.ext CfgSounds from a single (.ogg) soundfile? I'm trying to vary the volume of a sound played client-side.

winter rose
acoustic abyss
#

Yes I meant the first one ๐Ÿ˜…

#

Trying to achieve my question in the #arma3_audio channel. Figured that varying playback volume of an original and static sound played simultaneously would be simplest. I wonder how other mods/scripts make signal attenuation audio effects. ๐Ÿค”

brazen lagoon
#

anyone got suggestions for a loadout shop type thing? Basically I want to have a shop where you can unlock vehicles and respawn loadouts. does something similar to this exist (you have a bunch of classnames shown with prices, and then you can execute code on them when purchased) or am I going to have to do it myself?

swift gale
#

Hi, i'll have a little question:
I want to spawn the USS Liberty via Script, but for some reason, it keeps getting spawnd at the ground of the See, is there some special trick to spawn it?
I'll spawn it like this:

_data = [
    ["Land_Destroyer_01_base_F", [18169.2,28919,0], [[-0.334915,0.942248,0],[0,0,1]]]
];
private _objects = [];
{
    _object = createSimpleObject [(_x select 0), (ASLToAGL(_x select 1)), true];
    _object setVectorDirAndUp (_x select 2);
    _object setPosASL (_x select 1);
    _objects pushBack _object;
} forEach _data;
brazen lagoon
#

is setposasl the right one for this?

#

sec.

swift gale
#

tryd that already, it still sits on the ground of the see

brazen lagoon
#

I don't get it. if you do _obj setposasl [18000, 28000, 0] that should work?

swift gale
#

i thought so to, but for some reason i doesn't...

brazen lagoon
#

you tried in the editor using commands in game?

swift gale
#

startet a Mission without anything in editor

#

and try'd executing via debug

brazen lagoon
#

yes that's what you did? ok

#

@swift gale remove the asltoagl call

swift gale
#

ok, gimme a sec, gonna try it rl quick

brazen lagoon
#

createsimpleobject already takes positionasl

#

so it shouldn't be necessary

swift gale
#

yes, that is also already changed, because it needs to be simulated for the ladders XD

brazen lagoon
#

lol oops

swift gale
#

nope, still a u-boot

#

Thats the code right now

_data = [ 
 ["Land_Destroyer_01_base_F", [18169.2,28919,0], [[-0.334915,0.942248,0],[0,0,1]]] 
]; 
private _objects = []; 
{ 
 _object = (_x select 0) createVehicle (_x select 1); 
    _object setVectorDirAndUp (_x select 2); 
 _object setPosASL (_x select 1); 
 _objects pushBack _object; 
} forEach _data;
fading magnet
#

heli = [getMarkerPos "marker", 0, "CH_47F_EP1", west] call BIS_fnc_spawnVehicle; wp = (heli select 2) addwaypoint [getMarkerPos "Hpad", 10]; wp setWaypointType "UNLOAD"; wp setWaypointStatements ["true"," heli land 'LAND';"];

Can somebody please tell me what am I doing wrong? I just want to spawn a heli on trigger and make it move to "Hpad" marker and land there. It will spawn and move to Hpad but just hovers there not landing :(( I do this scripting as practice, this is my very first arma 2 script >.<

little raptor
winter rose
little raptor
fading magnet
little raptor
#

also not sure if setWaypointStatements takes a script. iirc it needs a script file

fading magnet
#

urm... I need to make another script file and use execVM?

little raptor
#

nvm it does support scripts

swift gale
little raptor
swift gale
#

placed it now in Editor, gonna take the position via getPosASL and see what it gives me...

#

still this: [18169.2,28919,0]

#

18:00:40 "### [18169.2,28919,0] ###"

#

thats the code i used to get the pos:
diag_log Format["### %1 ###",getPosASL ship];

#

and what you mean by "where you spawn it"? i mean you got the position...

little raptor
little raptor
swift gale
#

uuh, gimme a moment

swift gale
# little raptor try getPosWorld and setPosWorld

Code used
diag_log Format["### %1 ###",getPosWorld ship];
What it gave me:
18:04:58 "### [18169.2,28919,0] ###"
Ship still undersee... so how do i get the see level if ASL (Arma See Level) does not go from See level???

#

Code used to spawn:

 ["Land_Destroyer_01_base_F", [18169.2,28919,0], [[-0.334915,0.942248,0],[0,0,1]]] 
]; 
private _objects = []; 
{ 
 _object = (_x select 0) createVehicle (_x select 1); 
    _object setVectorDirAndUp (_x select 2); 
 _object setPosWorld (_x select 1); 
 _objects pushBack _object; 
} forEach _data;```
little raptor
#

are you spawning the ship in eden?

swift gale
#

i placed it in the editor where it is supposed to spawn, gave it the variablename "ship", startet the mission, executed the code
diag_log Format["### %1 ###",getPosWorld ship];

little raptor
little raptor
swift gale
#

i'll start up an empty mission, go into the Debug-Console and run it there

little raptor
#

well some of stuff you say just makes no sense to me:

  1. you say the getPosASL and getPosWorld result is the same. which is not true for objects that have a land contact (and afaik the USS Destroyer does have one)
  2. you say it spawns under the water, yet that's impossible if it's the same pos you got from editor
swift gale
#

i can stream it to you if u want, i'll just tell u what i gives me

#

but you're mor than welcome to try it out yourself ๐Ÿ™‚

little raptor
#

but the reason it spawns like that is something else

swift gale
#

what i found out, getPosATL and getPos give you diffrent Values thou
i used this code now:

diag_log Format["### %1 ###",getPosWorld ship];
diag_log Format["### %1 ###",getPosASL ship];
diag_log Format["### %1 ###",getPosATL ship];
diag_log Format["### %1 ###",getPos ship];

and got this:

18:22:45 "### [18169.2,28919,0] ###"
18:22:45 "### [18169.2,28919,0] ###"
18:22:45 "### [18169.2,28919,185.97] ###"
18:22:45 "### [18169.2,28919,0.106325] ###"
little raptor
#

the base doesn't influence the parts

#

so even if you do setPosXXX on the base, it won't affect the parts

#

what you should do is grab the parts first, and then move them relative to the base:

_data = [ 
 ["Land_Destroyer_01_base_F", [18169.2,28919,0], [[-0.334915,0.942248,0],[0,0,1]]] 
]; 
{ 
     _object = (_x select 0) createVehicle (_x select 1);
     _base = _object; 
     _parts = _base getVariable ["bis_carrierParts", []] apply {_x#0};
     
    _relpos = [];
    {
        _relpos pushBack [
            _base worldToModel ASLtoAGL getPosWorld _x,
            [_base vectorWorldToModel vectorDir _x,
            _base vectorWorldToModel vectorUp _x]
        ] 
    } forEach _parts;
    _object setVectorDirAndUp (_x select 2); 
    _object setPosWorld (_x select 1);
    
    {
        _relpos#_forEachIndex params ["_pos", "_dirAndUp"];
        _x setPosWorld (_base modelToWorldWorld _pos);
        _x setVectorDirAndUp (_dirAndUp apply {_base vectorModelToWorld _x})
    } forEach _parts;
    _objects pushBack _object; 
} forEach _data;
#

@swift gale

swift gale
#

holy moly, it worked

#

thank you very much

fading magnet
#
wp = (heli select 2) addwaypoint [getPos Hpad, 0]; 
hint "waypoint added";
while ((alive heli) && !(unitReady heli)) do {
    hint "while scope is crossed";
    sleep 1;
};
if(alive heli) then{
    heli land "LAND";
    hint "Landing command executed";
 };```

I'm still trying to get that heli on ground ๐Ÿฅฒ  it flies over heli pad but only hovers there. I put that hint commands to see if it goes through "If" and "while" scopes but it seems like these scopes are being skipped because I don't see messages from hints.
willow hound
#

SQF while-loop conditions are enclosed in curly brackets, not round brackets.

fading magnet
#

{} this? opsy so sorry, this is my first day of scripting >.<

#
wp = (heli select 2) addwaypoint [getPos Hpad, 0]; 
hint "waypoint added";
while {alive heli && !unitReady heli} do {
    hint "while scope is crossed";
    sleep 1;
};
if(alive heli) then{
    heli land "LAND";
    hint "Landing command executed";
 };```
still doesn't execute while-loop :((
willow hound
#

Try using systemChat instead of hint (then the hints don't overwrite each other) and let us know what output you see.

fading magnet
#

oh okay, gimme a second

#

okay, it displays "waypoint added" with grey color font in chat but that's it.

little raptor
#

Or heli's dead meowsweats

#

Are even running that scheduled?

fading magnet
#

hmmm... it's not dead I can see him flying.

fading magnet
willow hound
#

Ah, yes. heli is an array ๐Ÿ˜…
Try this:

private _res = [getMarkerPos "marker", 0, "CH_47F_EP1", west] call BIS_fnc_spawnVehicle;
_res params ["_heli", "", "_group"];
private _wp = _group addWaypoint [ASLtoAGL getPosASL Hpad, 0];
systemChat "waypoint added";
while {alive _heli && !unitReady _heli} do {
  hint "while scope is crossed";
  sleep 1;
};
if (alive _heli) then {
  _heli land "LAND";
  hint "Landing command executed";
};
fading magnet
#

shouldn't unitReady be true when the unit is moving toward a waypoint? I've read that in wiki

#

ooooohhhh I see!!!

#

thank you I'm gonna copy-paste it

#

just one side-question... why did you define _res and _wp private?

willow hound
#

For all I know right now, those variables are not used outside of this code, and then it's good practice to make local variables private. Of course, if you do need them to be global, you can make them global again ๐Ÿ™‚

fading magnet
#

thx ^^

obtuse crypt
#

Guys is there a way to spawn half empty magazines for rifle somehow? Basicly i want box of magazines wich will have 10 rounds instead of 30.

smoky verge
#

how can I attach an object relatively and to a bone?
I know how to do those individually but combined?

digital vine
#

So I am currently spawning an explosion through the line:

"R_60mm_HE" createVehicle getPosATL _this;

Which works and is fine, Yay!

.... However, when I include it in the following:

    _ExploBar addEventHandler ["HandleDamage",{0}];

    _ExploBar addMPEventHandler ["MPHit", {    params ["_unit", "_causedBy", "_damage", "_instigator"];
    if !(_instigator in allplayers) exitWith {false};
    private _hitCount = (_unit getVariable ["you_hitCount", 0])+1;
    _unit setVariable ["you_hitCount", _hitCount];

    if (_hitCount >1) then {
        _unit removeMPEventHandler ["MPHit", _thisEventHandler];        
        _unit spawn {
            private _emitter = "#particlesource" createVehicle position _this;
            _emitter setParticleClass "MediumDestructionFire";
            sleep ((round random 3) +3);

            sleep 0.1;

            "R_60mm_HE" createVehicle getPosATL _this;

            sleep 0.1;
        
            {
            deleteVehicle _x;
            } forEach [_emitter, _this];
 
        }
    }

It creates the desired explosion, but without any damaging properties. I.e. if set off next to a player/AI no damage occurs.

Why?

Am I doing something idiotic?

#

Too add extra flavour, this was fine before the Major base game update a few months back

little raptor
#

just run them one after the other

smoky verge
#

on the same object?
will it work?

#

I need to attach an object to a specific position onto a bone

little raptor
smoky verge
#

to be clear
its just one object that I need to attach to a bone in a relative way

limber panther
#

hello! Can someone suggest me a suitable script please? Let's say a player comes to an object and uses addaction that is on that object. The addaction gives him 1 specific item into his inventory. Later, somewhere else the player drops that item from his inventory on the ground. Is there any script, that can execute an action when this item gets dropped on the ground?

#

basically when player drops that, something will happen

little raptor
smoky verge
little raptor
#

it does work

smoky verge
little raptor
#
_obj1 attachTo [_obj, _pos, _bone];
_obj2 attachTo [_obj, _pos, _bone];
...
smoky verge
#

as I asid
its only one object

little raptor
#

then what do you mean by combined?

I know how to do those individually but combined?

smoky verge
#

the object needs to be attached to the bone (so attachto) but in a relative way (attachtorelative)

little raptor
#

you have to do some vector math then

#

use selectionPosition and selectionVectorDirAndUp

smoky verge
#

yeah thats what I ended up doing
was hoping there was a less stressing way for next time

kindred zephyr
#

is inventoryClosed event handler a reliable way to check for inventory updates?
I see it working when using wiki example, but when trying to do anything else it just doesn't do anything at all.

Does it has a limitation or condition to trigger?
Im trying to test it via console and script and neither work

noble zealot
#

I'm using "setVelocityTransformation" locally in the player and the result was perfect, but on other machines what happens is totally crazy. Why?

little raptor
little raptor
kindred zephyr
little raptor
#

yes

naive needle
#

Does someone know if you are able to disable the time sync on a mp server ?

kindred zephyr
#

you cant

naive needle
#

not even with mods ?

little raptor
#

no. time is always synced

kindred zephyr
#

idk about mods. But wiki suggest you can cause a temporary desync until it syncs again

little raptor
#

there is some delay between syncs but that's the only thing you have

crude vigil
naive needle
#

Is there a other way around to make it dark for a player to achieve the underground bunker feeling

naive needle
little raptor
#

setAperture maybe

crude vigil
#

There are PP effects but not as good as both solutions applied

naive needle
#

yea tried that, but it looked horrible

crude vigil
#

Really depends on your setup though

kindred zephyr
#

PP no good, i've tried that too :p

crude vigil
#

PP + time change is the only solution for a good effect.

#

That is how I achieved at least.

naive needle
#

it would be actually really nice if they would add a command to stop the time sync until you turned it back on

#

I have so many ideas

kindred zephyr
#

a long time ago desync was possible

opal zephyr
#

does getPosASL get the position of an ai's feet, or their center?

opal zephyr
#

Thankyou!

sudden yacht
#

Any way to make a building hostile to a side? Like i would love to see vehicles engage and destroy buildings if they came near it. Any idea's?

little raptor
sudden yacht
#

That sort of works i suppose.

#

Lets say i wanted to do exactly that. But on zues spawned objects. Where the zues places it down and then it is auto assigned to the house placed. private _vehicle = "CBA_O_InvisibleTargetVehicle" createVehicle position zuesplacedobject;
How can i do that?

warm hedge
#

auto assigned to the house placed
What do you mean?

unreal scroll
#

I was digging into a save problem for my server, and noticed that the date is [1945,9,31,18,27] ๐Ÿ˜ตโ€๐Ÿ’ซ
Seems like a bug?

sudden yacht
#

Like if zues creates said house, can i have it so it auto calls a script and assigns it to that house?

#

@unreal scroll Man thats wierd

fair drum
#

class event handlers

#

with "init"

sudden yacht
#

@fair drum can you help me out with that? I have no idea where to even begin.

fair drum
#

give me a house class name you want

sudden yacht
#

Idk just any house the zues places.

#

So it would be many buildings.

fair drum
#
[
    "Land_i_Shop_01_V1_F",
    "init",
    {
        //insert code here 
    },
    true,
    [],
    false
] call CBA_fnc_addClassEventHandler;
#

now any time "Land_i_Shop_01_V1_F" is created, it will run that code

sudden yacht
#

I will also use yours in the future for another project.

round scroll
#

currently doing a teleport of an object unconditionally, but would like to add a check if the area is sufficiently empty. Not sure if this is a dead end - maybe it would be better to have some 'transparent' teleport menu in which the player places the object (most likely plane) himself and takes responsibility for the explosions ๐Ÿ™‚ current code (for completeness) sqf _vehicle setPosASL (_vehicle getVariable "ttt_cva64_hangarOut");

proven charm
round scroll
unreal scroll
#

@round scroll Can you provide more info on your algorithm? What kind of vehicles, what kind of surface you want to put it on? I wrote a large function which is very stable (can spawn hundreds of vehicles in many conditions), but I don't think you need it as is ๐Ÿ™‚

proven charm
#

actually nvm I see now what your doing

round scroll
#

thanks, totally forgot that count can have a condition as well

unreal scroll
#

Don't you want to set up pre-adjusted places for planes?

round scroll
#

no, my current approach is to define a ViV capable vehicle, attach it to the hangar, and teleport objects from elevator to the ViV vehicle. The path back is what bothers me, as I need to check that the elevator is free of obstacles

unreal scroll
#

And if it is not free?

round scroll
#

then a message to clear the elevator before retrieving vehicles from hangar shall be displayed

unreal scroll
#

Ah, it is simple ๐Ÿ™‚
Just count appropriate objects in some area.
If is is clear, use BIS_fnc_findSafePos in cycle, increasing the radius step by step, until position is found.
But need to make a test function - place different type of objects in area, and check the functions will works well with it. Simple objects, statics, vehicles.

round scroll
#

does bis_fnc_findSafePos work on a building, not sure about this

unreal scroll
#

In a building? No, placing in buildings is another story. It is better to use relative coordinates, I believe. Like attachTo + detach

round scroll
#

on top of a building, the carrier is composed of building parts

unreal scroll
#

About your algorithm: you better to set it as a whole sequence == the queue. So you can program all moves one by one. In this case you could use pre-adjusted positions for planes (if it is a script, why players need to have an option to ruin it? :)).
You start the queue, and it goes on until the end, placing your plane in appropriate positions. Is it an option? Or you need to interact with something in process?
Using dynamic placing is the source of instability, it is better to avoid such things if possible.

#

As for me (I did some core mechanics for a modern mod), I just set the needed carrier positions for planes as variables for plane objects, and once it landed, moved it to it - with effects or without. Very simple, very reliable.

round scroll
#

player should be able to roam the flightdeck freely with and without planes

#

I just want to replace the old manual use of the hangar with something automated

unreal scroll
#

"player should be able to roam the flightdeck freely with and without planes"
Ah, those players... I love AI ๐Ÿ™‚
BTW, is there only one hangar?

round scroll
#

yes, but doe to geo and roadway lod size limit it's compartmentalized into several ViV areas

unreal scroll
#

If so, then, as your code is very simple, you just need to add more precise positioning (with attachTo maybe) - to calculate _hangarOutPos. In this case your plane will be always positioned right.
Load the editor, and experiment with spawning a plane relative to hangar:

[] spawn {
Plane = class createvehicle [0,0,1000];
Plane attachTo [Building, some relative position];
detach Plane;
sleep 5;
deletevehicle Plane;
};

If it is hard for you to find out correct relative coordinates, try to place the plane in editor, name it as well as the hangar, and use https://community.bistudio.com/wiki/worldToModel
Hangar worldToModel position Plane (I could be wrong in order)

round scroll
#

hangarOutPos is the place taken by getPosASL when the vehicle was stored in the hangar: ```sqf
private _vehicle = ttt_cva64_elevator3_vehicles # _row;
_vehicle setVariable ["ttt_cva64_hangarOut", getPosASL _vehicle];
private _success = g setVehicleCargo _vehicle;

#

the idea is that the player drives the vehicle/plane onto the elevator, uses the store function and later retrieves it at the same pos

#

not sure where attachTo would help there?

unreal scroll
#

In positioning the plane in hangar correctly, without using absolute coordinates.

round scroll
#

but the hangar is using vehicle in vehicle

#

so it's automatically put in an open space available, if any

unreal scroll
#

Does it position the cargo automatically? If yes, then it is ok - I didn't have an opportunity to use it ๐Ÿ™‚

unreal scroll
#

Then, you need only to place a plane on a elevator correctly, right?

round scroll
#

the player drives it there

unreal scroll
#

Ok, it becomes complicated for serial transmitting ๐Ÿ™‚
Probably I'll have some time this weekend, and you can share your mission template with the needed algorithm. Maybe I could provide more simple solution.

round scroll
#

thanks for your interest, but the carrier is not released yet

unreal scroll
#

Oh. Then can you provide a "datasheet"? ๐Ÿ™‚ For me it is much better to see the process before my eyes, even on paper. There also could be some problems that you can encounter later, but I could be aware of.
It would be much easier to right a pseudo-code, and start from it.

round scroll
unreal scroll
#

Unfortunately, usually I can't completely see the main idea from the code (even if the author can), and it is normal.
But the overall script is very basic, and you can test it out without problems.
From what I see, you can encounter some problems with obstacles detection, vehicle collision on spawn and script fails in MP due to local variables, but all of it is not algorithmic issues, and can be easily fixed. I just need to know what problems do you have during testing.

Your goal is just to detect obstacles, and restrict a plane moving, so focus on it. Add appropriate messages to players ("Oh man, there is a big kaboom and local armageddon on the deck, do you really want to lift the plane?").
If it would be a task to find an empty space for the plane on a deck by any cost, then it is much more complex ๐Ÿ™‚

noble zealot
noble zealot
#

@little raptor this is the code:sqf waitUntil { private _deltaTime = diag_deltaTime; //last frame time private _newASL = ... private _newDir = ... private _newVU = ... private _stop = ... player setVelocityTransformation [ //POSITION ASL getPosASL player, _newASL, //VELOCITY [0,0,0], [0,0,0], //VECTOR DIR vectorDir player, [sin _newDir,cos _newDir,0], //VECTOR UP vectorUp player, _newVU, 1 ]; _stop };

little raptor
bronze temple
#

Anyone who edits altis life could you tell me why its barking this

#

"You are not allowed to access this storeage container without the owner opening it." but I placed it down.

#

It is registered in the database and everything

#

I see it there

#

Preferable pont me to where I can get rid of this

brazen lagoon
#

and then a select statement evaluates on every item in the array

#

so I would think nearEntities or similar would have to be faster

little raptor
#

A sqf loop is never faster than an engine loop

#

I don't know if nearEntites is a loop over all entities or if it uses grid search tho. But either way it's faster

round scroll
#

so this is preferred over the vehicles loop: sqf _hangarGaragePos nearEntities [["Air", "Car", "Tank", "Motorcycle"], 15] plus the select on not being a ttt_constellation_wire_anchor

little raptor
#

Well you can always check the performance using the debug console

round scroll
#

what would be a typical number of vehicles and units in a mission then? Clearly with the three test vehicles and units it would not be a good result, or?

brazen lagoon
#

@round scroll that looks like it would be pretty fast at selecting only the nearby vehicles yeah

#

and then an sqf loop over them seems inevitable

opal sand
still forum
#

script and code is the same thing?

round scroll
#

f.e. 50 planes flying, nearEntities took 0.0028 ms and vehicles took 0.0716

tough abyss
#

does anybody knows a good syntax highlight package sqf for Sublime text?

round scroll
copper nova
little raptor
coarse dragon
#

Can someone explain the script that Gives a Unit more health ๐Ÿ˜ฌ

little raptor
coarse dragon
#

BossAi

#

I'm not sure how to write it out ๐Ÿ˜ฌ

vernal mural
#

Is that PhysX support ?

little raptor
vernal mural
#

soooo.... One could do a custom object with PhysX support and this mem point, and use is as helper, instead of spawning/hiding a full blown AA turret ?

little raptor
#

I think so yes

vernal mural
#

mh

little raptor
vernal mural
#

Yeah I was hesitant to do so, due to ropeCreatebeing a script command

little raptor
#

since iirc you can attach a rope to Land_Wrench_F

hollow lantern
#

can I setDamage 1 a helo without the explosion? I only want the wreck that is available afterwards

little raptor
#

but I think the smoke and stuff are still there

hollow lantern
#

that's would be fine. Thanks the wiki showed me how

coarse dragon
#

So I'm trying to figure out the evenhandler damage Number.
What a good number to be able to take a few extra hits?

open fractal
coarse dragon
#

Yea

little raptor
#

no need to use an arbitrary number

coarse dragon
#

Give me a example?

little raptor
#

0.1 * _takenDamage

coarse dragon
#

this addEventHandler ["HandleDamage",{-5}];

#

thats what im using ๐Ÿ˜’

open fractal
little raptor
open fractal
#

so whatever goes in {} is what you're telling the game engine to do

#

so right now you're just telling it -5 which is just a number, not a command

#
unit: Object - Object the event handler is assigned to.
selection: String - Name of the selection where the unit was damaged.
"" for over-all structural damage
"?" for unknown selections
damage: Number - Resulting level of damage for the selection.
source: Object - The source unit that caused the damage.
projectile: String - Classname of the projectile that caused inflicted the damage. ("" for unknown, such as falling damage.)
little raptor
open fractal
#

it does not

coarse dragon
#

this addEventHandler ["HandleDamage",{0.1 * _takenDamage}];

#

like that?

open fractal
#

_takenDamage is not defined

little raptor
open fractal
#

i was just saying a command would be a way to get an eventhandler to change something

coarse dragon
little raptor
open fractal
#

If code provided returns a numeric value, this value will overwrite the default damage of given selection after processing.

#

right on

#

I was wrong about HandleDamage you can just input a number

coarse dragon
#

I'm not getting the hang of this at all

open fractal
#

i gave you fake news

#

HandleDamage can just take a number

#

so if you write 0.1 damage taken would be 10% every time

#

but if you write 0.1*_damage it would multiply the damage taken by 0.1

#

so it's proportional

coarse dragon
#

I'm dying with one hit tho

little raptor
#

like I said, it has to be proportional, using a multiplier

open fractal
#
this addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
    0.1*_damage;
}];
little raptor
#

this is wrong tho

open fractal
#

so correct me if im wrong leopard because i was wrong just now

little raptor
#

iirc _damage is the total damage

#

not added damage

winter rose
#

yep

little raptor
#

you have to first calculate the taken damage, then multiply that by a multiplier to reduce the taken damage

open fractal
#

i have a nasty habit of writing this stuff before reading the docs

little raptor
#

then add it to the current damage and return it

coarse dragon
#

๐Ÿ˜“

little raptor
#

something like this:

this addEventHandler ["HandleDamage", {
params ["_unit", "", "_damage", "", "", "_hitIndex"];
_currentDmg = if (_hitIndex < 0) then {damage _unit} else {_unit getHitIndex _hitIndex};
_takenDmg = _damage - _currentDmg;
_currentDmg + 0.1 * _takenDmg;
}];
open fractal
#

is _currentDamage a typo

little raptor
#

yeah meowsweats

coarse dragon
#

So I have to do math ๐Ÿ˜ตโ€๐Ÿ’ซ

open fractal
#

it's just one multiplier

#

0.1 for 10% damage

coarse dragon
#

Oh

little raptor
coarse dragon
#

All this for abut of plot armour ๐Ÿ˜–

open fractal
#

dont be deceived by my fucking it up it's not all that complicated

#

once you take some time to mess around with it and compare with the wiki it'll make sense

coarse dragon
#

So is that script working. Or do I need to fill in parts of it?

open fractal
#

it should just work as-is

open fractal
#

oh yeah params helps

coarse dragon
#

this addEventHandler ["HandleDamage", {
params ["I_NORTH_NOR_R_Rifleman_3", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
_currentDmg = if (_hitIndex < 0) then {damage _unit} else {_unit getHitIndex _hitIndex};
_takenDmg = _damage - _currentDmg;
_currentDmg + 0.1 * _takenDmg;
}];

little raptor
#

why did you change stuff

#

it worked as I wrote it

coarse dragon
#

it didnt do anything tho

little raptor
#

params ["I_NORTH_NOR_R_Rifleman_3",

open fractal
#

"_unit" is taken from this

little raptor
#

no

open fractal
#

no?

#

unit: Object - Object the event handler is assigned to.

little raptor
#

it's taken from _this

coarse dragon
#

i tried your script i still died very quick

little raptor
open fractal
#

which is derived from this, or whatever you assign the eventhandler to

coarse dragon
#

in the units inti

little raptor
#

single player?

coarse dragon
#

yea

little raptor
#

I'm pretty sure it should work tho

#

are you using ACE or something?

coarse dragon
#

found the problem

#

im applying it to a modded unit

open fractal
#

what does that mean

coarse dragon
#

a unit from a mod

open fractal
#

so?

little raptor
little raptor
coarse dragon
#

yea it decided to start working lol

kindred zephyr
# little raptor something like this: ```sqf this addEventHandler ["HandleDamage", { params ["_un...

does this even work??

we are substracting the current unit damage to the reported damage of the event handler then summing .1 to the current damage and multipliying it byt the previous operation xD??

Shouldn't it be ```sqf
this addEventHandler ["HandleDamage", {
params ["_unit", "", "_damage", "", "", "_hitIndex"];
_mitigatedDamage = _damage * .1;
_currentDamage = (getDammage _unit)+ _mitigatedDamage;
}];

??
coarse dragon
#

thanks for the help at least im not a god aswell but can survive a few more hits

little raptor
coarse dragon
#

like 0.50?

little raptor
#

0.5 > 0.1

kindred zephyr
#

anything > 0 and <1

little raptor
#

0.05 < 0.1

kindred zephyr
#
helicopterThing addEventHandler ["HandleDamage",{getDammage (_this select 0) +((_this select 2)*.07);}]; 

just do this

little raptor
# coarse dragon 0.05>0.1
this addEventHandler ["HandleDamage", {
params ["_unit", "", "_damage", "", "", "_hitIndex"];
_currentDmg = if (_hitIndex < 0) then {damage _unit} else {_unit getHitIndex _hitIndex};
_takenDmg = _damage - _currentDmg;
_currentDmg + _takenDmg / 10;
}];
#

use something bigger to reduce the damage

#

e.g. 20 instead of 10 means 2x better damage reduction

open fractal
#

or not damage at all

#

ok what im saying is you got _damage wrong

little raptor
#

will increase it

open fractal
#

i just made this mistake

#

_damage is the resulting damage, not the damage received

coarse dragon
#

thanks Leo

little raptor
#

np

kindred zephyr
little raptor
little raptor
open fractal
#

it doesn't account for hitpoints either

little raptor
#

yeah it's probably just applying a lower damage (from hit points) to whole body, thus reducing the damage

#

or maybe the other way around

open fractal
#

the greater the overall damage the more damage is done to hitpoints

open fractal
#

that's on purpose?

kindred zephyr
#

yes

little raptor
kindred zephyr
#

he asked for a resistant helicopter, not a helicopeter that resist consistently

coarse dragon
#

Just curious. How does one actually make thier own script?

#

Are they like hidden in the base game or something or entirely new?

open fractal
little raptor
#

e.g. getHitIndex , addEventHandler and damage in what I wrote were scripting commands

coarse dragon
#

so you could make yourself turn into a nuclear bomb upon death?

open fractal
#

sometimes i just click through random wiki pages and go "oh that's a thing?"

little raptor
#

well not "nuclear bomb" per se, but a powerful bomb

open fractal
#

something i do to kill time sometimes is just load into the editor and fuck around with the console like that

#

you can script a nuke but it would just need to be piece by piece (light, sound, particles, damage, etc)

coarse dragon
#

i lack the brain power to do any complex stuff lol

open fractal
#

i added a "geiger counter" to one of my missions by just having a "pop" sound play at varying intervals

#

i lack brain power as well but i just give something a shot, post here, and have someone tell me specifically where my lack of brain power came into play

coarse dragon
#

it took me 8 hours to workout how to delete my airplanes via a trigger. and someone helped me on here in the end lol

open fractal
#

i did some weird gremlin mission making starting out

#

instead of writing a couple sqf files I had everything go off of trigger conditions and timers

#

and it was a mess

coarse dragon
#

altho that arty trick you showed me as helped me out a huge amount in other areas

little raptor
#

put that in the init of some unit

#

and kill them if you dare ๐Ÿคฃ

coarse dragon
open fractal
#

im still a lvl 1 crook and i still get oohs and aahs just by writing something goofy like what leopard pasted and showing it off

coarse dragon
#

@open fractal ive been able to do firing squads and all sorts of things with your help

open fractal
#

actually @little raptor do you write stuff in another program and paste it here or do you just make a code block and write

#

out of curiousity

coarse dragon
#

in my D-Day mission your suggestion was a huge help with arty stuff. also i can do kind of fake bombing runs with it aswell

open fractal
#

tip of the iceberg, skullblits

little raptor
open fractal
#

oh I stay in my visual studio comfort zone

coarse dragon
#

brifs seem alot more tricky to do tho

#

ive watched aload of vids on them, and it just wnt sink in