#arma3_scripting

1 messages Β· Page 775 of 1

granite sky
#

Not something I've worked with, but have you tried testing local player?

meager granite
#

That will probably work, but I want to know what I'm missing exactly

#

Just found a way to reproduce it somewhat reliably, thought maybe getClientState will return something, but nope its at proper value at the moment of cutRsc

["getClientState","BRIEFING READ","getClientStateNumber",10]
#

If game loads while not focused, findDisplay 46 and PreloadFinished conditions pass yet cutRsc does nothing πŸ€”

hallow mortar
#

Does it change depending on whether the game is set to pause when unfocused?

meager granite
#

Testing as MP listen server so it doesn't pause.

granite sky
#

There is isGameFocused

#

but that sounds like pretty bad behaviour.

meager granite
granite sky
#

That's with the game focused as well?

#

probably everyone just throws in a short sleep and moves on :P

drifting portal
granite sky
#

Ideally you understand exactly why you're using it, but I have no idea what cutRsc's dependencies would be.

meager granite
#

So, after more investigation it turns out it wasn't cutRsc but addMissionEventHandler ["EachFrame" getting removed thus my loading waiting stopped. Trying to figure if its because of my mess up.

spiral zealot
#

hello, ive been told there is a script to disable the alt click on map to teleport function?

meager granite
#

Sorry for false alarm, cutRsc is realiable after findDisplay 46 after all

winter rose
still forum
#

Does anyone use string in or find with a search pattern that is longer than 80 characters?
if yes whats the usecase?

granite sky
#

Are config classnames allowed to be longer than 80 characters?

still forum
#

Yes but I don't think thats common

granite sky
#

I guess that'd be the _string in _array form for us anyway.

versed widget
#
_x addEventHandler ["Dammaged", {[_this select 0]; this spawn {
           //code
             sleep 1;
        };
    }];
} forEach vehicles; ```
how do i make this event handler in scheduled environment  ? 
 its not working
granite sky
#

You're missing a bracket, and wrong channel.

#

oh, wait

#

This is #scripting :P

brave dome
#

So you can store a long string and in an array and pack more data into it

#

Similar to storing json data into a database

still forum
#

Specifically asking if someone is using in or find to search large strings for a substring thats longer than 80 characters.
if anyone is doing that in their scripts

versed widget
granite sky
#

Well, this spawn { } is also wrong. Maybe _this but it's not clear what you're trying to pass to the spawn.

versed widget
#

im trying to pass the EH investigator i think

winter rose
granite sky
#
{
    _x addEventHandler ["Dammaged", {
        _this spawn {
            params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"];
            // do what you like with those
            sleep 1;
        };
    }];
} forEach vehicles; 
versed widget
drifting portal
#

what number for finddisplay should I use to get the inventory display?

#
player addEventHandler ["InventoryOpened", {
    params ["_unit", "_container"];

    with uiNamespace do {
        _display = (findDisplay 602) createDisplay 'RscDisplayEmpty';  
        _RepackMagazineButton = _display ctrlCreate ["RscButton", 1600];
        _RepackMagazineButton ctrlSetText "Repack Magazines";
        _RepackMagazineButton ctrlSetPosition [0.448493 * safezoneW + safezoneX, 0.742 * safezoneH + safezoneY, 0.0669591 * safezoneW, 0.033 * safezoneH];
        _RepackMagazineButton ctrlSetBackgroundColor [0,0,0,1];
        _RepackMagazineButton ctrlSetTooltip "Repacks Magazine";
        _RepackMagazineButton ctrlAddEventHandler ["ButtonClick",{

        }];
        _RepackMagazineButton ctrlCommit 0;
    };

}];

GUI doesn't show up

meager granite
#

IDD for the menu is correct 602 but the menu isn't open on "InventoryOpened" event yet, only much later

drifting portal
#

sleep time

meager granite
#

Its probably tied to animations or something, use waitUntil instead

drifting portal
meager granite
#

!isNull findDisplay 602

drifting portal
#

yep thanks

#

I guess we will wait instead of sleeping sadly

meager granite
#

You can have both: waitUntil {sleep 0.01; !isNull findDisplay 602}

#

Also you'll need to spawn

drifting portal
#

I just wanted to make sure if its isNull

#

thanks

meager granite
#

I'd suggest to use each frame EH though, so your controls don't appear with delay which looks ugly

drifting portal
#

nah waitUntil without sleep is better in my opinion

#

we are stretching it too much with eachframe lol

meager granite
#

Up to you

drifting portal
#

/s

granite sky
#

Sweet.

meager granite
#

Wish we could force control to choose best mip to fit size though, resized 0 mip of a big picture to small size always looks ugly

#

Or enable prettier resampling algorithm where needed

drifting portal
meager granite
#

Its test lines

lapis ivy
#

Who can help...
I need to add a 3rd side to the victory, resistance
What I have now:

    [east, west] 
} else { 
    [west, east] 
} params ["_winner", "_loser"]; 
 
["SideLost", false] remoteExec ["BIS_fnc_endMission", _loser];  
["SideWon"] remoteExec ["BIS_fnc_endMission", _winner];```

Resistance allies with Blufor but don't have Respawn, there are two units with one life. I need that when the blues run out of tickets, they lose together with the blues, and the reds win, and vice versa, if the reds run out of tickets, then the blues and greens win.
meager granite
#
if(_winner == blufor) then {
    ["SideWon"] remoteExec ["BIS_fnc_endMission", independent];
} else {
    ["SideLost", false] remoteExec ["BIS_fnc_endMission", independent];
};
``` add to the end
#

or

if(_winner == blufor) then {["SideWon"]} else {["SideLost", false]} remoteExec ["BIS_fnc_endMission", independent];
```for a one-liner
#

This post was made by blufor, opfor, independent gang

#
        private _logo_width_pixels = _logo_width / pixelW;
        _ctrl_logo ctrlSetText (switch(true) do {
            case (_logo_width_pixels > 256):    {"i\logo512.paa"};
            case (_logo_width_pixels > 128):    {"i\logo256.paa"};
            default                    {"i\logo128.paa"};
        });
#

Poor man's MIP selector really

drifting portal
winter rose
#

@spiral zealot there might be a mission EH for unit spawned, and you can remove items in there

spiral zealot
drifting portal
#

what is the problem with 100 units?

winter rose
spiral zealot
winter rose
#

no probz! we may help πŸ™‚

#

so are your units spawned dynamically, from Eden only, or both? Are they spawned only once or randomly across the mission duration?

spiral zealot
#

I spawn units in my ops both in zeus and Eden editor.

#

I'm not sure what the best solution to this issue is, I guess I just don't want enemy AI to have maps.

winter rose
#

I'll check one thing (I'm on mobile)

spiral zealot
#

No rush, just ping me whenever you have an idea) thank you

winter rose
#

I have, but won't be able to code on mobile ^^
you can use a single line of script to remove the map from Eden-placed units, then use an event handler for Zeus-placed units πŸ™‚

#

I call for the sympathy of other users for this!

#

By the power of friendship! \o/

opal zephyr
#

Whats the EH Lou?

winter rose
#

CuratorGroupPlaced

#

and maybe CuratorObjectPlaced, to be confirmed

#

just the group should be fine

opal zephyr
#

And then getting the units of the group and removing their maps?

winter rose
#

yesh please :3

opal zephyr
#

Ill give it a shot, one sec

#
this addEventHandler ["CuratorGroupPlaced", {
    params ["_curator", "_group"];    
    [
        _items = assignedItems _x;
        _x removeItem _items select 0;;
    ] forEach units _group;    
}];

I think this would be sufficient for ai placed in zeus

drifting portal
#

But what if he also places singular units?

#

e.g civilians

opal zephyr
#

Singular units are part of their own group

#

afaik

drifting portal
#

correct

opal zephyr
#

idk what the eventHandler itself is supposed to be attached to though, the wiki doesnt say

#

Maybe the curator module or something

drifting portal
#

but how will he run the script?

opal zephyr
#

I don't see it mentioned anywhere

#

Id assume that would be ran upon mission start

drifting portal
brazen lagoon
#

is there a command to get mission objects in a marker?

#

i dont really want to use allMissionObjects if I can help it

opal zephyr
#

Hey @spiral zealot We've got a solution to your removing maps from zeus placed ai

opal zephyr
#

I was gonna ask some more details

drifting portal
opal zephyr
#

Worth a shot

drifting portal
#

nah a shot is too little

#

its worth more

opal zephyr
brazen lagoon
drifting portal
#

placed mission objects?

#

you mean eden placed?

brazen lagoon
#

not necessarily

#

also placed by players or zeus during a session

drifting portal
#

nearestObjects?

brazen lagoon
#

nearestObjects or nearEntities?

#

does _pos nearEntities ["House", 150] not work?

#

seems the answer is no

drifting portal
#

well try I guess

#

I never used nearEntities

brazen lagoon
#

yes i tried it

opal zephyr
#

Neither of those will get you objects that are apart of the map, but both should give you objects placed in eden or in zeus

brazen lagoon
#

nearObjects doesn't work, let me try nearestObjects

opal zephyr
#

nearObjects isnt a thing

drifting portal
#

nearestObjects should get you it

opal zephyr
#

It wont get you a house thats apart of the map

brazen lagoon
#

nearestobjects also doesn't get me everything

drifting portal
#

damn

opal zephyr
#

Use nearestTerrainObjects

drifting portal
#

yeah

brazen lagoon
#

dont want terrain houses

drifting portal
#

was about to suggest that

brazen lagoon
#

only placed

opal zephyr
#

ah ok

drifting portal
#

so

#

how did you use nearest objects?

#

how far is the house

opal zephyr
#

Have you confirmed that _pos is correct, and maybe try capitalizing HOUSE

drifting portal
#

if the house is 50 meters for example

brazen lagoon
#

any ideas on this one: if I do this [typeof cursorObject, cursorObject call bis_fnc_objecttype] while looking at this water source I get this: ["Land_Water_source_F",["Object","House"]]

drifting portal
#

nearest objects scans for center position

brazen lagoon
#

but. if I try to do nearestObjects [player, ["House"], 200];

drifting portal
#

so you should do radius = distance that you want + 50

brazen lagoon
#

when I am right next to the water source

#

I only get the slide that's next to it: [1b647dceb00# 7: slide_f.p3d]

opal zephyr
#

Its possible that the actual waters object center is far away and wont read with nearestObjects, but when looking at it the bounding box is used and therefore would return it

brazen lagoon
#

i dont see how, I'm right next to it

opal zephyr
#

How big is the body of water?

brazen lagoon
#

no no Land_Water_source_F is like

#

a water tap

opal zephyr
#

ohh

#

hmm

brazen lagoon
#

I think I need to filter with "Building" not "House"

#

confusingly

drifting portal
#

yeah try

brazen lagoon
#

yes this works: nearestObjects [player, ["Building"], 200];

#

also works w/ nearObjects

spiral zealot
drifting portal
brazen lagoon
#

really odd. I figured that out by looking at the objects in the config viewer btw and seeing what they inherited from. oddly only the slide inherited from "House"

drifting portal
#

the game master module

#

there is a field called init

brazen lagoon
#

the others inherited from "Building" but not "House"

opal zephyr
#

weird

drifting portal
#

is this the build menu thing you are working on?

spiral zealot
opal zephyr
#

Ok so

#

You have a player placed down in the eden editor right?

#

The only way to access zeus is if you have also placed down a zeus module and linked it to the player. Have you done that?

spiral zealot
#

i can access zeus no problem

opal zephyr
#

ok, so double click on the zeus module

lapis ivy
#

Tell me, I need that in the trigger it would be impossible to shoot from equipment, in my case it is a ZSU air defense system...
How can i do this?
I'm interested in such an option, so that when you press the left mouse button, the ZSU would simply not be able to shoot while in this trigger.

spiral zealot
opal zephyr
#

paste the code I wrote above into the large "init" field

#

and then just press ok at the bottom somewhere

spiral zealot
#

alrighty, and what will this do?

opal zephyr
#

It makes it so that when that zeus places a unit down the map will be removed from its inventory

spiral zealot
#

i see, thats good thank you

#

and editor placed units?

opal zephyr
#

Havn't gotten to that yet. Lou says a single line of code can be used, but I cant think of how to execute it without adding it to every init field. Or running a similar script to the one I just wrote at the start of the mission

spiral zealot
#

alrighty, anyways thank you sm!

opal zephyr
#

np, let us know if that code doesnt work

brazen lagoon
velvet merlin
open fractal
opal zephyr
#

ya

meager granite
#

You can have any UI over it

#

Hacky SQF:

    ["A3\Missions_F_EPA\video\A_in_intro.ogv"] spawn BIS_fnc_playVideo;
    0 spawn {
        waitUntil {!isNull(uiNamespace getVariable ["RscTitleDisplayEmpty", displayNull])};

        private _ctrl_subtitles = uiNamespace getVariable ["RscTitleDisplayEmpty", displayNull] ctrlCreate ["RscStructuredText", -1];
        _ctrl_subtitles ctrlSetPosition [
            0,
            0.5 - 0.05,
            SafeZoneW,
            0.1
        ];
        _ctrl_subtitles ctrlSetFontHeight 0.1;
        _ctrl_subtitles ctrlSetStructuredText parseText "My subtitles here!";
        _ctrl_subtitles ctrlCommit 0;
    };
#

Probably can be done better through scripted events as BIS_fnc_playVideo does

[missionNamespace, "BIS_fnc_playVideo_started", [_videoContent]] call (missionNamespace getVariable "BIS_fnc_callScriptedEventHandler");
```but you might as well make your own function.
velvet merlin
#

πŸ™‡β€β™‚οΈ

meager granite
#

Sure

lapis ivy
# meager granite Sure

I need that in the trigger it would be impossible to shoot from equipment, in my case it is a ZSU air defense system...
How can i do this?
I'm interested in such an option, so that when you press the left mouse button, the ZSU would simply not be able to shoot while in this trigger.

meager granite
#

Pretty difficult task to be honest

#

Easier solution: Delete projectiles when you fire inside trigger: You'll be able to fire, spend ammo, but nothing will happen
Medium solution: Delete weapons on trigger enter, add them back when you leave the trigger
Hard solution: Use new actionKeysEx command to get all controls set combinations for firing and handle them with displayAddEventHandler (not sure if possible completely)

drifting portal
#

He has done something like that

meager granite
#

Oh, there is also ProtectionZone_F and ProtectionZone_Invisible_F which are objects that you can go through but they stop projectiles.

#

Again, you'll be able to waste ammo

drifting portal
#

Quiksilver has Invade and annex mode

#

He has has a safe zone where you can't fire

meager granite
#

Wonder how he did that, probably through display event handlers

#

I'm too lazy and just do projectile deletion on Fired

drifting portal
#

I hope I'm not pinging you with replies

meager granite
#

All good

open fractal
drifting portal
#

No

meager granite
#

No, you can delete projectile right inside the event handler

open fractal
#

I thought there was a frame of delay so bullets have a bit of travel?

meager granite
#

Just make sure its real one and not network fake one

drifting portal
#

It fires as soon as the projectile is created

#

If I recall correctly that is

drifting portal
#

Corrected a mistake

#

Forgive me dear Artisan foods maker

open fractal
#

I might be thinking of my own scripts being slower than deleteVehicle alone

meager granite
drifting portal
#

Well network projectile are just effects

#

Not a real object

#

Calculations and all that type of stuff is done locally

meager granite
#

IIRC slow shots (missiles and such) ones have null object in the EH attached to remote entity, don't remember how remote fast shots are handled.

#

you probably can just deleteVehicle whatever is being provided and you're good

drifting portal
#

Just add the EH to every client locally

#

Done

open fractal
#

display event handler is probably the best way for the original problem imo

drifting portal
open fractal
#

It's probably not rocket science anyway to get it to work how mfive wants

lapis ivy
#

Hm...

drifting portal
open fractal
#

You can't override actions but you can override keys

drifting portal
#

And how will you do that?

open fractal
#

display event handler

#

keyDown

drifting portal
#

No

#

Its Mousebuttondown?

lapis ivy
#

Here is what I found
But I didn’t manage to remake it for a trigger, namely when not the player himself, but the ZU transport is in the trigger.

   if ({(_this select 0) distance getMarkerPos (_x select 0) < _x select 1} count SAFETY_ZONES > 0) then
   {
       deleteVehicle (_this select 6);
       titleText [MESSAGE, "PLAIN", 3];
   };
}]; ```
If anything, shells are not a problem. They can be recharged, we have such an opportunity.
#

I don't really understand scripts, but I can edit small things. But I can't handle it. I'm trying to convert it to trigger, but it doesn't work for me.

open fractal
drifting portal
#

KeyDown and mousebuttondown

open fractal
drifting portal
#

Yes but what I meant is

#

How do you not make it fire

#

Like in Quiksilver invade and annex

#

If you press it nothing happens

open fractal
#

UI event handlers can override keys used for actions

drifting portal
#

Can you send a simple example?

#

Never seen it

meager granite
#

Looks like MouseButtonDown can't override mouse actions

drifting portal
#

Lovely

open fractal
#

I think killzonekid wrote a guide on overriding mouse? Might have been someone else

drifting portal
#

I think the way quiksilver done it is through addaction

drifting portal
#

Lol

open fractal
#

yeah that must be the ticket

drifting portal
#

That's one less loose end

lapis ivy
#

Hmmm i'ts nice

#

Thanks to. But how do I use it correctly in a trigger? I need not all players to be able to shoot, but specifically the crew of the anti-aircraft ZSU, and only while inside the vehicle.

drifting portal
#

Edit the condition parameter of the addaction

open fractal
#

You can also add/remove the action with getIn/getOut event handlers on the vehicle

drifting portal
#

Not needed

#

It will be invisible outside the trigger or outside the vehicle if he does the condition correctly

open fractal
#

Wouldn't it be more efficient to remove the action entirely instead of testing a condition the whole way through?

#

I honestly haven't used addaction conditions

drifting portal
#

Idk how the action checks the condition tbh

#

If it loops it or other ways

#

But regardless he has to have condition for the addaction to check if its outside the trigger

#

So might as well add if player is in the ZU

open fractal
#

If action is added to player, condition is evaluated all the time.

#

might be able to get away with a lazy eval approach

lapis ivy
#

Remove action when ZU leaves trigger...

#

Or, delete if ZU is in trigger but the player has left ZU

drifting portal
lapis ivy
#

this AND (ZSU_1 in thislist)
Condition

open fractal
#

you can just set the zsu as the trigger owner

lapis ivy
#

Hmmm

#

Yes

#

Nice

#

πŸ˜„

open fractal
#

You can write a function to remoteExec the addaction on the crew

#

and store the id for removal locally

lapis ivy
#

This is too hard for me...

drifting portal
#

f

open fractal
#

Addaction condition would work for now

#

that's the easier method, just inefficient

drifting portal
#

Lol

#

Yeah I know its inefficient

#

But its not like going to kill your fps

#

You must have a really hard to evaluate condition for that or maybe lots of actions

open fractal
#

it won't tank performance you're right

#

just not ideal

drifting portal
#

Except If I make it so that the code that returns the condition in the addaction locally spawns a submarine

#

That will tank it

open fractal
#
  1. spawn submarine
  2. check if submarine in trigger area
drifting portal
#

Ideal method

open fractal
#

most efficient sqf script

drifting portal
#

Where are the veterans at

#

Mfive can you write the condition for addaction?

lapis ivy
#

if (_ZSU1E == (vehicle _ZSU)) or (_ZSU2E == (vehicle _ZSU)) then { ...
Am I going in the right direction to check if the unit is in the vehicle?
ZSU1E - unit variable name
ZSU - vehicle variable name

drifting portal
#

No

lapis ivy
#

lol

drifting portal
#

Do uno reverse

lapis ivy
#

What is it like?

drifting portal
#

_ZSU == (vehicle _ZSU1E)

lapis ivy
#

Oh, I messed up where the unit should be?

drifting portal
#

Yes

lapis ivy
#

Ok, thx

#

if (_ZSU == (vehicle _ZSU1E)) or (_ZSU == (vehicle _ZSU2E)) then { ...
Ok.
Now I need to run fire.sqf on one player or two (that's the crew) who are in ZSU.
But I do not quite understand how to run it for them.

open fractal
#

in

#

if (_player in _vehicle)

open fractal
#

@lapis ivy i went back and figured out a clean way to do it if you would like the code

warm venture
#

So they can’t be like 512x256?

lapis ivy
open fractal
#

yeah, only works for one vehicle as-is

#

and the trigger is a little messy actually but

#

works in my testing

lapis ivy
#

ok

drifting portal
warm venture
#

Bruh

drifting portal
#

why don't you go to photoshop and make it

warm venture
#

That’s so dumb

drifting portal
#

512x512

#

and paste the 512x256 on it

#

easy pz

warm venture
#

I can but what if I don’t want a square

drifting portal
#

no

warm venture
#

I mean I guess but

drifting portal
#

you must have a square dear player

warm venture
#

Any idea how the w and h values work?

#

Like why is h 0.5 not half of the original image

#

It’s basically impossible to make a proportional control

drifting portal
#

I would rather use safezone

warm venture
#

How does safeZone work

#

It’s not clear

drifting portal
#

basically it scales up or down the GUI depending on the resolution

open fractal
drifting portal
#

so if you have a gaint box in a 1980x1080, people with 480p will still see it as a gaint box

open fractal
#

first two blocks have to be defined as functions and last one is the trigger

warm venture
#

Hmmmm…

#

Right but like

#

As far as sizing goes how do I know what to set values to to make it proportional

drifting portal
#

use GUI editor?

#

it will be the same on all screens

open fractal
#

in the second function with the first if statement

warm venture
#

Using arma dialog creator

open fractal
#

wait i thought of something I did wrong

drifting portal
#

average GUI editor enjoyer here

open fractal
warm venture
granite sky
#

A bit left of center? :P

drifting portal
#

"rocket_fire_stage_1_hide"
I want to run this animation on a simple object
how would I do that?

drifting portal
#

phase 0 or 1?

#

used 1, still there is exhaust

warm venture
#

@drifting portal Is it bad to put onMouseButtonDown events on pictures or should I put an invisible button over top the image?

drifting portal
hallow mortar
warm venture
#

The buttons have icons

#

But idk if I should put an invisible button over the icons or

#

Just add the event directly to the pictures

drifting portal
drifting portal
half garden
#

is there a way i can get ai helicopter to land on carrier

drifting portal
#

you should have set the button background to the icons themselves

#

but now just place invisible buttons

drifting portal
#

that was a misclick

#

I think try putting an invisible helipad on the deck?

#

then give it a land order on that

half garden
#

Oh wait lemme try that

half garden
#

the chopper tapped the deck and flew up lol

drifting portal
#

well I don't know then

half garden
drifting portal
#

alright lol

half garden
warm venture
#

@drifting portal Any idea why my invisible buttons are like..pulsing when im not hovering on them?

drifting portal
#
_light_emitter_0 = "#lightpoint" createVehicleLocal getpos this;   
_light_emitter_0 setLightColor [1,1,1];   
_light_emitter_0 setLightAmbient [1,1,1];   
_light_emitter_0 setLightIntensity 5000;   
_light_emitter_0 setLightUseFlare false;   
_light_emitter_0 setLightDayLight true;   
_light_emitter_0 setLightAttenuation [15, 4, 5, 0];  
  
_pos1 = this modelToWorldVisual (this selectionPosition "light_1_pos");  
_pos2 = this modelToWorldVisual (this selectionPosition "light_1_dir");  
  
_light_emitter_0 lightAttachObject [this, (this selectionPosition "light_1_pos")];  
_light_emitter_0 setdir ( _pos1 getdir _pos2); 

am I doing something wrong? this is in an init of a light object,
setLightDayLight true seems to not be taking effect?

hallow mortar
#

I take it you've confirmed that it does work at night?

drifting portal
#

Bright as a flashbang at night

proven charm
#

What's arma stable version number?

winter rose
proven charm
tacit glen
#

Is there a way to remote execute serverCommand from a client script to the server?
I tried like this but not too sure if my syntax is correct:
"xyzxyz" serverCommand format ["#kick %1",_playername];
I know that running this command in debug and executing on the server via debug menu works but not when running via a script loaded in the mission.
Have also tried this but is not returning any Boolean value or kicking:

["xyzxyz"]remoteExec [_msg, 2] ```
winter rose
#

serverCommand is not even mentioned in your second code

"xyz" serverCommand format ["#kick %1", _playername];
// becomes
["xyz", format ["#kick %1", _playername]] remoteExec ["serverCommand", 2];
tacit glen
#

ah I see arguments then remoteExec then the command.

#

thank you πŸ‘Œ

drifting portal
meager granite
#

Is there a way to stop game from ending on respawn=0 when everyone dies?

#

Nevermind, having respawn=0 and dying removes lobby slots

drifting portal
#

If you want

#

Make it the custom respawn mode

meager granite
#

What I want is: Player dies, nothing happens.

drifting portal
#

But without a respawn point when someone spawns

meager granite
#

They remain in control of their dead body and stock scripts do nothing

#

And lobby slot doesn't get disabled if they rejoin

drifting portal
#

How do they control a dead body?

#

Spectate?

meager granite
#

nothing, just remain as dead body

drifting portal
#

Spectate then

meager granite
#

Not spectate but nothing

drifting portal
#

I guess your best way is a custom respawn mode without a respawn point once one dies

meager granite
#

wont that just respawn you on your body?

drifting portal
#

Uh

#

It will say respawn disabled

#

When there is no respawn point

meager granite
#

I don't want any of the stock menus

drifting portal
#

Darn

meager granite
#

You die and that's it, player is dead body

#

In other words, I want to disable any of the pre-scripted and pre-defined death logics

drifting portal
meager granite
drifting portal
#

Well

#

You know it kinda boring staring at a dead body right?

#

I think you can try making a cut scene where they get buried

#

Or something

#

OnKilled.sqf
EDIT: onPlayerKilled.sqf

#

Can't you just use that

#

To create an agent like a bird

#

Selectplayer that agent

#

Then create a camera on the player's body?

open fractal
#

I don't know how you would get the player to stay ragdolled but the camera will stay on the player and you can disable ui inputs

drifting portal
#

if someone wants to disconnect he will have to alt + f4

open fractal
#

I didn't say all ui inputs

meager granite
#

The main goal is - have game don't do anything once player dies

drifting portal
meager granite
#

No spectators, no respawns, no nothing

drifting portal
#

thing is

#

I think you have to do some workaround for this

#

I don't think there is a "proper way"

proven charm
drifting portal
proven charm
#

yeah

drifting portal
#

yeah I think its way easier that way

open fractal
#

can you selectPlayer after the player is killed?

proven charm
#

yes

#

copy from my onPlayerKilled.sqf: ```
_group = createGroup civilian;
_newPlr = _group createUnit ["B_Soldier_F", getmarkerpos "rp", [], 0, "NONE"];
selectPlayer _newPlr;

_newPlr setPos [0,0,1000];
_newPlr hideObjectGlobal true;
_newPlr enableSimulation false;
_newPlr allowDamage false;

#

That's what it uses until player chooses new teammate to control

drifting portal
#

Creating a segaul

proven charm
#

never used an agent...

drifting portal
#

And make them play as dogs whenever they annoy me

spiral zealot
#

hello! i need some help please

#

im using this script to make an object loadable, and its giving me the error "missing ;"

brave dome
meager granite
#

Am I blind or there is no command to return all 3DEN layers? (while in editor)

#

(Not getMissionLayers)

still forum
meager granite
#

Oh, thank you.

outer loom
#

Is there a better way to do it? remoteExec xD


    if (!(isNull _flashlight)) then {
        //player setVariable ['flashlight', objNull, true];
        [player, ['flashlight', objNull, true]] remoteExec ["setVariable"];
        [[getMissionPath "sounds\flashlightButtonClick.ogg", _target]] remoteExec ["playSound3D"];

        [_flashlight] remoteExec ["detach", player];
        [_flashlight] remoteExec ["deleteVehicle", player];

    } else {
        [[getMissionPath "sounds\flashlightButtonClick.ogg", _target]] remoteExec ["playSound3D"];
        _flashlight = "#lightreflector" createVehicle position player;
        [_flashlight, [70, 40, 10]] remoteExec ["setLightConePars"];
        [_flashlight, [5, 4, 4, 0, 6, 40]] remoteExec ["setLightAttenuation"];
        [_flashlight, 90] remoteExec ["setLightIntensity"];
        [_flashlight, [1,0.81,0.62]] remoteExec ["setLightAmbient"];
        [_flashlight, [1,0.81,0.62]] remoteExec ["setLightColor"];
        [_flashlight, true] remoteExec ["setLightUseFlare"];
        [_flashlight, 0.5] remoteExec ["setLightFlareSize"];
        [_flashlight, 500] remoteExec ["setLightFlareMaxDistance"];
        [_flashlight,[player, [-0.05,0.04,0.2], "head",true]] remoteExec ["attachTo"];
        [_flashlight,-15] remoteExec ["setDir"];
        [player, ['flashlight', _flashlight, true]] remoteExec ["setVariable"];
    }
drifting portal
#

_flashlight = "#lightreflector" createVehicle position player;

#

it will only be created on the player where the code is being executed

#

instead of all the remoteExec mess

#

why don't you do something like

#
[[],{
//code that runs locally (without remoteExec)
}]remoteExec ["spawn",0];

OR
You can make it into a function and remoteExec that function (which is way better)

winter rose
#

because a function is more network-friendly than sending code over the network like that

drifting portal
#

yep

#

I was just about to say that as soon as I saw you typing

#

lol

winter rose
#

fear me πŸ˜›

outer loom
#

How to create shortcut for addAction
"Left Ctrl+W", // shortcut or i need to use DIK_KeyCodes

versed widget
#
 _x addEventHandler ["GetIn",{[_this select 0];
       hint "Test";
      _x removeEventHandler [_thisEvent, _thisEventHandler];
    }];        
} forEach vehicles;```
how does removeEH work ?
am still receiving the hint every time i Get in
tacit glen
#

hits can also be removed by using

hintSilent ""``` but this will keep the event handler running.
misty epoch
versed widget
tacit glen
#

you need to set 0 to your index of the addEventHandler

versed widget
#

ok i will give that a try though i think _thisEventHandler returns Index 0

tacit glen
#

_thisEventHandler is a local variable so you would have to define it yourself.

versed widget
open fractal
#

it is a magic variable it's already defined in the EH expression

tacit glen
#

ah right, this should work then{ _x addEventHandler ["GetIn",{ hint "Test"; (_this select 0]) removeEventHandler [_thisEvent, _thisEventHandler]; }]; } forEach vehicles;

open fractal
#

bear in mind vehicles returns a lot of stuff so that loop is redundant

versed widget
versed widget
open fractal
#

if you want to loop the event handler removal as well you need a separate forEach loop inside the {} event handler expression, in case that was your intention the first time around

#

since _x won't otherwise be defined

versed widget
#

ah ok, got it πŸ‘

drifting portal
#

How do I find a position in the sea/ocean?

open fractal
#

posATL?

drifting portal
#

?

#

I don't want it underneath the terrain

#

Outside of land mass

#

I want to spawn a boat

#

In a random spot

open fractal
#

oh

#

add "ground" to blacklist

drifting portal
#

Many thanks

brazen lagoon
#

is there a way to get spawn positions on the USS liberty?

brazen lagoon
#

how do I get coordinates relative to a model?

#

and then how do I translate that to worldspace coordinates?

little raptor
little raptor
brazen lagoon
#

@little raptor if i have 2 objects with names a and b how do I get b's relative coordinates w/r/t a?

#

is there a function for that or do I need to calculate it myself

little raptor
#

idk about functions

#

but you can do it using those commands

brazen lagoon
#

yeah ok so I need to calculate that myself

little raptor
#

well the calculations are being done by the game... meowsweats

brazen lagoon
#

true

#

wait, worldToModel is exactly what I wanted. Thanks!

little raptor
#

also always use getPosWorld / setPosWorld for those commands

brazen lagoon
#

yeah I think AGL is what I want here anyway

#

since it's going to be botes

#

ASL changes with waves right

little raptor
#

no

#

AGL does

brazen lagoon
#

ugh

#

well that sucks

little raptor
#

how were you going to use AGL anyway?

#

it's useless

brazen lagoon
#

getposworld doesn't work, odd. Maybe it's because i'm in the editor

little raptor
#

it always works

#

but yeah vehicle vars are not defined in editor

brazen lagoon
#

ah that'll do it

drifting portal
#

They work at night but not at day

#

is it because they are underwater?

#

I'm sorry for mentioning it too much but this problem has been holding me for 3 days

little raptor
drifting portal
#

Sorry for ping too

drifting portal
brazen lagoon
#

what's the locality of clearAllItemsFromBackpack?

tough abyss
#

Hello Smart people.

Does any one here think they can code a script that when ever my server side FPS hits under 10 for 60 consecutive seconds, It takes a snapshot and builds a log file for all Vics in use on my server?

Im not a rich politician, BUT I am willing to pay someone some sort financial currency. I need a starving coding student, Tag someone ya know. πŸ˜‰

#

Can I post a link to my servers here @PeopleInCharge?

#

Probably not, They are exile servers

open fractal
#

@tough abyss

tough abyss
#

Sorry lots of channels, But Thanks!

warm venture
#

@drifting portal Do you know of a way to have a control with rounded corners...?

opal zephyr
#

Anyone ever experience enableSimulation false just not working?

little raptor
opal zephyr
#

Its simply not disabling the simulation on an object, in particular its collision

#

The object is created during runtime, and only one of them exists

little raptor
#

enableSimulation never disables collision tho

#

other objects can still collide with it

opal zephyr
#

Man am I just dumb?

#

Sheesh I must be tired if I'm messing that up, I use that code all the time. Sorry Leopard, brain just skipped a beat on this one I think

little raptor
#

the collision stuff is handled by disableCollisionWith and hideObject

opal zephyr
#

Thankyou

austere nymph
#

Or is my teleport sqf wrong ?

open fractal
#

it's a bit nonsensical dude

#

why are you doing it by individual player instead of groups

#

why is JIP required?

austere nymph
#

a. no I wasn't aware - writing this from work computer bound to happen. b. Don't know how to do that c. Don't want any player who is late to the game to be teleported once they connect.

open fractal
#

you made it so they only get teleported if they were late

austere nymph
#

ok well then I didn't understand that other post that spoke about teleporters.

#

I tried inspiring myself from previous posts with a similar request - obviously I was wrong then.

open fractal
#
fn_teleport = {
    if didJIP exitWith {}; //aborts if JIP
    //title effect starts here
    private _group = group player;
    if ( _group == group1 ) exitWith { player moveInCargo plane1 };
    if ( _group == group2 ) exitWith { player moveInCargo plane2 };
    if ( _group == group3 ) exitWith { player moveInCargo plane3 };
    //sleep then end effect
};
austere nymph
#

so group1 would be Alpha 1-1 with a variable name group1 correct ?

open fractal
#

yes

#

also a couple other things

#

there is hardly ever any reason to individually define that many variables for units

#

if you're doing that chances are there's a better way

#

if you're writing the same line of code over and over like you did, there is almost certainly a better way

austere nymph
#

truth be told this is the first time I script for something multiplayer so its a bit intimidating.

#

But you are correct - I'm still learning the syntax of arma 3 and all.

#

I figured if I showed I tried i'd show i'm not sitting on my arse waiting for another kind soul to do the job.

open fractal
#

oh I understand 100% you can't learn without trying

#

I'm glad you shared it so you don't have to work with that big ol script

#

essentially what you did was define in-line functions as instructions for each player's machine to execute the teleportation

austere nymph
#

Well my work is all about screening enormous pages of code so I am biased ahahah

open fractal
#

except you defined the same function and overwrote it 45 times

#
fn_teleport = { if (didJIP) then { Player45 moveincargo Plane3};
#

and these are the only instructions that would ultimately be accessible

#

can I ask the purpose of the titleCut?

austere nymph
#

the titleCut is for another sqf file - I just edited it out of the post.

#

I want to have a fade to black and title when players are teleported

#

but that's another problem i think i can solve on my own

open fractal
austere nymph
#

is there a chance that teleporting 45 players in one go isn't gonna crash the server? Or cause a lag ? Apologies if its a dumb question i've never done this as such large scale.

#

I doubt it - but I'm told that the word ASSUME is an acronym for making an ASS at ouf U and ME πŸ™‚

open fractal
#

I think it's more likely that there is some brief lag/desync and then the mission will go on

#

but I'm not experienced with writing scripts for groups that large

austere nymph
#

Anyway thanks for the help on that.

open fractal
#

yw

#

I'll add a couple notes where you can put in fade effects in the code block I posted

austere nymph
#

Sure thing - I figured the forum post would be a good pay it forward move for future research.

meager granite
#

Huh, apparently player respawn stops loading screen for some reason thronking

meager granite
#

I'm kind of outdated, but is there a neat way to do unscheduled calls from scheduled threads? Right now I'd doing hacky stuff like:

        addMissionEventHandler ["EachFrame", {
            removeMissionEventHandler [_thisEvent, _thisEventHandler];
            // Unscheduled code here
        }];
#

@still forum Any real reason why we can't have something like callUnscheduled <Code> to run blocks of code inside scheduled environment?

still forum
#

You already have it, its called isNil

meager granite
#

Unless there is already a neat way and I'm just outdated

#

Thanks, outdated I am then.

winter rose
#

Updating @meager granite: update 2 of 54, please do not turn off your PC

meager granite
meager granite
still forum
#

no, pretty sure since A2

meager granite
#

I remember asking for something like this back in like 2014 and got told off that it would be against scheduler philosophy or something.

#

I guess they didn't know about it either.

#

Or I'm just ignorant to read through docs thoroughly

proven charm
#

could use better name for it.. a new command

meager granite
kindred zephyr
#

hello guys, I have a question regarding positions getters.

Every getter besides

modelToWorld, modelToWorldWorld, getPosWorld

works with the objects bounding box center defined by config? Or do they have their coordinates relative to box origin in one of the corners?

Im trying to find the most effective way to replace some buildings and it seems to be kind of hit or miss depending on the sloping, like it looks like the offsets become more or less according to orientation too.

still forum
#

Positions are either center of object, or landContact point of object

#

Pretty sure the model commands are all center

kindred zephyr
livid wraith
#

anyone know where (class) the Hack UAV useraction is added ?

drifting portal
#

does anyone know the reason why its not working?

still forum
#

Maybe it bugged

drifting portal
#

What else can cause such a bug?

still forum
#

It just being bugged in the game

#

Don't have time to test meh

drifting portal
#

I guess I can never do my underwater horror mission then

hallow mortar
#

Make a ticket

drifting portal
winter rose
winter rose
#

have you tried just creating it on player's position for test purpose?

drifting portal
#

without the attach and all that stuff

#

from debug on player position

winter rose
#

nighttime?

drifting portal
#

works normally

#

bright as ever

gritty stag
#

So i am trying to put a dday mission together and i want to make the us lcvp ramp open when the boat hits the beach. I used the ifa module but that only works half the time how do i make the ramps open when the lcvp lands so the soldiers can get out and storm the beach? Using ifa mod

winter rose
#

ah, setLightDaylight

drifting portal
winter rose
#

it was known not working for the flare afaik (but should work for the ambient light)

drifting portal
#

_light_emitter_0 setLightUseFlare false;

#

light system doesn't want me to do my silly diving mission (probably game knows everyone hates diving and is preventing me from doing it)

winter rose
#

fair guess

modern meteor
#

Hi, is there a way to add sleep pauses to this script? I don't want to execute the code before the screen is black.


cutText ["", "BLACK OUT"];
{
 _x moveInCargo golf1;
 _x assignAsCargo golf1;

}forEach units group player;
cutText ["", "BLACK IN"];
```#
winter rose
#
cutText ["", "BLACK OUT"];
sleep 3;
{
  _x assignAsCargo golf1;
  _x moveInCargo golf1;
} forEach units group player;
cutText ["", "BLACK IN"];
modern meteor
#

Gives an error from debug console

#

But as a script it would work?

little raptor
modern meteor
#

gotcha

little raptor
modern meteor
#

tk u both

#

just realised that you tools can run scheduled!

little raptor
# modern meteor gotcha

if you want to run scripts schd in debug console, wrap them in spawn:

[] spawn {
cutText ["", "BLACK OUT"];
sleep 3;
{
  _x assignAsCargo golf1;
  _x moveInCargo golf1;
} forEach units group player;
cutText ["", "BLACK IN"];
}
modern meteor
#

works with your tools!

#

quite nice

drifting portal
#

especially syntax checker

modern meteor
#

On a different note, is anyone aware of a script where the player can select a location on the map and the player+ai squad would be teleported to this spot?

modern meteor
#

For gameplay

#

Checking the link

open fractal
#

for debug this is fine but if you're using it for the mission there's a stackable event handler linked on that page

devout gazelle
#

Quick question ya'll:

I'd like to set the hunger & thirst values manually:
Meaning I want to make the player hungry as the mission inits.
I've searched around, but I can't find any concrete way to tweak this.

Thanks ❀️

stable dune
#

only at the beginning or continuously at your own float increment?

#

And you mean ace hunger and thirst?

#
{
        _x setVariable ["acex_field_rations_hunger",10,true]; // Hunger 10/100 at start
        _x setVariable ["acex_field_rations_thirst",10,true]; // Thirst 10/100 at start
} forEach AllPlayers;
devout gazelle
#

I need to init this from a script?

stable dune
#

i used from init.sqf

devout gazelle
#

Thanks!

surreal peak
#

pulling my hair out with this:

                ["zen_common_addObjects", [[_dog]]] call CBA_fnc_serverEvent;
                _dog setName ([selectRandom ["Fluffy", "Doggo", "Cuddles", "Santa's Little Helper", "Biter", "Foxer", "Boxy", "Death", "SirKillsALot"], _name]);
                _dogMan setName _dog;
                
                // If no side to be attacked are provided, dog is peaceful
                if (count _attackSides == 0) exitWith {
                    // If dog is peaceful, dog can be allowed to have own AI
                    _dog setVariable ["BIS_fnc_animalBehaviour_disable", false];
                    
                };

                // Turn off AI in dog
                _dog setVariable ["BIS_fnc_animalBehaviour_disable", true];

This is a snippet of code,

20:28:39 Error in expression <BIS_fnc_animalBehaviour_disable", false]; 
                     
      >
20:28:39   Error position: <", false]; 
                     
      >
20:28:39   Error Missing ;

This is the error.

If the error isnt here I can do a SQFBin

#

Last time I ran this code was about a year and a half ago and I thought it worked... Aparently not

#

what am I doing wrong here?

winter rose
surreal peak
#

Alright, now im confused. If I comment out the offending lines, I get the same error

open fractal
surreal peak
#

debug console

open fractal
#

as a function or pasting straight in?

surreal peak
little raptor
surreal peak
#

will remove all comments in code

little raptor
#

or use better debug consoles

surreal peak
#

does debug console break with comments?

#

oh ffs

#

yeah it works. ty

little raptor
#

mine doesn't

surreal peak
surreal peak
#

TBH you might as well pin that since it will be very useful

devout gazelle
surreal peak
devout gazelle
#

Forgive me ignoranse fellas: I wanted to create a simple untie script where the player (p1) first has to untie himself the remove his blindfolds.

I tried to do it like this, but I am getting some errors πŸ˜›

[] spawn { 
Private _BlindfoldRemoved = 0;
[p1, ["Remove blindfold", 
    {
        hint "You removed your blindfold."; 
        p1 unassignItem "G_Blindfold_01_black_F";
        _BlindfoldRemoved = 1; 
        removeAllActions p1;
        
    }]] remoteExec ["addAction", 0, true];

sleep 3; 

if (_BlindfoldRemoved == 1) then 
{
[p1, ["Untie yourself", 
    {

        hint "You successfully untied your hands."; 
        p1 enablesimulation true; 
        p1 switchMove ""; 
        removeAllActions p1;
        
    }]] remoteExec ["addAction", 0, true];
};
};

little raptor
devout gazelle
little raptor
#

idk what you mean

#

if the player has to untie himself you shouldn't show the action to other players

devout gazelle
little raptor
#

ok. well in this case you don't need that

#

just put a simply addAction in initPlayerLocal

devout gazelle
little raptor
#

as for the problem, your scopes are wrong

little raptor
#

the correct way to do it would be to add the other action inside the first action

devout gazelle
#

Roger - I think I get it

#

This was a hasty script - but I should probably learn more about scopes πŸ˜›

#

Thanks for your time

modern meteor
#

How can I spawn a helicopter via sqf script and assign a variable name to this object?

drifting portal
#

If you want to delete it for example

DeleteVehicle VariableName;
modern meteor
#

Thank you. So if want to move the player as cargo into this object I would use:

player moveInCargo _Helicopter;
drifting portal
#

No

#

It depends

#

When will you move him?

#

As soon as its created or later

modern meteor
#

As soon as it has been created

drifting portal
#

Yes then true

drifting portal
modern meteor
#

Ok

#

Checking

drifting portal
#

helicopter explodes

modern meteor
#

all good

#

works for my purpose

#

Thank you

modern meteor
little raptor
#

deleteVehicleCrew

modern meteor
#

Got it all sorted

#

The last problem which I have is that the Heli already departs before my team could exit the chopper

#

It basically just lands for 1-2 sec and then departs again

#

Not sure why

granite sky
#

Is it waypointed or what?

modern meteor
#

Yes

#

It's a waypoint

granite sky
#

TR UNLOAD?

modern meteor
#

dont know what that is

#

TR UNLOAD

granite sky
#

waypoint type.

#

It's the one where it unloads any AI cargo.

#

If you're talking about player cargo then that may not work anyway.

modern meteor
#
        _wp = _heliGrp addWaypoint [_posToLand, 0];
        _wp setWaypointType "MOVE";
        _wp setWaypointBehaviour "CARELESS";
        _wp setWaypointCombatMode "GREEN";
        _wp setWaypointSpeed "NORMAL";
        _wp setWaypointFormation "COLUMN";
#

is the waypoint

#

how do i change it to cargo unload?

#

think i found it

#

testing it

hallow mortar
#

Sometimes the land command works better since it forces them to turn off the engine, so they can't instantly take off again.
I'd also keep an eye out for 2.10 because this note was in the latest dev branch changelog:

Fixed: Helicopters 'hopping' when landing due to telling AI to disembark

open fractal
#

my favorite ai quirk is when the pilot goes to land and utterly pranks the cargo by lifting off as they get out

#

tbf though I might've only seen that happen when I manually put the helicopter down on the helipad

modern meteor
#

I already had a few accidents

hallow mortar
#

That's one I had to deal with quite recently for a mission intro. Even using land command in addition to "LAND" waypoints it doesn't seem to be completely solved. Hopefully this 2.10 fix will clear it up.

drifting portal
#

I would suggest using waitUntil and touching ground then disabling crew AI

modern meteor
#

Good idea

#

I will try this

granite sky
drifting portal
#

I usually saw that glitch a lot in pub zeus

#

They land and immediately lift off

#

Pranking the cargo in the process

#

Resulting in the zeus vaporizing the helicopter and putting a new respawn point because he is too sick of AI now

open fractal
#

at this point i just use unit capture to script qrf landings

#

because the ai never land with any urgency

opal zephyr
#

This won't sleep, says its not allowed... is there another way to do it?

[]spawn{
  testFunction = {
    sleep 0.5;
  };
};
opal zephyr
#

Another thing, if I try and call a function inside of itself my game crashes... the actual line passes a variable into the call function

#

Ok with some more testing it looks like passing the variable into that recursion call is what was making it crash... I think

little raptor
opal zephyr
#

That was solely an example

little raptor
opal zephyr
#

I had it run only once

#

and it still crashed

little raptor
#

well I can't say what you're doing wrong without seeing the actual code

opal zephyr
#

one sec

little raptor
#

but what you posted has no issues itself

opal zephyr
#

I can't get it to replicate the crash now, jeez this has been doing it for almost an hour and now it doesnt. Great...

Going back to the sleep issue, the function is being called from an EH, would that possible contribute to its failure?

drifting portal
#

If it has sleep spawn it

opal zephyr
#

I am spawning it

drifting portal
#

Please send code

opal zephyr
#
_vehicle addEventHandler ["Killed", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];            
    [_unit] call planeKilled;
}];

[]spawn {
  planeKilled = 
  {
  sleep 0.5;
  };
};
drifting portal
#

What

open fractal
#

[_unit] spawn planeKilled;

#

that's how you run a function scheduled

drifting portal
#

And do

planeKilled = {... };
#

Instead of defining it inside a spawn

open fractal
#

yeah you don't need spawn to define a function

opal zephyr
#

That seems to have done it, thanks

drifting portal
#

Just don't kill too many vehicles it hurts

acoustic abyss
#

I am having trouble with controlling a script. Specifically, creating a and deleting a say3D sound.

My aim is to have a radio object play a default sound ("Radiostatic") that switches to a tuning sound ("Radiotuning") during a holdAction, to finally a radio message ("Radiomessage"). With the complication, that when the player interrupts the holdAction, that the default sound starts again.

This is in the init of the radio object:

radiostat = [this] spawn 
    {while {true} do 
            {(_this select 0) say3D "Radiostatic"; 
            sleep 36
                        };
    };
#

And the holdAction is:

[
    radio1,                                // object the action is attached to
    "check radio",                            // Title of the action
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    // Idle icon shown on screen
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_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
    {
    terminate radiostat;
    radio1 say3D "Radiotuning"},                                    // Code executed when action starts
    {terminate radiostat;},                        // Code executed on every progress tick
    {radio1 say3D "Radiomessage";},                                    // Code executed on completion
    {radiostat = 
            [] spawn {while {true} do 
                        {radio1 say3D "Radiostatic";
                        sleep 36;
                        };
                     }
        },                                // Code executed on interrupted
    [],                                // Arguments passed to the scripts as _this select 3
    14,                                // action duration in seconds
    0,                                // priority
    true,                                // Remove on completion
    false                                // Show in unconscious state
] remoteExec ["BIS_fnc_holdActionAdd", 0, radio1];            // MP compatible implementation

Result is that the default sound (script handle radiostat) plays fine, and stops fine during the holdAction. But when I interrupt the holdaction, I get duplicate default sounds playing. And these duplicates don't terminate (probably because I am not tracking the new script handles).

#

What's an elegant way to close this?

little raptor
#
//fn_loopSoundOnRadio.sqf

params ["_obj", "_sound"];
terminate (_obj getVariable ["soundScript", scriptNull]);
deleteVehicle (_obj getVariable ["soundObj", objNull]);
_obj setVariable ["soundScript", _thisScript];

while {true} do {
  _soundObj = _obj playSound3D _sound;
  _obj setVariable ["soundObj", _soundObj];
  sleep getNumber(configFile >> "CfgSounds" >> _sound >> "duration")
};
[radio1, "Radiomessage"] spawn my_fnc_loopSoundOnRadio
acoustic abyss
#

I see, deleteVehicle the radio1 object? So I'd basically make and delete a dummy object every time?

acoustic abyss
#

I am using custom made sounds.

sleep getNumber(configFile >> "CfgSounds" >> _sound >> "duration")```
Is there another way of getting the duration of a sound file?
acoustic abyss
#

Fair enough

little raptor
#
params ["_obj", "_sound", "_duration"];
...
sleep _duration
little raptor
acoustic abyss
#

Because of the sleep?

little raptor
#

no I mean the terminate part

#

it does:
_obj setVariable ["soundScript", _thisScript];

#

in scheduled environment

#

which if the scheduler doesn't see in time before you cancel your hold action it might never happen

#

a safer way would be to do it in unscheduled environment

#

or doesn't have to be unscheduled

#

as long as the script is registered before it executes

#

this will 100% guarantee it:

#
//fn_loopSoundOnRadio.sqf
isNil {
  params ["_obj"];
  terminate (_obj getVariable ["soundScript", scriptNull]);
  deleteVehicle (_obj getVariable ["soundObj", objNull]);
  _handle = _this spawn {
    params ["_obj", "_sound", "_duration"];
    private _soundObj = _obj getVariable ["soundObj", objNull];
    while {true} do {
      deleteVehicle _soundObj;
      isNil {
        _soundObj = _obj say3D _sound;
        _obj setVariable ["soundObj", _soundObj];
      };
      sleep _duration;
    };
  };
  _obj setVariable ["soundScript", _handle];
}

call as:

[radio1, "Radiomessage", 10] call my_fnc_loopSoundOnRadio
#

isNil makes codes unschd

#

the reason I put them there is to make sure that those parts in isNil happen together

acoustic abyss
#

Interesting. And _this:

 _handle = _this spawn {

Gives the script handle? Also new to me.

little raptor
#

e.g. :

isNil {
        _soundObj = _obj say3D _sound;
        _obj setVariable ["soundObj", _soundObj];
      };

if you terminated the script when engine had executed say3D but before the setVariable you would never be able to delete that object

little raptor
#

spawn does

#

_this were the parameters you passed to the function

#

which I'm just forwarding to the spawn

acoustic abyss
#

Thank you for explaining.

drifting portal
#

is there a way to increase a player's running speed?

acoustic abyss
#

Change animation speed I understand.

little raptor
#

setAnimSpeedCoef meowsweats

drifting portal
#

that's why I asked lol

acoustic abyss
#

There's about a dozen scripts on the forums.

drifting portal
#

knew Leo will supply me directly with it so I posted here lol

acoustic abyss
#

One of these days we will have to bake Leo a cake for this efforts in getting our missions and mods to work.

drifting portal
#

a gigantic one is needed

#

will cause an egg shortage on our way

acoustic abyss
#

_cake setObjectScale 20

opal zephyr
#

speaking of setObjectScale, does it not work on objects created with createSimpleObject?

warm hedge
#

It should work

little raptor
#

if it works with anything it's gotta be those

opal zephyr
#

hmm

little raptor
#

it says simple + attached objects on the label πŸ˜…

opal zephyr
#

Thats why im confused. I know its apparently possible to do to simulated objects with a loop, but im tying it with a simpleobject rn to no luck

little raptor
#

what kind of object is it?

opal zephyr
#

"CraterLong"

little raptor
#

aren't those decals?

#

I doubt it works with those thonk

opal zephyr
#

nah, its the 3d plane crater

little raptor
opal zephyr
#

yup

#

I just tested calling the script with the console and it worked fine... interesting

#

The test script I was using calls it the exact same way

little raptor
little raptor
opal zephyr
#

Ahah I think I got it

#

If you make any adjustments to its position after scaling it, it resets

#

like setDir or setVectorUp for example

little raptor
#

yeah

#

I'll put it on the wiki for posterity

warm hedge
#

Basically everything that tweaks its position/direction resets the scale

little raptor
#

I doubt position does thonk

#

with direction it makes sense

#

because it likely normalizes the dirs

drifting portal
#

Keyframe animation resets it for simple object as far as I know

little raptor
#

which means scale in transformation matrix becomes 1

drifting portal
#

If thats position update?

little raptor
drifting portal
little raptor
#

position, velo, orientation

drifting portal
#

I thought there is mode to it

#

Where it doesn't change anything but the position

#

Damn

little raptor
warm hedge
#

Hm

little raptor
brave dome
little raptor
#

spawn is scheduled

#

isNil is unscheduled

#

if you meant call, call doesn't change the environment

#

call in schd -> schd
call in unschd -> unschd

brave dome
#

Oooooh

#

So calling a function with call inside a spawned function won't make it wait till the called function is finished?

little raptor
#

it does

#

it executes in the spot

brave dome
#

Thanks for making it super clear for me πŸ˜…

little raptor
#

as if the code was there

brave dome
#

Aah

little raptor
#

it just doesn't create a new "thread" (sqf is single threaded tho)

#

it's the perfect way to execute a function and wait for it to finish, as opposed to doing:

_handle = [] spawn ...
waitUntil {scriptDone _handle}

which is super wasteful

brave dome
#

Ok got it. So using isNil is more comparable to asynchronous functions in JavaScript?

#

Or do I mix up something now

little raptor
#

no. nothing is truly "async" in sqf. they're more like non-preemptive multitasking

#

a scheduled script is like a coroutine, which can be "paused"

#

isNil is like calling a normal function (subroutine)

brave dome
#

Thanks for making that clear to me 🀩

opal zephyr
#

Im playing with the setscale thing some more, and its possible to set the scale of an object that isnt a simpleObject. Not only that, but it also retains a properish collision. Where as making it a simple object and then scaling it actually removes its collision

#

Very interesting. I wonder if the wiki just hasnt been updated in a long time

little raptor
#

but in some cases it might cause problems

#

or not work at all

opal zephyr
#

A comment on the page mentions the ability to, but that is has to be every frame. But im putting it in the init of an object and it works fine

little raptor
#

yeah I should add that it does work on static non-simple objects

acoustic abyss
#

I am trying to spawn a group of planes in the air.

However, I cannot get BIS_fnc_spawnGroup to spawn above terrain. Eg:

[[1792.98,5530.61,500] , west, (configfile >> "CfgGroups" >> "West" >> "BLU_CTRG_F" >> "Infantry" >> "CTRG_InfSentry")] call BIS_fnc_spawnGroup;
// on Stratis airbase

Groups always seem to spawn at terrain level regardless of Z value. Have tried getting the position of a logic or marker object.
How can this be compensated?

warm hedge
#

You can probably just setPosWorld them all afterwards

acoustic abyss
#

Simply setPosATL the third value for them after they've spawned?

#

Right.

#

It's suprising to me: you'd think BIS would want to be able to spawn paratroopers or whatnot. I couldn't find any previous question in the forum or Discord. I suppose I will have to do it the hard way πŸ˜„

open fractal
#

setScale won't get you the same results outside the editor

acoustic abyss
#

I tried identifying the planes beforehand, with:

{  if  (!(vehicle _x iskindof "man")) then { _veh= _veh + [vehicle _x]} } foreach units _grp;

And then using the setPosATL on the _veh array. No dice.

proven charm
#

change veh to _veh

acoustic abyss
#

I'm going to change my above entry, so others can use my work to specify height above terrain for BIS_fnc_spawnGroup. Sankyoo.

sacred slate
#

for performance reasons i like to make some SP scenario on a dedicated server. is this onPlayerKilled.sqf script still possible? https://pastebin.com/Y8QnNtn3

little raptor
little raptor
#

Many vanilla terrains have 200m deep waters...

#

Also use set to change array elements...

little raptor
proven charm
#

pushBackUnique in fact

tough trout
#

So, I use a fairly simple teleportation addAction

It works perfectly for me 100% of the time. How would I modify it to both: a) select a randomized marker from a list, and b) make it so it's within a say 100m horizontal radius of the marker?

winter rose
wheat vigil
#

I have a question. i'm wondering if setTriggerStatements changes the trigger condition locally to the player who run the script or to every player

wheat vigil
#

thanks

wheat vigil
#

Also, im trying to find reverse to player in thisList something like
player !in thisList. may someone know?

granite sky
#

!(player in thisList)

wheat vigil
#

thanks again, didn't think of that πŸ˜…

drifting portal
#

is it possible to enable PIP for clients?

#

so that they can see the render 2 texture instead of a white picture

still forum
#

no

drifting portal
#

hmm

#

I guess we will have to fake it then

#

static image combination with isPiPEnabled
if enabled go ahead and run the r2t
if not show the static image

oblique arrow
#

Hm any chance any of you peeps have experience with the virtual arsenal interface?
When I open the normal arma 3 virtual arsenal mission the interface at the bottom has an exit and a try option

#

But when I make a seperate virtual arsenal mission based on that one it only has a close option which closes the arsenal interface, making the mission an inescapable hell 7051_fire

willow hound
#

I don't know if the Virtual Arsenal mission does it like this, but you can work with the Arsenal UI (without modifying its source code) to some degree using the arsenalOpened Scripted Event Handler.
For example, I wrote the following code to prevent players from accessing certain features of the Arsenal:

[missionNamespace, "arsenalOpened", {
    disableSerialization;

    params ["_arsenalDisplay"];

    //Disable certain buttons:
    {
        private _button = _arsenalDisplay displayCtrl _x;
        _button ctrlEnable false;
        _button ctrlSetTooltip "";
    } forEach [44146, 44147, 44148, 44149, 44150]; //Save, Load, Export, Import, Random

    //Override the corresponding keyboard shortcuts (all involve the Ctrl key):
    _arsenalDisplay displayAddEventHandler ["KeyDown", {
        _this # 3
    }];
}] call BIS_fnc_addScriptedEventHandler;
oblique arrow
stuck palm
#

I am trying to get a trigger to detect and place markers for specific building types:

Land_Cargo_Tower_V1_No1_F Land_Cargo_Tower_V1_No2_F Land_Cargo_Tower_V1_No3_F Land_Cargo_Tower_V1_No4_F Land_Cargo_Tower_V1_No5_F Land_Cargo_Tower_V1_No6_F

I found this post:

https://forums.bohemia.net/forums/topic/184731-trigger-to-detect-houses-and-place-marker/?tab=comments#comment-2912808

tried the following in condition, but gives me an invalid number in expression

"count nearestObjects [getPos thisTrigger, [
"Land_Cargo_Tower_V1_No1_F",
],( triggerArea thisTrigger ) select 0 ] > 0"

brazen lagoon
#

any way you can set up a respawn camp from the tent instead of the backpack

#

like, a function you call on the tent

brazen lagoon
#

not what I'm asking

open fractal
#

?

brazen lagoon
#

I specifically want the way the tent works, but by spawning the tent instead of the backpack

open fractal
#

remind me?

brazen lagoon
#

if you spawn B_Respawn_TentA_F, you can take it as your backpack

#

and then you can place it down, and there'll be another action to pack it back up into a backpack

#

that's what I want, that backpack functionality

#

nvm figured it out

granite sky
#

@stuck palm You have an array with a trailing comma, which isn't allowed in SQF. You shouldn't be doing anything that complicated in a trigger condition anyway though, and I'm not sure why you'd use a trigger for houses at all. They don't normally move.

worthy igloo
#
     {
        params [
            ["_centre", position player, [[]]],
            ["_radius", 250, [0]],
            ["_dir", random 360, [0]]
        ];
        _pos = _centre getPos [_radius, _dir];
        _bolt = createVehicle ["LightningBolt", _pos, [], 0, "CAN_COLLIDE"];
        _bolt setPosATL _pos;
        _bolt setDamage 1;

        _light = "#lightpoint" createVehicle _pos;
        _light setPosATL (_pos vectorAdd [0,0,10]);
        _light setLightDayLight true;
        _light setLightBrightness 300;
        _light setLightAmbient [0.05, 0.05, 0.1];
        _light setlightcolor [1, 1, 2];

        sleep 0.1;
        _light setLightBrightness 0;
        sleep (random 0.1);

        _lightning = (selectRandom ["lightning1_F","lightning2_F"]) createVehicle [100,100,100];
        _lightning setdir _dir;
        _lightning setpos _pos;

        for "_i" from 0 to (3 + random 1) do {
             _time = time + 0.1;
            _light setLightBrightness (100 + random 100);
            waituntil {
                time > _time
            };
        };

        deletevehicle _lightning;
        deletevehicle _light;
    };
    
    while {true} do {
        _intensity = 2 + floor (random 3);
        for "_i" from 0 to (_intensity -1) do {
            [position player, linearConversion [0, 1, random 1, 300, 800]] call _fncLightning;
        };
        sleep 2 + (random 2);
    };
    };```
in its current state lightning hits the bottom of the ocean is it possible to make it target the top of the water
little raptor
#

and most certainly don't use position and getPos commands...

worthy igloo
little raptor
#

the z of _pos in your code is 0

#

so if you use setPosATL you end up at the bottom of the ocean as you said

drifting portal
#

setPosATL [x, y, 0] is under water?

little raptor
#

yes

drifting portal
#

That's weird, why would it do that?

#

Or you mean if you are standing above water

little raptor
#

because the terrain is under water

drifting portal
#

Ah ok

#

I was worried for a bit

#

Lol

#

Is there a way to workaround zeus destroying all cameras?

#

Basically a way to recreate them when interface is closed?

#

(Is there an eventhandler for interfaceClosed?)

little raptor
drifting portal
#

Forgot that I can do that

#

Thanks

worthy igloo
open fractal
#

the z value of posATL is height above the ground, setting it to zero puts the position on the ground or the bottom of the ocean.

worthy igloo
#

ye but im trying to get it give or take on the surface of water i looked at getPosASLW

open fractal
#

if you want height above water use posASL (or posASLW to include waves)

worthy igloo
#

?

open fractal
#

if _bolt is an object and _pos is an array in format [x,y,z]

little raptor