#arma3_scripting

1 messages Β· Page 208 of 1

winged thistle
#

(Especially wonky at night with a moon out. Teleportation moon...)

austere granite
#

It doesn't halt time, but at least makes it 10 times slower

#

@winged thistle <ding.

winged thistle
#

Thank you sir!

pallid palm
#

hello all: How would i cods this better: for the player to have to stay within 3m of a LabTop:
or the script will exitWith:
i must be doing something wrong:

if ((_player distance _object1) >=3) exitWith
{
    "Downloading Canceled\nYou Must Stay Near The Laptop" remoteExec ["hint", 0];
    "invalidCoords" remoteExec ["playSound"];
};
fair drum
#

is there anything else to this around it?

pallid palm
#

ummm yes

#

here ill put it all up

#
private _timeleft1 = 50;
while {true} do {
    hint format ["Downloading... :%1", [((_timeleft1)/60)+.01,"HH:MM"] call bis_fnc_timetostring];
    if (_timeleft1 < 1) exitWith {"HintSound" remoteExec ["playSound"];};
    if ((_player distance _object1) >=3) exitWith
    {
        "Downloading Canceled\nYou Must Stay Near The Laptop" remoteExec ["hint", 0];
        "invalidCoords" remoteExec ["playSound"];
    };
    _timeleft1 = _timeleft1 - 1;
    "HintSound" remoteExec ["playSound"];
    sleep 1;
};
#

it seems to go past the exitWith

#

even if i go away from the labtop

fair drum
#

i'm assuming this script is run every time they reenter and hit like an action or something?

pallid palm
#

yes addaction in a labtop

fair drum
#

move your distance conditional into the while conditional

#

have the stuff in the exitWith after the while loop

pallid palm
#

ahhhh ok cool yes

#

thx man your Awsomre why didnt i think of that

winter rose
#

hold your breath

#

you'll become… hypoxic

pallid palm
#

lol hahahah good 1

winged thistle
#

Exactly what I was looking for.

old owl
#

That was as funny as it was terrible

#

Haha

winter rose
#

"I feed on the braincells leaving your ears" is what I tend to say :D

pallid palm
#

dam they shot my Ex chopper while i was at the labtop πŸ™‚

#

now i must call the chopper and w8 till it gets here πŸ™‚

glad birch
#

hey guys, new on scripting here, i wanted to know if its possible to make the pilot of any armed chopper with a main rotatory gun that is controlled by the gunner ,make it fully controlable from the pilot seat without the restriction of the main gun locked to only shoot and not move, is principaly because where i play there is no one that wants to be the gunner

pallid palm
#

you can just put Manual fire on in the menu commands of the chopper or just have a Ai guy in the Gunner seat and the Ai will do Aswome : even at very low skill

#

and group the Ai guy to you and you can order him to target diff targets

#

after Manual fire Mode is on: switch to diff fire mods like the main gun or rockets

#

i forget if you can not have the main gun locked or not, as pilot, i guess not maybe

pallid palm
#

cuz i kinda remember having to get in the gunner seat and make the main gun be set where i wanted it then getting back inthe pilot seat πŸ™‚

glad birch
#

yes, that what am using right now

split ruin
#

I have a problem, task doesn't create on a FOB positions
I have all fob pos on Altis as public variable

KIB_fobPos =
  [
    [12299.7,8874.09,0],
    [8315.24,10063.8,0],
    [10009.4,11235.1,0],
    [3037.7,13185.6,0],
    [5233.49,14192.8,0],
    [4867.37,21911.1,0],
    [9706.21,22308.9,0],
    [9961.02,19355.7,0],
    [13819,18967.9,0],
    [16600.2,19037.1,0],
    [12809.9,16683.8,0],
    [15357.4,15874,0],
    [16770.3,14982.8,0],
    [20591.4,18813.2,0],
    [21022,18981,0],
    [20596.2,20113.7,0],
    [25301.2,21797.8,0],
    [28317.4,25775.4,0],
    [22636.5,16819,0],
    [14280.3,13031.8,0],
    [15407.3,11343.7,0],
    [20083.5,6730.44,0],
    [23062.8,7279.58,0],
    [16664,12293.8,0],
    [16824.5,12047.8,0]
  ];
publicVariable "KIB_fobPos";

then I want to create a task on a random FOB pos

_uberPos = selectRandom KIB_fobPos;
[KIB_mySide, "tsk", "fob", _uberPos, "CREATED", 1, true, "attack", false] call BIS_fnc_taskCreate;

the task marker ends up somewhere completely random in the see πŸ˜”

hallow mortar
#

Is it actually completely random or is it the same wrong position every time?

split ruin
#

its random, FOB positions are legit, I tested them one by one with

player setPos [12299.7,8874.09,0]; //for all positions etc 
split ruin
#

good idea

#

yeah it gives false positions

_uberPos = selectRandom KIB_fobPos;
player setPos _uberPos;

player ends up in random place, not in the predefined position πŸ€”

#

wtf is wrong here ...

thin fox
#

and what did you get from that

#

if it matches with the predefined positions

split ruin
#

no, it doesn't

thin fox
# split ruin no, it doesn't

so, what I can recommend for you rn, is to have empty markers in those positions, in the editor, and get the markers using the same command, and then get the position of the selected marker instead

#

place one or two markers and test it

faint burrow
#

Where KIB_fobPos is set and where tasks are created? Both should be on the server.

split ruin
#

I don't want to have so many markers for performance reasons 🫣
the same thing with comm towers is working fine

KIB_enemyCommTowersPos =
 [
  [18708,10222.2,0],
  [19359.1,9687.59,0],
  [17851.4,11735.9,0],
  [25295.5,21817.8,0],
  [26454.4,22175,0],
  [26279.2,22188.7,0],
  [4264.85,20663,0],
  [6839.78,16163.1,0],
  [4572.56,15389.6,0]
 ];
 publicVariable "KIB_enemyCommTowersPos";

then

_uberPos = selectRandom KIB_enemyCommTowersPos;
[KIB_mySide, "tsk", "comms", _uberPos, "CREATED", 1, true, "download",false] call BIS_fnc_taskCreate;

works perfectly

#

@faint burrow both executed on server

faint burrow
#

Then check if KIB_fobPos is overwritten.

split ruin
#

@faint burrow you are genius/me idiot, I have it defined again at the end with positions from the previous map I made, so it got overwritten, thank you so much 🍻

thin fox
#

πŸ‘

faint burrow
#

I, like @thin fox, recommend using markers, as it is more visual and easier to maintain.

split ruin
#

yeah, generally but there are zillions of positions for things on the map - fobs, bases, convoys, comm towers, trenches, etc and markers cost resourses (much less then triggers but still)

faint burrow
#

And markers don't affect performance, only the size of mission.sqm file.

split ruin
#

Trying to follow logic ... Placed markers make mission.sqm file bigger since they are like every object placed in eden. Predefined positions don't , they are stored in other file called from server. 🀷

thin fox
faint burrow
#

Plus, since you have a lot of positions (for FOBs, convoys, etc), you can place markers in different layers and hide them, use different colors, etc.

thin fox
#

if you're not doing a liberation 2.0, that is know to have performance issue because of bad scripting, you shouldn't be worried about the performance in your mission, most of dynamic scenarios use markers because it's easier to maintain, like Schatten said

split ruin
#

i am making a sandbox on liberation scale but different gameplay
if it was coop mission I won't be concerned with performance so much

faint burrow
#

Plus, mission file binarization can be used, this slightly reduces the size.

split ruin
#

I don't even use custom pics because the .sqm size I said bs πŸ˜‚

thin fox
#

I was going to say something haha

split ruin
#

pve

split ruin
#

how to check the "class type" of object ? I have garrison script, its working for houses, some towers but I want to add bunkers

_validHouse = nearestObjects [_uberPos, ["house"], 100];
hushed turtle
#

What's the purpose of sleep .5 in there?

stable dune
#

it doenst

thin fox
split ruin
#

@thin fox yeah, quicker this way ...

#

I have a question connected with what @faint burrow said about mission.sqm size ... When things spawn after the mission start does mission.sqm gets bigger like dynamically or it doesn't matter?

tough abyss
#

I have played around with putting an addAction in the init of various in game items. Specifically ones that can be picked up and kept in inventory by players. The action works when walking up to the item and triggering it. However, when you pick it up and place it inventory, the command no longer works when placed on the ground again.

Is there a script way to force the action to be available, or is this just a quirk of the engine?

#

I am thinking that it erases the line each time. I am hoping there is a work around to add the script to all items of that class variable, when they are accessed or spawned.

#

So far cell phone and laptop. Vanilla/DLC, no mods.

split ruin
#

@tough abyss setVariable

tough abyss
# split ruin <@456226577798135808> setVariable

Thanks, looking at the wiki now. How do I tie this example to an SQF? I am still new to writing stuff off the cuff, but should be able to swing it if I know how to retrieve the correct script.

#

_myTruck setVariable ["TAG_myPublicVariable", 123, true];

split ruin
#

if the object gets destroyed

missionNameSpace setVariable ["MAR_someName", 123, true];
//then 
_variable = missionNameSpace getVariable "MAR_someName"; 
#

but if its just addAction you can reapply to the new object

#

you can use EH

(backpack player) addEventHandler 
[
  "Take", 
  {
    params ["_unit", "_container", "_item"];
    if (_item == "classname_of_item") then 
      {
        _item addAction ["Something",{your_code}];
       } else {};  
}];
#

@tough abyss this will add addAction to an item with specific classname you take out from your backpack

tough abyss
split ruin
#

I call this "buying laptop" the player have to put on the ground first and start buying πŸ˜†
better solution will be just addAction to player that opens a proper buying menu but good luck with GUI scripting

tough abyss
#

I can add a button to the main one, and all of the shops to a web browser that pops up.

#

I have the gui made, and can add new pages/scripts no problem. Just need an idea of how to make the "if" to use that new button, be possession of the item class.

split ruin
#

just check if the player have it

tough abyss
#

Wow, overthought that one, lol. Can you send me the variable for that? I can read the wiki. Should have it sorted now.

split ruin
#

this can be used to check if player has an item with specific classname

#

everywhere - uniform, vest and backpack

tough abyss
faint burrow
tough abyss
#

One last thing. Just want to be sure I have it, fully. We wanted to make these usable only in major towns, and at Internet cafes. I can use a trigger area and hasItem for that?

#

As if using WiFi

faint burrow
#

Yes, I believe this is the most optimal option.

split ruin
#

I sense Jagged Alliance inspired scenario πŸ˜†

primal trench
#

Is there a way to disable all damage to players from vehicle impacts?

warm hedge
#

What is "vehicle impacts"

primal trench
#

Like from being hit by a vehicle

split ruin
#

I have found something fishy, there is no position in "Land_HBarrierTower_F"

_bunker buildingPos 1;

returns [0,0,0];
no available pos a unit can spawn
same command applied to "normal" bunker "Land_BagBunker_01_large_green_F"
gives [5886.69,3064.83,23.6902] and a unit can spawn inside

hallow mortar
# split ruin I have found something fishy, there is no position in "Land_HBarrierTower_F" ```...

First, don't forget to try buildingPos 0 as well. Arrays are typically zero-indexed, meaning the first element is index 0, so if there's only one position in the building, then it may be position 0 and position 1 doesn't exist.
Second, building positions are manually set up as part of the building model. If whoever made the building model didn't put any in it, then there aren't any to find. Not fishy, just lazy or inexperienced modellers.

tulip ridge
# primal trench Like from being hit by a vehicle

Not really for vanilla, the vehicle isn't passed to handleDamage. You could try grabbing nearby vehicles and checking if the ammo is empty, but won't be reliable

I think with ace you may be able to, they have a setting for if you should take damage when the vehicle you're in hits an object. I imagine it's the same story though, vehicle isn't passed to the wound handler iirc

split ruin
#

@hallow mortar doesn't give good position neither, its [0,0,0]

tulip ridge
#

The vanilla one doesn't have positions

#

That's just it

split ruin
#

but a vanilla bunker "Land_BagBunker_Large_F" have 12 perfectly fine positions πŸ€”

tulip ridge
#

It's different per object (technically model)

hallow mortar
#

Second, building positions are manually set up as part of the building model. If whoever made the building model didn't put any in it, then there aren't any to find. Not fishy, just lazy or inexperienced modellers.
Lots of things in Arma are inconsistent because they were made by different people and/or at different times.

split ruin
#

@hallow mortar unfortunately you are right, same thing with towers, some have positions and some don't 😀

thin fox
pallid palm
split ruin
#

@thin fox is the code working with unit class names because I want to spawn infantry ?

split ruin
#

got it, I will work it out tomorrow, it will be very helpful for no pos buildings, bunkers, etc

willow hound
#

@crimson lion About #arma3_feedback_tracker message:
For the six-digit grids in vanilla A3, converting from grid to position is simple. If I remember correctly, each grid square has a size of 100Γ—100 meters.
You take your grid string (e.g. "018056"), split it in the middle to get X and Y (["018", "056"]), parse each part as a number ([18, 56]) and multiply that number by 100 ([1800, 5600]).
The longer the grid string, the more accurate the location: If the grid string only had four characters, you would multiply by 1000; if it had eight characters, you would multiply by 10.

crimson lion
#

What I have is a script that is putting a dot on every grid that has an eligible building within it (eligible buildings are calculated external of this part of the script as Bro_NmeBuildings), please forgive me if this is sinfully bad. I want to make a working thing before I make an optimized thing: https://pastebin.com/pXGQQsge

willow hound
#
// find any building within 50m of this grid center
private _nearby = Bro_NmeBuildings findIf {
    _x distance2D _gridPos < 50
};
```This part is not correct. `_gridPos` is the center of a 100Γ—100 square. You want to know if that square contains `_x`, but you search a circle with radius 50. That circle does not cover the entire square.
#

Have you seen https://community.bistudio.com/wiki/mapGridPosition ?
You could do ...

private _grids = Bro_NmeBuildings apply { mapGridPosition _x };
```... to get an array with all grids that contain an eligible building. Then you could calculate the position of each grid with `BIS_fnc_gridToPos` and place your markers.
A more efficient approach would be taking the position of an eligible building (e.g. `[1234.5, 6789.0, 42]`) and doing some math magic to round the X and Y coordinates down to the nearest multiple of 100 (`[1200, 6700, 42]`). Then you could place your marker at `[1250, 6750]`.
pallid palm
#

man you do all that: man i just place down markers near where i want: ( what ever to happen) like i have like 50 markers at per defined locations: then i just select random a marker and make happen what ever i want to happen at the random selected marker

#

if i'm dealing with houses or buildings then i place some markers within some buildings area around the map

#

but every grid pos wow oh man

#

i knida see what you are doing there but wow lol πŸ™‚

#

i reason i place the markers at per defined locations is so no docks or over water locations can be picked

#

it all depends on the radius i'm using from the markers also

#

really the most markers i ever had was 35

#

can be more if i want

crimson lion
#

the current version thankfully works but its just a bit heavy handed. I'll try doing some rounding with the building's position and maybe pushbackUnique to an array of eligible grids? If I'm understanding that one right. BIS_fnc_gridToPos doesn't work on servers apparently

#

Total time to run is 1.072 sec on Malden but 9.71 sec on Altis lol, maybe that's worth it for something that only has to run once at mission start. Hmm... just kinda thinking through this one, thank you for the inputs

pallid palm
#

you bet my friend

tender fossil
pallid palm
#

do you spawn them markers in

crimson lion
#

I'd like to have it require a minimal amount of editor setup or pre-determined things, so that if a new map comes out someone can just plop down whatever from the existing version into a new map and it adapts. Which it does wonderfully so far, just this part is the biggest drag. And yes, I spawn in markers- I can use them to simulate a pseudo heatmap of sorts, here exaggerated for effect:

pallid palm
#

i use empty markers also

crimson lion
#

The final product will have grids marked as rectangles actually, really similar to how the Insurgency gamemode does it. I guess I'm making a knockoff, lightweight insurgency

pallid palm
#

ok i see: yes Insurgency was fun i remember that

tender fossil
pallid palm
#

you may as well use EOS framwork form bangerBob that is Awsome

#

EOS_1_98

#

i know its fun to make your own πŸ™‚

#

as i did

errant jasper
#

Right now, you are running upto NumberOfBuilding times NumberOfGridPositions checks. If your "rectangular" dist is 50, and your grid is 100, then by definition each building defines at exactly one grid position as ansin11 suggests. By flipping the search logic you can reduce the number of checks hugely. For example Altis 20km x 25km is 50000 points. So if you flip the logic you might get sub <10ms runtime.

tender fossil
pallid palm
#

yeah i try to keep the number of building checks low as i can

#

but i only make 10 player missions so well you know

errant jasper
#

Something like this:

private _gridPositions = [];
{
    _gridPos = (getPos _x) call Bro_NmeNearestGridPos;
    _gridPositions pushBack _gridPos;
} foreach Bro_NmeBuildings;
// TODO: remove duplicates (grid positions that "contained" multiple buildings.)
fleet sand
#

Something like this could also work:

private _gridSize = 100;
private _grids = createHashMap;
private _buildings = nearestObjects [[worldSize/2,worldSize/2,0],["House"],worldSize,true];

{
    private _pos = getPosASL _x;
    private _gx = floor ((_pos select 0) / _gridSize);
    private _gy = floor ((_pos select 1) / _gridSize);
    private _key = format ["%1_%2", _gx, _gy];

    if (isNil {_grids get _key}) then {
        _grids set [_key, true];

        private _center = [_gx * _gridSize + _gridSize / 2, _gy * _gridSize + _gridSize / 2, 0];
        private _mkrName = format ["mkr_%1", _key];
        private _mkr = createMarker [_mkrName, _center];
        _mkr setMarkerType "mil_dot";
        _mkr setMarkerColor "ColorRed";
    };
} forEach _buildings;
crimson lion
#

Gahhh okay it's down to 1.5 sec on Altis!!!! Thank you all

#
{
    private _thisPosX = floor ((getPos _x select 0) / 100) * 100 + 50;
    private _thisPosY = floor ((getPos _x select 1) / 100) * 100 + 50;
    private _assembledGrid = [_thisPosX,_thisPosY];
    Bro_NmeGrids pushbackUnique _assembledGrid;
} forEach Bro_NmeBuildings;
{
    private _markerString = format ["marker_%1", _foreachIndex];
    private _mark = createMarkerLocal [_markerstring,_x];
    _mark setMarkerShapeLocal "RECTANGLE";
    _mark setMarkerSizeLocal [50,50];
    _mark setMarkerColorLocal "#(1,0,0,1)";
} forEach Bro_NmeGrids;```
#

How do I get pretty codeblocks with color formatting like that?

wicked roostBOT
#

Please use !sqf from now on (!enforcescript soonβ„’)

crimson lion
#

!sqf

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓ turns into ↓

// your code here
hint "good!";
crimson lion
#

Ohh shit sick

fleet sand
crimson lion
#

I am filtering out buildings on criteria, with yours ists about 1.39 sec

#

Thank you though! Thats very robust

fleet sand
lavish ocean
#
Bohemia Interactive Forums

New command createObject for decorative objects - posted in ARMA 3 - DEVELOPMENT BRANCH: since 134151 there is a new command in dev. version - createObject
(will not yet be part of next patch)
Β 
what is it good for:
Β - will create object, that is based only on shape (no config needed)
Β - object is not simulated, so it will save some performance (no physx, no sounds, not a interesting target for AI,....)
Β - unlike whole vehicle, it needs very little information to synchr...

indigo snow
#

@twin garnet paste your addAction in here please?

twin garnet
#

player addAction ["Script1", { hint "test" }];

#

(sorry if its a silly error. I havent done scripting in a real long time.)

indigo snow
#

The code block is since TKOH

#

use " for arma

#

player addAction ["Script1", " hint 'test' "];

twin garnet
#

Oh it works now. Thanks nick! πŸ˜ƒ

indigo snow
#

I mean your first example with the {} works for me as well

#

are you working in A2?

twin garnet
#

Yeah its A2

indigo snow
#

yea brackets are since TKOH

twin garnet
#

Ah right, thanks for the heads up.

fair drum
old owl
#

Woah, that's sick didn't realize that was an option.

twin garnet
#

Right, is there any way you are able to read the contents of a WeaponHolder in A2?

indigo snow
#

isnt it just a vehicle with cargo?

twin garnet
#

I suppose it is, yeag

harsh vine
#

Does anyone know how to restart a server or mission on a dedicated server after the mission ends using ["win"] remoteExec ["BIS_fnc_endMission", 0, true];?
When I rejoin from the lobby, it triggers the mission end again.

twin garnet
#

Yeah*

harsh vine
#

Thanks will try this again 🀞

twin garnet
#

Im trying to make a script to veiw the contents of the weapon holder without the player needing to interact with it

twin garnet
#

getMagazineCargo is hopeless -_-

west portal
#

For the handleDamage EH, does a mine count as a source or instigator? Ex: APERSTripMine, APERSMine, or APERSBoundingMine

hallow mortar
#

Well, you can test it by adding a systemChat str _this and walking into a mine, but I'm pretty sure mines are ammo

west portal
#

Okay, thanks

tulip ridge
#

Ammo will be the mine, source / instigator should be the unit that placed it

dawn jasper
#

Could someone DM me about sending game data like player x y and z to an external application? I can't do any coding right now but will be able on the weekend

errant jasper
dawn jasper
#

or make any changes to it

errant jasper
dawn jasper
#

or just have the server turn off BattlEye? as that looks like the easy way lol

errant jasper
#

Yes, you can do whatever, if you don't need BattlEye active.

#

This worked fine for me in small trust-based clan. For public servers probably not so wise, but I don't have experience there.

dawn jasper
#

okay thx

errant jasper
#

My wish back in the day would probably have been a "generic" extension whitelisted by BattlEye that supported general sqlite and JSON over HTTP calls.

blissful current
#

Confirmed! I got it to work today like this. Grabs the huts around a position and turns off damage.

[
    {
        {
            _x allowDamage false;
        } forEach (nearestTerrainObjects [[7809,9098], ["HOUSE"], 80]);
    }
] remoteExec ["call", 0, true];
thin fox
#

are you calling this inside a trigger?

#

allowdamage has global effect

blissful current
#

I put the code in initServer.sqf. It wouldn't turn the damage off on clients until I remoteExec it.

fair drum
#

Then do this in init.sqf then. Don't remote it.

blissful current
# fair drum Then do this in init.sqf then. Don't remote it.

Copy that. This begs the question though, how do I know what goes where? I read the initialization order wiki and some info on the individual .sqfs but can you give some example of why this code works better in initPlayerLocal so I can understand why better?

fair drum
#

But still, allow damage should be run locally to who owns the building, which should be the server for map objects unless they are local objects. Would need to test to see where these buildings are local to.

#

Well, the best place would probably just be in init.sqf, because it's run on every machine

blissful current
#

The buildings are terrain objects if that helps.

fair drum
#

That way every machine has their own copy. Which remoteExec is doing but now without the network usage.

blissful current
fair drum
#

Every machine when they join the game runs init.sqf

#

It's why you have to be careful with it.

blissful current
#

That's where I get confused because the wiki says init.sqf Executed when mission is started (before briefing screen). Which made me think that if someone missed the mission start they would'nt get any of the code in there. Hence, that's what initPlayerLocal.sqf is for. Otherwise, what is the difference between them?

fair drum
#

They both run when the mission is executed by their related machines. Init.sqf for all machines, and initPlayerLocal.sqf for machines that have a player.

blissful current
#

So if a player JIP, then every client runs init.sqf?

fair drum
#

When a player JIP, only their init.sqf is run.

blissful current
#

As well as their initPlayerLocal too?

thin fox
#

yes

#

think that the server is another machine, so event scripts like initServer, init.sqf, it only runs once at mission start (a server machine cannot enter the mission πŸ˜† ), the server machine loads the mission once, the client loads the mission when they enter the server/pass the lobby and they can rejoin, and read all those files again...

finite bone
#

Whats the proper way to ensure a player has completely loaded into the game before executing a function using CBA_fnc_WaitUntilAndExecute?

blissful current
#

I've run into an issue in playtesting. Players must use a holdAction on a unit in order to proceed. However the way ARMA works is if that unit is in a vehicle that explodes, they disappear, which breaks the mission.

Solution? Add a killed EH to their vehicle that checks if the unit is in their vehicle and teleports them out, so players can still progress?

finite bone
#

No can do - From a mod perspective, I have the XEH_postInit prepped but on rare (now seemingly common) occasions, the race conditions fails

#

The isNull player is faster than the functions being initialized properly for it to work

thin fox
#

ah okay

finite bone
#

Got the solution from Dart - Use CBA_missionTime > 0 instead

fair drum
blissful current
# fair drum Have you tried force ejecting the body when killed?

I haven't tried anything yet. I thought about moveOut when the vehicle explodes. But now that I've put more thought into it maybe I like that the corpse can't be recovered. I forgot that it wouldn't break the mission since I redesigned it. And might add a nice layer of challenge for players to only disable the vehicle. Might sleep on this one and decide.

earnest valve
#

Hey @lavish ocean, any chance the RscObjects will be improved like in DayZ SA? I would love to have a projected character with animations instead of a T pose. :)

still forum
still forum
still forum
# errant jasper My wish back in the day would probably have been a "generic" extension whitelist...

If someone makes a properly good open source one, I can whitelist it.
So far I've only seen quickly mushed together ones made for one specific use case.
Not a proper one with proper API that does all the things and can be used for everything, preferably also with proper security like webbrowsers do.

I even made my own one, but it has a shit API (that is optimal for my specific use case though) and doesn't support all the HTTP things you'd want to mess with.
Now with native JSON and Hashmap support in script, its easier than ever to pass complex commands to an extension.
With Extension Callbacks and upcoming async task script feature it also becomes easier than ever handling the results of such things.

But someone who knows this stuff would need to properly sit down and invest a few weeks of time. I would if I had the time. I would start the project if I had someone to help me finish it, but no-one ever did for all my past projects so that won't happen either.
But I'll probably do one inside the game anyway. Or get someone else to do it πŸ˜„

formal grail
#

Found a fun locality issue and workaround.
In MP, if you force a local AI into a remote turret on a local vehicle, it will jump out of the vehicle when the turret becomes local, which usually takes a few seconds. As far as I know, there's no way to force the AI to stay in the vehicle when that happens (I think I tried everything). You must either get into both the driver and turret (to immediately force both to become local) before forcing the AI in, or delay forcing the AI into the vehicle turret until the locality propagates to the turret. I ended up doing the latter. There is a third option, which is to force the AI into the turret, wait until the turret becomes local with turretLocal, and then force the AI back in. That looks mostly seamless, but can be trouble if the vehicle is moving (the AI can fall out, get knocked over, and then refuse to get back in until it gets back up) and wasn't necessary for my use case.

formal grail
pallid palm
#

that's funny: i never had any problem with that at all in MP or SP or DeD, Ai stay in any turret any time i move them in: or spawn them in a turret: But then: i only use vanilla:

pure igloo
#

anyone interested in a script chalange? im trying to get buildings to spawn a certin way but its not smooth and im getting 2 building spawning ontill one deletes .. id like to just have one and a smother script.. sorry if this is hard to read .. but if interested ill post it on paste bin in a moment

dawn jasper
still forum
#

yes

pure igloo
granite sky
#

Related issue is that it takes pretty long for a unit to switch locality from server->HC. I figured it'd be remoteExec speed but it's much slower.

green cargo
#

Hello everyone, is there any quick easy solution, to unload cargo (in example jeep in cargo of chinook) on choosen place? whatever I am trying to do Chinook is just landing and immediately takes off with jeeps still in cargo

split ruin
#

how to check if building pos is used by a unit ? I need to spawn some units in a bunker but they keep spawning on the same pos

private _allpos = _bunker_a buildingPos -1;
private _runit = selectRandom KIB_enemyInf;
private _unitpos = selectRandom _allpos; //need to remove this pos from all pos array 
private _bnkunit= _bnkgrp createUnit [_runit, _unitpos, [], 0, "NONE"];
_bnkUnit setUnitPos "UP";
_bnkUnit disableAI "PATH";
winter rose
green cargo
tidal idol
#

Any ways I can render an aircraft pilotcamera unusable via script? Ideally unable to rotate. Would go into the code called by a vehicle config init eventhandler.

silent cargo
#

what is the best method to storing ammo value in a current magazine and returning it back later in a script?

Is it possible to for example to clear a weapon with 102 rounds in the magazine, empty the magazine, store the count, then restore it back to the exact amount?

granite sky
#

There is no good way to do this.

winter rose
#

there… is?

silent cargo
#

To be more specific I'm trying to empty the ammo completely while a armed vehicle is inside a trigger, and then restore it once it leaves the trigger.

winter rose
#

I believe there is an addMagazine or some other command's alt syntax to add a mag with x bullets

granite sky
#

Oh, vehicles are different anyway. Not messed with vehicle mags much.

silent cargo
#

Yeah sorry should have mentioned it was vic

granite sky
winter rose
granite sky
#

You have to remove all the valid magazines, add only the 102-bullet one, then add the weapon, then add the other magazines.

#

I don't know of any way to finesse which magazine is chosen.

winter rose
granite sky
#

yeah ok, missed that one.

winter rose
#

I never used it, but I carefully stored it in a side memory cell for when I would need it πŸ˜„

granite sky
#

Not sure if there's a command to get the current ammo in the weapon magazine either...

#

But there's probably another one I missed in this mess.

winter rose
#

ammo

granite haven
#

i've got this code to pop up a discord link, i want to use this in public zeus but i assume its not working because of the remote exec. could anyone give me some pointers as to how i could fix it:

[{
    0 spawn {
        if (isServer && isDedicated) exitWith {};
        waitUntil {sleep 0.1; !(isNull (findDisplay 46))};
        if !(isNull (findDisplay 312)) exitWith {hint "Discord notification send."};
 
        private _display = (findDisplay 46) createDisplay "RscDisplayEmpty"; 
        private _button = _display ctrlCreate ["RscEdit", -1];

        private _xCord = safeZoneX + 0.02 * safeZoneW;
        private _yCord = safeZoneY + 0.02 * safeZoneH;
        private _w = 0.2 * safeZoneW;
        private _h = 0.05 * safeZoneH;
        _button ctrlSetPosition [_xCord, _yCord, _w, _h];
        _button ctrlSetBackgroundColor [0, 0, 1, 0.5];
        _button ctrlSetText "Our Discord: https://discord.gg/";
        _button ctrlCommit 0;
        hint "You can join our discord by copy pasting the link. Once you are done you can press ESC to close the menu."
    } 
}] remoteExec ["call", 0, true];
#

the idea is that zeus/ co zeus dont get the link

winter rose
granite haven
#

yhea i could do -2

#

should do

winter rose
#

only if not self-hosted

#

[0, -2] select isDedicated

#

and the (isServer && isDedicated) check can be replaced by (!hasInterface)

#

this way even headless clients won't have it

granite haven
#

alr, ty.
i tried before to use: [0, -2] select isDedicated
but that made no difference

winter rose
#
[0, { /* code */ }] remoteExec ["spawn", [0, -2] select isDedicated, true];
```saves the spawn's call
granite haven
#

ah i see, thats clean

winter rose
#

but ofc it is better to make a function to ask for a call of it, this way you don't send the code through the network, only the function's name

granite sky
#

None of these work in public zeus do they?

#

I thought it was locked down.

granite haven
#

everything remote exec related is locked down?

granite sky
#

Never dealt with it personally but I remember someone else having that issue.

#

I guess see what happens with various test code when you click run as server.

silent cargo
granite haven
winter rose
granite haven
#

is there a page somewhere explaining the RE limits on public zeus?

winter rose
#

nope

#

well, not on the wiki - internet may have some resources πŸ˜„

granite haven
#

damn, thanks for the help

#

will look around and see if i find something

silent cargo
winter rose
#

removeAllWeapons?

#

well, more like removeMagazines (or removeMagazinesTurret)

silent cargo
winter rose
#

so?

silent cargo
#

i/e: BTR enters trigger > ammo value stores > magazine removed > BTR leaves trigger > magazines restored with previous ammo counts

I think I will just work on a different approach tbh

silent cargo
# winter rose so?

Does not quite work with vehicles. If you need to remove all weapons from a vehicle, remove each weapon individually (see removeWeapon)

winter rose
#

β†’ removeMagazinesTurret ←

#

something tells me you don't want to do all that, rather your need is to prevent vehicles from being able to fire, correct?

silent cargo
#

Removing / adding mags to the vehicle is no issue. The issue is it restores them to full capacity. So that means players would exploit it for free ammo replenishment.

In order to set the stored ammo value, I need to define the current muzzle etc. If no player or unit is in the btr gunner, it returns with " "

#

I had my fingers crossed there was a 1-2 step solution πŸ˜…

winter rose
silent cargo
#

Essentially just that

winter rose
#

you can:

  • remove magazines as you are doing now
  • remove weapons (which implies re-adding them and re-inserting the magazine or setting the mag/count)
  • add an event handler that would delete all fired things as long as they are in the area
  • kill the gunner :-p
    etc
pallid palm
#

@silent cargo you don't need to empty the ammo: you can just restore it as you say:

#

@silent cargo do you mean like a Rearm Repair and Reload statrion

#

oh i see: not allowed to operate/fire in given trigger area"

#
_unit setVehicleAmmo 0;  //take ammo away

_unit setVehicleAmmo 1;  // give all ammo back
silent cargo
#

Yeah. basically just something to emulate "safety" when "InSafeZone.sqf"; triggers (clears all ammo, and stores partial mags), and then restore the ammo when "LeftSafeZone.sqf"; (ammo restored to previous values without giving free full replenishment)

Because with that, players will just drive out, shoot, drive back in, leave area and keep getting free ammo lol

#

I will just do event handler for fired and delete the projectiles. Seems to be the better route

pallid palm
#

ok cool

silent cargo
#

I appreciate the help though. Thanks bro

pallid palm
#

rgr

thin fox
#

it's an addAction with fire button as keybind

#

like the one from I&A

silent cargo
#

If you remember later, feel free to drop it here and I will check it out

blissful current
#

I have an issue regarding leader. If a player, who is the leader of the group, disconnects from the mission, then the new leader becomes an AI that was added during the mission with join.

I was wondering if there is a command that could set a unit as unable to take leadership?

As a temporary fix, right now I have an EH that monitors when leader changes addEventHandler ["LeaderChanged". When that happens, I have it check if an AI is the leader and, if so, to reassign it to a human. Seems to work ok but maybe there is a better solution?

torn stream
#

is it possible to use scripts to draw lines on the map?

#

i've tried
drawLine3D [start, end, color, width]
and
map drawLine [from, to, color, width]
i can't seem to figure out how it works

warm hedge
#

Post your cureent code and result

torn stream
#

addMissionEventHandler ["Draw3D", {drawLine3D [(ASLToAGL getPosASL player), getPos cursorTarget, [1,1,1,1]];}]; last thing i've tried

result: nothing appears, outputs growing number

#

The end-goal is making a box around an object, if i can get a single line to work i think i can handle the rest, but not even that works

fair drum
#

draw uiEventHandler for things on map

hallow mortar
#

You can also use markers, via setMarkerPolyline or setMarkerShape "RECTANGLE"

pallid palm
#

@blissful current can you have that Ai die if the player disconnects ?

blissful current
pallid palm
#

oh wow cool nice

#

its kinda funny i never had anyone disconnect from 1 of my mission: thats why i did not know about this πŸ™‚

#

that's maybe cuz i only make 10 player missions

#

unless its a PvP mission then its 20 players of course: 10 on each side

formal grail
#

Not sure if this belongs in this channel but someone might be interested:
With the new web browser hud, it's now possible to get players' battleye id (beid) from their guid with javascript. Previously we were only able to do this by triggering the beclient guid server command and intercepting the systemChat and reading it off with regex.
Now, all you need to do is import an md5 library like cryptojs in the hud and do this:

    if (!uid) return "";
    let id = BigInt(uid);
    let payload = "BE";

    for (let i = 0; i < 8; i++) {
        const byte = Number(id & 0xFFn);
        id >>= 8n;
        payload += String.fromCharCode(byte);
    }
    return CryptoJS.MD5(CryptoJS.enc.Latin1.parse(payload)).toString();
}```
open hollow
thin fox
grim yoke
#

Hello everyone,
I am looking for a way to manipulate or set the player's customWaypoint via script without having to set a β€œsimpleTask” or similar for them.

I have already figured out that I can read the waypoint set by the player via customWaypointPosition.
But is there any way I can set it?

silent cargo
thin fox
grim yoke
#

@thin fox
In a mission, I would like to be able to double-click on a location in a tablet where you have to make an external load flight.
However, since the destination can be freely selected, a task system does not make sense.
Depending on the progress of the mission, there can be as many as 10 or 15 possible destinations.

Once the load has been dropped, the waypoint should automatically be set back to the base, etc.

thin fox
#

and what about waypoint?

#

adding a waypoint should work the same way

grim yoke
#

Do you mean simple map markers?
I need something that can be seen outside the map on the horizon.

The problem with waypoints is that I can only set them for the whole group, not for individual players.
But I don't need them for the groups, I need them for the individual players.

hushed turtle
#

You can split players into multiple groups

#

One group per player

grim yoke
#

So there's no way to replicate these waypoints using a script, and you have to get creative or just leave it?

thin fox
#

put them into a group in particular, that way it separates from the others players

grim yoke
#

Thank you very much for your help and information. I'll experiment a little.
I was mainly hoping that there might be something like β€œSetCustomWaypointPosition” or something similar that I just couldn't find in the wiki, or a workaround that isn't described in the wiki.
But that doesn't seem to be the case.

hallow mortar
#

You could use a combination of markers and draw3D

#

There's no way to manipulate the built-in custom waypoint system but you can make something of your own that works similarly

rigid prawn
#

Can anyone help me with this script?

hiddenUnderwaterSelections[]=
{
"hide",
"hide1",
"hide2",
};
shownUnderwaterSelections[]=
{
"unhide"
};
hiddenUnderwaterSelectionsTextures[]=
{
"Omega_Maritime\data\Textures\swim_fins_co.paa",
"Omega_Vest_Core\data\Accessories\Lanyard\sa_militia_carabiner_CO.paa",
"Omega_Vest_Core\data\Vests\Comms\Acc\wire_co.paa",
"Omega_Maritime\data\Textures\swim_fins_co.paa"
};

Does this look correct for a diver uniform? It works in game but the I have been crashing if I try to jump in water

cyan dust
#

Curious problem: When I apply enableSimulationGlobal false to an invisible crate - it no longer falls under terrain. But it is impossible to take/put any items πŸ€”
Is there a way to disable simulation but keep the ability to interact with the crate?
UPD: trying _invisibleBox awake false; now, will see if that fixes both problems at once

thin fox
cyan dust
hallow mortar
#

Are you sure that's what crashed the server? "object falling under terrain" generates a message in the RPT, but all that actually happens is the game resets it to a safe altitude.

granite sky
#

yeah, we used to have those routinely. Tends to spam the logs a bit but doesn't crash.

tough abyss
#

Is there any way to set a texture as a video playing on the screen for any of the vanilla TVs or computers? I have changed static textures on them, and made a video pop up over the entire game screen with a trigger in the past. Never attempted this combo, so any ideas are welcome.

split ruin
#

quick question, can BIS_fnc_objectsGrabber get marker names? πŸ€”

willow hound
fringe marsh
#

hey guys

#

is there a way to make AI teammates turn their IR lasers on?
I tried some years old scripts / solutions but nothing seems to work

winter rose
hallow mortar
fringe marsh
#

ok, but please bear with me

where do I put this?

#

this is the group box

#

is this the correct way to use it?

thin fox
#

try it out

fringe marsh
#

jesus christ it worked!!!

hallow mortar
#

Because you're using the group's init field, you can use this to refer to the group whose init field the code is in, rather than hardcoding a reference to a specific variable name like shiv

fringe marsh
#

ok I see...

#

what about the "enableGunLights" version?

lemme try that as well

thin fox
fringe marsh
#

yes they do!

#

and turn it back on when put in combat

thin fox
#

that's pretty cool

#

never used this command

fringe marsh
#

this is huge

thin fox
fringe marsh
#

lemme try

#

hmmm I think I'm making some mistake here

thin fox
#

hey if it's working if enableIRLasers you shoudn't worry about enableGunLights

fringe marsh
#

it's true

#

but just as a last try

#

this is what I wrote

#

have I made a mistake?

hallow mortar
#

Missing ""

fringe marsh
#

o-oh

#

hmmm

#

still doesn't seem to be working

#

looks like this, but it's not working

winter rose
#

well
either they don't have lights, or it may need a delay

fringe marsh
#

or it doesn't affect IR pointers?

#

they do have both IR lasers and flashlights mounted on tho...

hallow mortar
#

Both are controlled by the same system (that's why the same button controls both, and if you have both a laser and light mounted at the same time, it will turn both on)

hallow mortar
#

For a number of reasons, AI don't handle this well, and unless specifically forced to switch, they'll only use the mode they started with.

fringe marsh
#

ok so it's more complicated than expected

#

I see now

#

I will be happy with the IR on in combat mode

#

altho what I wanted to be able to do was see where the AI teammates are looking and which targets they are spotting while stealthly getting closer to the target

#

that's why the ideal thing would be having them have the IR lights on

#

at the same time, maybe I can find some sort of spotting mod

#

idk why but the classic spotting brackets are gone in my game, must've messed with the settings

#

anyway, @hallow mortar thank you very much for the help! πŸ˜„

fair drum
#

Lights and stuff have to be run a few frames after init btw

#

@fringe marsh

fringe marsh
#

so it needs a delay?

can you tell me how to acheive that?

#

can I simply input these commands during the game after a few seconds?

or can they be written only in the editor?

sharp grotto
#

Like this ^^

this spawn {

  sleep 1;
  _this enableGunLights "ForceOn";
};```
fringe marsh
#

I put it in like this

#

not working tho πŸ™

fair drum
blissful current
#

Is there an EH or something that can tell when a player disconnects?

I've noticed an edge case scenario; When the player who is the leader of the group leaves, the AI will take over. This results in an AI group leader, and players unable to control the AI group members.

The leader changed EH doesn't fire in this case because I assume it's looking at the object which exists whether or not a player occupies the unit.

So maybe there's a way to look if a player disconnects, then I can do a check so see if the remaining unit is AI and leader then reassign leadership to a player.

formal grail
#

What are some pitfalls for uiSleep? Are there any reasons I shouldn't do a find/replace on my entire project and convert all sleep to uiSleep, provided I don't ever expect time accel/decel? I guess I'd keep the sleeps that are just intended to progress the frame (loops like sleep 0.001) but everything else can be uiSleep? (Or is that last part not even necessary because uiSleep seems to do that too?)

warm hedge
#

It is just about usecase. Not that overthink is required

formal grail
#

Just wondering if there's any reason, other than time accel/decel, where I would not use uiSleep?

warm hedge
#

Post your problematic code

formal grail
warm hedge
#

Firstly, in theory, "just" using uiSleep instead of sleep, or vice versa, will not magically crashes or freezes the game

formal grail
#

I was like 80% sure it's in the server code though, but then there was one incident where like 3 people were able to play while everyone else was stuck in loading, so now I don't know.

formal grail
#

So it seems like to me uiSleep is better in every way except when I care very much about timing during time accel/decel events

warm hedge
#

If the code is broken, yes. It is not about sleep, but around it

sharp grotto
#

"uiSleep is better in every way except when I care very much about timing"
That is also not the case, uiSleep is precise while sleep can be unprecise depending on how busy the sheduler is.

formal grail
formal grail
warm hedge
#

In that context, you should to wonder what part of while is stuck, not sleep

formal grail
warm hedge
#

And no, in MP you cannot expect sleep behaves differently than uiSleep

formal grail
#

Wait, in MP, I can't expect sleep and uiSleep to behave differently? I must not be understanding.

warm hedge
#

Because in MP accTime is ALWAYS 1

formal grail
#

Except in briefing and inside loading screen, yes, I believe that's the case.

#

And I think sleep does not behave well in the map screen.

warm hedge
#

That should not be the case

#

Or cannot be

formal grail
#

Hmm ok, it might have been something that was in my map code that was init during briefing then.

warm hedge
#

I cannot think such cannot happen only just in the map, and just because a sleep

#

Very likely some code is simply broken or looping

formal grail
#

Yes, like I said, probably a sleep that is triggered in briefing..

#

I know I had one that triggered much more frequently, and when I changed it to uiSleep, the broken init became much less common.

warm hedge
#

One simple debug is removing loadingscreen

formal grail
#

That's how I'm debugging it, but unfortunately it's refusing to trigger for me. It's some timing thing I'm sure. And there's no script errors on either the server or client when it occurs.

sharp grotto
#

Start loading screen > Endless loading screen
I had that for ages for ExileMod, its random tho, just press ESC and join again.

formal grail
#

Yeah, but the problem is when it happens on the server and because the client waits for the server to finish init, nobody can load in when the server chokes.

sharp grotto
#

dedicated server? that shouldn't be the case
sounds like you have some error in your serverside code

formal grail
#

Yes, imagine this server code in briefing:

start loading screen
some init
sometimes, sleep
some other init
mission set variable "server is done loading"
end loading screen

And this client code

start loading screen
wait until "server is done loading"
end loading screen

So if during the briefing that sleep is triggered on the server, the game can't start

#

That used to happen very frequently. But I changed some sleeps to uiSleeps and now it's less frequent but still occurs. Which is why I had the question... why not simply find/replace all sleeps to uiSleep?

warm hedge
#

Because of usecase, both behaves similar and still differently

formal grail
#

Yeah, that's my question, in what use cases would sleep work and uiSleep not?

#

Or in what use cases does sleep work better than uiSleep?

sharp grotto
#

Server should not execute "loading screen" or briefing, that's only for the client with a interface.
Not really sure what are you trying to tell us xD

if !(hasInterFace) exitWith {false};
formal grail
#

Along with doing a find/replace on all my sleeps I guess.

warm hedge
#

It's not about one being better and whatnot
uiSleep, well the name says, it works not depend on accTime so you can make a sleep for something that does not rely on simumation speed like sound

formal grail
warm hedge
#

Urm...

#

Not sure what to tell if that's your conclusion

formal grail
#

If not, what are some examples?

warm hedge
#

A sleep that relies on the ingame speed. Such as making particle or vehicle or something

#

You don't want millions of particle in one ingame second in slow simulation speed or vice versa

winter rose
#

if you pause the game in SP, uiSleep will trigger still
etc

warm hedge
#

That would better explanation

formal grail
#

Is what I'm learning so far.

winter rose
#

yep
there is no "one is better than the other", only "one is better suited to one need than the other"

formal grail
#

But thanks for all your help/explanations. Was hoping that somebody said, "actually I replaced all my sleeps with uisleep and it craters mission performance" or the opposite, but seems like the difference is subtle enough that it shouldn't affect my mission.

warm hedge
#

I actually might try some test about sleep in briefing

#

This seems to be an intetestimg caae

#

Hold up, I know how it should behave

#

In init.sqf it will just suspend the entire script until you click Continue

#

...Or does it? I might have hallucinations

winter rose
#

init.sqf? iirc yes
basically it will run everything until it hits a time check

formal grail
#

Game simulation isn't available when in the briefing screen in mp afaik. You can look at the time in the map, it should be frozen.

winter rose
#
player setDamage 0.25;
sleep 1;
player setDamage 0;
winter rose
formal grail
winter rose
#

ye there is a difference πŸ˜„

formal grail
#

It would explain why when the server chokes some players can connect and play and some can't

pallid palm
#

to me: uiSleep 1; does not really stop Kinda: but sleep 1; does πŸ™‚

winter rose
#

and that's a wrong way to look at it
it's a matter of scope: do you want to pause for 1 IRL second or 1 in-game second

exotic gyro
#

well, it's scheduled so Roughly 1 Second

#

Some Amount Of Time Between 1 And n Seconds

winter rose
#

depends on how overloaded your scheduler is really

exotic gyro
#

I've found even like fifteen handles can cause weirdness like that so I just do the Ace thing and completely avoid the scheduled environment

winter rose
#

sleep 1; = at least 1s yes πŸ˜„ 1.0003+

exotic gyro
#

KP lib used to have that problem before it moved to using cba wae and pfh's

#

Imo scheduled environment should really only be used for quick and dirty mission scripts you'll use once or twice

#

(though I have noticed that by using cba events and wae and wuae in my quick and dirty scripts, there's a way lower chance of failure since I'm forced to write decent code)

granite sky
#

Nah, sleep is preferable if you genuinely don't care whether something waits for 10 or 11 seconds.

#

Engine scheduler is faster than SQF scheduler, and because it's restricted to 3ms per frame there's no risk of causing long frames when events coincidentally hit at the same time.

tulip ridge
#

"It's faster because it's slower" is quite the take

granite sky
#

It's better to spread load across multiple frames.

exotic gyro
#

You can do that intentionally with execnextframe

tulip ridge
granite sky
#

it's not random. Scheduled just guarantees you 3ms per frame without effort. Which is usually about what you want.

exotic gyro
#

Well, it guarantees that to someone

granite sky
#

If you're not picky about when exactly something happens then that's fine.

tulip ridge
granite sky
#

If you are picky then you shouldn't be doing slow stuff :P

tulip ridge
#

It's not about "doing slow stuff", it's about consistency

#

That point makes no sense, at all

granite sky
#

Consistency of what?

tulip ridge
#

I'm also pretty sure that CBA's stuff is still faster, though I haven't checked it after Dedmen did his scheduling improvements

tulip ridge
# granite sky Consistency of what?

Code finishing within the same frame

If code runs in the same amount of time but one takes two frames and the other only takes one then a single frame is clearly better. And why would you want inconsistent behavior based on how much other stuff is in the scheduler

granite sky
#

because you want consistency of frame rate.

exotic gyro
#

iirc scheduler usually leads to lower framerate overall for the same code anyway

At least it did before dedmen improvements, haven't checked again

tulip ridge
#

And using the scheduler will give you worse framerate

granite sky
#

Scheduler has almost zero overhead IIRC

tulip ridge
granite sky
#

It used to be kinda iffy once you stacked it, but that's fixed.

#

but like 50-100 threads is barely measurable.

#

(even when it was bad)

#

waitAndExecArray in CBA runs sort on the whole array each time it changes. sort is the most unreasonably slow function remaining in SQF :P

#

they should probably do a manual insert there actually. Those are quite good with simpleVM.

round hazel
#

Hey folks!

If I recorded movement of a transport helo with unit capture, then played it back, would players be able to ride in the back of the helo during playback?

granite sky
#

Should work. I expect it's just setting pos/vel/dir of the helo during playback.

round hazel
#

Cheers!

round hazel
winter rose
#

ye

granite sky
#

How low are we talking?

#

Ideally it'd interpolate and still set the data per-frame on playback, but if it's obviously worse at like ~10-20fps capture then it probably doesn't.

honest lichen
#

Can someone help me with the "remoteExec" syntax?

cause i'm still not completely understanding this

i have a command, that needs to be executed on every pc

_soundID = _object say3D (((MissionNamespace getVariable "SongList") select (abs (_songNumber - 1) % count (missionNamespace getVariable "SongList"))) select 0);

how do i format remoteExec for it to understand, what is "from" and what is "sound"?
[_object, (((MissionNamespace getVariable "SongList") select (abs (_songNumber - 1) % count (missionNamespace getVariable "SongList"))) select 0)] remoteExec ["say3D", [0, -2] select isDedicated];

shortly

[_object, * that big text on the right of say3D*] remoteExec ["say3D", [0, -2] select isDedicated];

is that right?

granite sky
#

You need to start using local variables :P

#

Also missionNamespace is almost always the default namespace, so missionNamespace getVariable "SongList" is the same as SongList.

#

Where are you running the code from?

honest lichen
#

init pole of the object

granite sky
#

Editor init box?

honest lichen
#

yep

granite sky
#

In that case it runs on every client anyway.

#

If you need to control the timing from the server then you'd want to use isServer to block execution elsewhere for a start.

honest lichen
#

may i send here the full version of the code?

granite sky
#

shrugs

#

If you controlled execution with isServer already then it's fine.

honest lichen
#

i checked the execution, and the sound is played only on server

#

[this, this getVariable "CurrentlyPlaying"] spawn {
params ["_object", "_songNumber"];
if (isServer) then {
while {true} do {
waitUntil {(_object getVariable "JukeBoxWorking") == 1};
while {_object getVariable "JukeBoxWorking" == 1} do {
_soundID = _object say3D (((MissionNamespace getVariable "SongList") select (abs (_songNumber - 1) % count (missionNamespace getVariable "SongList"))) select 0);
for "_i" from 1 to (((MissionNamespace getVariable "SongList") select (abs (_songNumber - 1) % count (missionNamespace getVariable "SongList"))) select 1) do {
if ((_object getVariable "JukeBoxWorking") != 1) exitWith {
deleteVehicle _soundID;
};
if (_songNumber != (_object getVariable "CurrentlyPlaying")) exitWith {
deleteVehicle _soundID;
_songNumber = _object getVariable "CurrentlyPlaying";
};
sleep 1;
};
deleteVehicle _soundID;
};
};
};
};

the very thing we need is to execute say3D on every machine. Everything else is all right, i tested it multiple times

granite sky
#

But yeah:

private _song = SongList select (abs (_songNumber - 1) % count SongList) select 0;
private _target = [0, -2] select isDedicated;
[_object, _song] remoteExec ["say3D", _target];
honest lichen
#

thx

#

i still not completely understand remoteExec syntax

how does it understand, what is "from" for say3D and what is "sound"?

does it take every argument from [] and arranges it from left to right for every say3d's arguments?

granite sky
#

For a binary command, remoteExec is [leftarg, rightarg]

honest lichen
#

so if command have more than 1 left and 1 right args, i need to do an arrays ?

granite sky
#

A command can't have more than a left and a right arg.

honest lichen
#

what about addAction?

#

i mean

granite sky
#

For addAction, the right-hand argument is an array.

honest lichen
#

sorry, english is not my first language.

honest lichen
#

you really helped me to understand that

granite sky
#

so it looks like [_object, [giant pile of shit]] remoteExec ["addAction", 0]

honest lichen
#

thx for calling my code shit, but it is true i know.

i am really new to arma scripting, this is my first big project

granite sky
#

addActions are always shit :D

#

Ugly as hell.

blissful current
#

I'm testing this code and noticed an issue. The EH correctly fires if a player disconnects, and I get the systemChat for that event. However, the condition for the if statement returns false for some reason. Maybe a timing issue?

addMissionEventHandler ["PlayerDisconnected", {
  params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
  ["A player has left"] remoteExec ["systemChat", 0];

  if (!isPlayer (leader playerGroup)) then {
  ["AI is the leader"] remoteExec ["systemChat", 0];
granite sky
#

It would make sense that the unit either doesn't exist or is no longer a player, given that the EH doesn't give you the unit.

#

(might not be though)

hushed turtle
#

All he uses is global variable

blissful current
#

I'm testing a sleep in the code I posted then I'll try the one you posted John, thanks!

blissful current
#

Interesting.

granite sky
#

sleep doesn't do anything there except throw errors. You mean spawn + sleep?

blissful current
#

Its like the server still see's a player as the leader even if he disconnected.

granite sky
#

You haven't actually stated your test case.

#

Like what's in the group before the disconnect?

blissful current
#

So I got a group of 8 units. 2 are occupied by humans, the rest are AI. I use the client human to do an addAction that makes him the leader. Then I disconnect that client (back to the lobby). Alt tab over to the local host where I see both remoteExec messages I posted earlier. The rest of the code transfers the AI leader to a human, so players aren't stuck with a AI leader.

granite sky
#

The rest of the code transfers the AI leader to a human

#

You mean you have code somewhere that does this automatically?

blissful current
granite sky
#

Well, if you have this:

0 spawn {
  if (!isPlayer leader playerGroup) then {
    ["AI is the leader"] remoteExec ["systemChat", 0];
  };
};

Immediately followed by code that makes a player the leader, then the systemChat will not fire.

#

Because whatever is in the spawn will run afterwards.

blissful current
#

I have it working so far but I wonder if I should try the handleDisconnect one. They seem similar but I'm unfamiliar with either so I dont know their best use cases.

granite sky
#

I don't know what you're trying to achieve and you're describing your code too poorly to continue a theoretical discussion.

#

They're two event handlers that run at different points in the disconnection process.

#

If you want access to the player unit then you use HandleDisconnect.

#

If you don't care about the unit then you use PlayerDisconnected.

blissful current
#

Ah perfect. I dont need to acces the player unit for this I don't think.

blissful current
#

When a player who is the leader disconnects then the AI is now the leader.

granite sky
#

But you have code that selects a player as leader?

blissful current
#

So I use an EH to monitor when a player disconnects. Check to see if the new leader is AI and if so give it to a human.

#

Does that make more sense?

granite sky
#

No. What's the problem?

blissful current
#

When a player who is the leader disconnects then the AI is now the leader.

granite sky
#

And you're saying that they're not?

blissful current
#

I'm saying I don't want that situation to happen.

#

And so far the EH (with a sleep added for some reason) has fixed it.

granite sky
#

Ah, so you're saying that the current leader when PlayerDisconnected fires is still the guy who disconnected, and isPlayer returns true for them?

#

Or did you not check the value of leader groupPlayer?

blissful current
granite sky
#

That's kinda fun, but yeah, these functions don't document that sort of state.

#

spawn/sleep will work. Otherwise use HandleDisconnect and check if _unit is the group leader.

blissful current
#

Nice I always like it when I have more than one valid options!

blissful current
#

Maybe an oddity of me having two instances of Arma open and alt tabbing?

fringe marsh
fair drum
#

Do you have any AI mods on?

fringe marsh
#

AI avoids prone
AI can't detect through grass
AI helicopter deceleration

fair drum
#

Try without any ai mods

fringe marsh
#

lemme try

#

just to be sure

I synch the module to the group leader and I'm not using any triggers

fair drum
#

Maybe it's broke again. If it doesn't work I'll be home in about an hour.

fringe marsh
#

I tried and it seems to work with a simple flashlight

#

but not with IR lasers

fair drum
#

Would be silly to ask, but you are looking at them under night vision right?

fringe marsh
#

I am πŸ™‚

fair drum
#

Alright give me a bit

fringe marsh
#

sure!

blissful current
#

What am I doing wrong with this FiredMan EH?

if ("vn_m18_purple_mag" in _magazine && _projectile inArea "Grenade_Marker") then { hint "fired"; };

if I change it to _unit inArea "Grenade_Marker" I can get it to fire. But design wise it would work better if I could check for the smoke grenade being in the marker area.

#

After some testing, it seems that it takes the position of _projectile immediately when the EH fires. So even if the _projectile lands inside the marker area, the condition can return false because it evaluates the condition as soon as it leaves the player.

So I need some solution where it's evaluating the condition after the smoke grenade lands. I suppose I could put a sleep somewhere that is more or less the amount of time it takes for a smoke grenade to be thrown, arch, and land somewhere?

blissful current
#

Oh I see.

thin fox
blissful current
#

Ok I'll try that. Maybe explode too. I wonder if the smoke plume counts as an explosion?

thin fox
#

idk, I've only used deleted and explode for missiles/arty shells

blissful current
#

Oh look at this one: HitPart

Triggered when the projectile hits any surface.

#

The ground is a surface right?

thin fox
#

it's your best answer

blissful current
#

how would I write this?

_projectile addEventHandler ["Deflected", {
    params ["_projectile", "_position", "_velocity", "_hitObject"];
}];

do I replace _projectile with player?

#

Or does _projectile fire literally every time that happens in the mission?

thin fox
#

and get the projectile

blissful current
#

Ah I see it takes the param from that EH

blissful current
# thin fox no, you put this inside the firedEH

This works pretty good. There is an edge case if I throw it in a really high arc that it can fire inside the marker area but land outside the marker area, which could end up looking a little jank for my mission, but it's a lot better than what I had.

player addEventHandler ["FiredMan", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];

    // If purple smoke thrown
    if (_magazine == "vn_m18_purple_mag") then {
        
        // Add an Explode handler to the projectile
        _projectile addEventHandler ["Explode", {
            params ["_proj", "_pos", "_vel"];
            
            // Check if the projectile exploded inside the marker
            if (_proj inArea "Grenade_Marker") then {
                systemChat "fired"; 
            };
        }];
    };
}];
#

So Explode does work for smoke too. Thanks!

thin fox
fair drum
hushed turtle
#

Is there any way to check if file exists before including it by #include?

granite sky
#

__has_include

#

It's in the preprocessor wiki page.

hushed turtle
#

Oh, thanks. I've only read #include description

hushed turtle
#

It's limited to paths starting with \. I wanted to check mission files

hallow mortar
#

* that is, for mission files checking against other mission files. I dunno about trying to check mission files from mod config. I don't think mission files are accessed until the mission is loaded, so mod config that's preprocessed during game launch won't be able to get into mission files.

eternal spruce
#

I have an issue where I placed an aircraft in the editor at a high altitude with plane1 flyInHeight 6000;, with a loiter WP.
whenever i play the scenario the plane just drops to its demise and the engines are off. how to i fix this problem.

#

Also in the waypoint attributes, i have the desired flyInHeight & loiter radius

fair drum
#

Give it some velocity at start

eternal spruce
#

with setVelocity correct?

hallow mortar
#

How high are you placing it? Editor-placed aircraft are supposed to start in flight mode if they're uhhhh ~75m? off the ground, without needing a manual velocity boost. I've just tested it and it appears to be working.

#

Does the aircraft have a crew, and have you disabled any of the crew's AI?

eternal spruce
drifting copper
eternal spruce
#

USAF KC135

drifting copper
eternal spruce
#

yea, and i know they have a module but thats just to loiter around the map and the mad i'm using is one of the big ones like south asia

#

SO thats the reason why I'm using the loiter wp

drifting copper
eternal spruce
#

Really I didnt think the map would affect it

#

did you change some lines in the code to fix it when you had the same problem

hallow mortar
#

I just placed a USAF KC-135 in the air in the Editor and it successfully spawned in-flight with engines running πŸ€”

drifting copper
drifting copper
hallow mortar
#

For experimentation's sake, can you (OhMyGengar) quickly try it on a vanilla map? Just an empty mission with the KC-135, a loiter waypoint, and an observer. It could be one of your other mods stopping it from working properly.

eternal spruce
#

ok no problem, one sec

hallow mortar
#

If and when you get it working, keep in mind that the default loiter waypoint radius is quite tight for such a large aircraft. It's basically doing a permanent wingtip turn and it doesn't always hold altitude very well doing that*. You might need to increase the radius by quite a bit.
*the AI flew it into a hill, and that's how I found out the model doesn't have any destroyed textures, the wreck just turns into a sky-coloured void :U

eternal spruce
#

I recreated the same scenario on a vanilla map (altis). It works just fine, granted i set the aircraft to flying height i think 75m off the ground

#

i'm going to try that exact same thing ion the modded map and see if i get a different result

#

Never thought of that but you're right its basically doing a wingtip turn however i gave it a massive radius of 30,000. I also noticed that it didnt crashed when i set the aircraft to fly altitude

#

Everything seems to be working fine, I lowered the initial altitude from 6000 to near the ground and it just corrects itself to the desired altitude with flyInheight. Thank you all for your help.

split ruin
#

can a task have two markers on two different objects?

#
[west, "tsk", "convoy", veh_1, "CREATED", 1, true, "car",false] call BIS_fnc_taskCreate;

its a convoy and want to put two markers on two vehicles in the convoy

drifting copper
drifting copper
split ruin
#

@drifting copper assume the second vehicle of the convoy is called veh_2, I want to put second task marker on it

bleak valley
#

you can have several task at the same time

split ruin
#

I know this, I just wanted from the task framework to be able to have more then one marker for a task 😭

#

I want this

[west, "tsk", "convoy", [veh_1, veh_2, veh_3], "CREATED", 1, true, "car",false] call BIS_fnc_taskCreate;
hushed turtle
#

When JIP parameter of remoteExec is set to true, will it execute ONLY for JIP?

tulip ridge
#

No, it will execute for its current targets and any JIP players that match

#

E.g. for 0 as the target, it will run for every connected machine at the time its called and for any player who joins later

hallow mortar
#

(or use onUserConnected, onUserSelectedPlayer, playerConnected etc. mission EHs on the server to only target JIP players in the first place)

finite bone
#

How do I turn off the lights of the vehicle controlled by AI? I tried to remoteExec to the vehicle, and even global ( 0 ) but setPilotLight is not working on both (or they immediately turn off / on again)

winter rose
finite bone
#

I think I'd go with breaking light hitpoints as I don't think I can reliably set the vehicle lights to be on/off at will using disableAI

winter rose
#

you could try:

  • disable lights usage in AI
  • setPilotLights off
    if they turn them back on it's something else
#

but if breaking lights is easier and non-noticeable, go for it ^^

finite bone
#

However, there still is a possibility that breaking and later fixing the lights wont necessarily have it activate

hallow mortar
finite bone
#

I wonder how the zeus interface executes this though (turn lights off and on similar to engine)

split ruin
#

maybe behavior to "STEALTH" or "COMBAT" ?

thin fox
#

afaik, that disableAI mentioned by Lou will stop AI from changing the lights status (on/off), so will not turn it off like you want, you need a combination of commands like Nikko said. That disableAI + setPilotLight, and I think it only works on careless behaviour (at least for planes as I tested it only works this way)

hallow mortar
finite bone
#

This is my current process ```sqf
if (_action == "lights") then {
_invalidOption = false;
private _valueLower = toLower _value;
private _hasAI = (crew _vehicleObject select {alive _x && !isPlayer _x}) isNotEqualTo [];
private _isLightOn = isLightOn _vehicleObject;

// Dynamic detection of all light-related hitpoints
private _hitPoints = getAllHitPointsDamage _vehicleObject select 0;
private _lightKeywords = ["light", "lamp", "spot"];
private _lightHitPoints = _hitPoints select {
    private _lower = toLower _x;
    _lightKeywords findIf {_lower find _x > -1} > -1
};

// Functions to destroy or repair light hitpoints
private _destroyVehicleLights = {
    params ["_veh", "_hitPoints"];
    {
        _veh setHitPointDamage [_x, 1];
    } forEach _hitPoints;
};

private _fixVehicleLights = {
    params ["_veh", "_hitPoints"];
    {
        _veh setHitPointDamage [_x, 0];
    } forEach _hitPoints;
};

switch (_valueLower) do {
    case "on": {
        if (!_isLightOn) then {
            if (_hasAI) then {
                _vehicleObject enableAI "LIGHTS";
                [_vehicleObject, _lightHitPoints] call _fixVehicleLights;
                [_vehicleObject, true] remoteExec ["setPilotLight", 0];
            } else {
                [_vehicleObject, _lightHitPoints] call _fixVehicleLights;
                [_vehicleObject, true] remoteExec ["setPilotLight", _vehicleObject];
            };
        };
    };

    case "off": {
        if (_isLightOn) then {
            if (_hasAI) then {
                _vehicleObject disableAI "LIGHTS";
                [_vehicleObject, _lightHitPoints] call _destroyVehicleLights;
                [_vehicleObject, false] remoteExec ["setPilotLight", 0];
            } else {
                [_vehicleObject, _lightHitPoints] call _destroyVehicleLights;
                [_vehicleObject, false] remoteExec ["setPilotLight", _vehicleObject];
            };
        };
    };
};

};

#

Shoving what I expect one way or the other to the game logic. Not ideal, but gets the job done sweating

hushed turtle
#

Can mission start without any players?

#

On server

granite sky
#

In general? Yes.

#

Usually the difficulty is in preventing it from doing so.

drifting copper
#

I am using ace_medical_fnc_addDamageToUnit on a AI spawn for a medical trainer. Though it feels as if the damage calculation from damage type and value range is off. Most of the time even on a low value range the AI insta dies on spawn and the damage types is weird. hit bullet often just gives a bruise. I tried adding ace_medical_damageThreshold which somewhat stops them from insta dying but their unconscious rate is low and if they do go unconscious they wake up a few seconds later. Trying to make a trainer that works better for the ACM/KAT addition. Anyone maybe have some advice?

supple condor
#

Hey,
i got one script "spawn.sqf" with
[thisList select 0, _tree, _trigger, _mine] execVM 'scripts\trees\hitting.sqf'

"hitting.sqf" has
_vectorHeading = (getPos _player) vectorFromTo (getPos _tree);

Upon execution i recieve "Error: Undefined variable in _tree"

am i right to assume locality? can i just remove the underscore or do i need to do more?
(and just as a reminder, if i remove the underscore, the variable is global to all scripts and mods right? So i should rename "tree" into something better?)

winter rose
#

what

supple condor
#

what what πŸ˜„ ?

#

is this giving better context?

pallid palm
#

hello All: does this look Correct or do i have it messed up

if (_player in Helo2) exitWith {
    ["Pilot:  Huey Must Be Empty  Before You Call  Insertion"] remoteExec ["systemChat", TO_ALL_PLAYERS];
};
winter rose
jade acorn
#

how can I check if a "phrase" is within a string? I want to run a script if hmd player returns a string that has cig0 in it.

supple condor
pallid palm
#

oh thx @cosmic lichen

tender fossil
finite bone
hushed turtle
#

Does JIP means only players who are already in process of joining at the time of running remoteExec? Like downloading mission and loading it?

granite sky
hushed turtle
#

Had some mistakes in code I couldn't see for quite some while. All good now

split ruin
#

how to check if vehicle is immobile for a long time (>5min) ? πŸ€”

winter rose
#

works for both a short and a long time πŸ˜„

split ruin
#

but how to check if speed is zero for a period of time ?

granite sky
#

Well, fundamentally you do need to check at multiple time intervals. There's no way to ask Arma whether a vehicle hasn't moved for 5min. You have to check the position and then check again. And you can't guarantee that it didn't go somewhere in between.

split ruin
#

1 sec intervals then ?

granite sky
#

What are you trying to achieve exactly?

#

Arma vehicle AI unstick procedures are so bad that they can actually be successful after minutes of failure.

split ruin
#

yeah, it can just not moving for 2 sec when turning and it will register as "not moving"
or just waiting for some unknown reason like they like to do in a convoy
I just want to find if there is vehicle stuck in a convoy and if there is I will just teleport it to the next waypoint

granite sky
#

If you know they have orders to move away from their current location then a two-point check is sufficient. If they failed to move more than X metres in Y time then you can consider them stuck.

granite sky
#

I don't think they ever turn off the engine unless they abandon a waypoint.

granite sky
#

They can ram the same house for like 10min

#

I don't even remember if they abandon eventually in that case.

thin fox
#

in that case ofc they won't turn the engine off, but sometimes they do

#

it's like a state that they are unable to move for some reason

granite sky
#

Abandoning the waypoint is usually when the pathfinder can't find a path.

thin fox
#

happens particullary with bridges

granite sky
#

Yeah that's the common pathfinder failure case.

#

but there are plenty of other stuck cases.

thin fox
#

yeah

granite sky
#

Sometimes they'll refuse to drive despite having a waypoint 100m in front of them down an open road.

thin fox
thin fox
granite sky
#

The more common one is that they'll stop on approach to a waypoint, because the vehicle slows down too fast and never enters the completion radius.

#

Seen that with vanilla prowlers, so it's not just mod config fuckups.

#

In that case you can just skip to the next waypoint though. It's not really stuck.

thin fox
#

also for bridges, one waypoint before the bridge and one after it generally solves it

granite sky
#

Depends on the bridge and the vehicle. Some maps just have broken bridges. Some vehicles can't cross them.

thin fox
#

well in those cases... πŸ’€

granite sky
#

actually I'm not sure which case the waypoints work on. Maybe if it was gonna decide to ford instead.

split ruin
#

from my testing the convoy veh get stuck 90% of the time because little objects next to road like lamps, umbrellas, signs, railroad tracks, etc. What I do is removing these objects on the convoy route.
I really want map creators to make maps to be milsim proof not beautiful, I hate little objects 😀

blissful current
#

How can I find what acceptable strings are for this EH? Specifically _surfaceType.

_projectile addEventHandler ["HitPart", {
    params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius" ,"_surfaceType", "_instigator"];
}];
tulip ridge
#

There's no specific list, it'll vary per model and mods can also add their own

blissful current
#

I'm wondering if _surfaceType relates to ground textures maybe?

thin fox
tulip ridge
#

It's based on the .bisurf the model uses

#

So kind of related

blissful current
#

Like this? systemChat format ["SurfaceType: %1", _surfaceType];

tulip ridge
#

Yeah

blissful current
#

Interesting. Ima try that, thanks you all.

#

cln_grasstall unless I shoot a rock which returns nothing. Interesting.

blissful current
#

Why doesn't this prevent code from running in single player?

if (isMultiplayer) then {
granite sky
#

It does.

blissful current
#

I have that code in initServer.sqf but it is activating in single player:

if (isMultiplayer) then {
// leader changed EH, activating in SP but I don't want it to.
};
granite sky
#

Sanity check, what do you think single player is?

blissful current
#

Anything that isn't multiplayer?

#

Maybe because the mission is running in preview mode in the editor and it's saved in MPMissions folder?

split ruin
#

singleplayer in arma is multiplayer where server and player are the same client

#

missions saved wherever you choose to save

blissful current
#

Ah, so would isSingleplayer work?

#

I only want it to run in single player.

split ruin
#

never tested them, why you need them ?

#

then make one player and save the mission in single player folder

#

you want to make single player and multiplayer mission at the same time ? πŸ˜΅β€πŸ’«

blissful current
#

I've noticed on the Steam workshop that many missions list that it can be played in SP or MP. Is this frowned upon?

split ruin
#

multiplayer mission can be played by only one player
single player mission cannot be played by many players

#

the thin difference is if you make a unit player (check "player" when you double click the unit) or many units playable in the editor

blissful current
#

Ah got it thanks!

fair drum
granite sky
pallid palm
#

i hear you 5, 5, Niner πŸ™‚ 5, 5, 9= Load and Clear

granite sky
#

It doesn't matter how many players there are. MP hosted is still isMultiplayer

blissful current
granite sky
#

yes

blissful current
#

Okay, so what I am saying and getting confused by is that code is running from the editor.

thin fox
#

?

blissful current
#

Single, which is the one without the lobby screen, right?

thin fox
#

what code is running?

#

maybe is running somewhere else in your framework

pallid palm
#

right @blissful current

blissful current
#

Hmmm, I don't think so. It's in initServer.sqf. Maybe that's an issue? It's too much code to paste but its basically a few EH regarding Leader Changed.

pallid palm
#

i don't like doing MP from the Editor

thin fox
pallid palm
#

i only like SP from the Editor

thin fox
#

do a simple systemChat check

pallid palm
#

why not just use Rank for leader change πŸ™‚

blissful current
#

Okay

pallid palm
#

why not just make a SP mission and have a diff Mission for MP

#

but that in itself seems funny too πŸ™‚

blissful current
# thin fox please check it, make sure it's not running somewhere else

Checked. Nowhere else. I did this so see the behavior. In single player neither message is shown below:

if (isMultiplayer) then {
    ["This is Multiplayer. This code is in initServer."] remoteExec ["systemChat", 0];
};

if (!isMultiplayer) then {
    ["This is NOT Multiplayer. This code is in initServer."] remoteExec ["systemChat", 0];
};

And I did the same for initPlayerLocal, which did display the correct message.

if (isMultiplayer) then {
    ["This is Multiplayer. This code is in initPlayerLocal."] remoteExec ["systemChat", 0];
};

if (!isMultiplayer) then {
    ["This is NOT Multiplayer. This code is in initPlayerLocal."] remoteExec ["systemChat", 0];
};

So I guess you can't do isMultiplayer from initServer. πŸ€·β€β™‚οΈ

#

Wait something is screwy with VScode. It's not recognizing that I've modified initServer. Usually there is an M next to the file. Maybe this isn't getting ran...

#

Yep! I did a manual save and now the M is next to the file and it's all working!

#

I've never had an issue with autosave with VScode, but glad to know now!

finite bone
#

Is there a way to extract all zeus modules (vanilla and mod-added) via debug console?

split ruin
#

@finite bone you mean spawn?

finite bone
#

No like zeus module logics from ZEN, ACE, LAMBS, etc. (along with vanilla fire support, teleporter, scenario name) that I can extract

split ruin
#

they are not existing in the mission and you want to make them appear?

#

or you want to have the code of these modules ?

finite bone
#

Just a list of names of modules currently loaded into zeus curator..

hallow mortar
#

Modules exist in CfgVehicles and have a function attribute. So you could make a script that searches CfgVehicles and reports the name of everything that has a function attribute.

#

Everything that inherits from Module_F is another way you could approach it

mortal folio
#

is there a command to get the position of whatever surface the cursor is pointing at? essentially line intersect from camera to cursor point on screen

#

(i.e something that'd work with zeus cursor for example, but i dont want the object i want the position so curatorMouseOver wouldn't work)

split ruin
#

_object = curatorMouseOver;
_pos = getPosATL _object;
systemChat str _pos;
mortal folio
#

also technically not accurate since it'd be the object root pos not the surface on the object

split ruin
#

you said position, not terrain πŸ˜†

mortal folio
#

fair lol

#

to be exact then essentially getPos but for the cursor; AGLS, i.e affected by the geometry/roadwayLOD as well as terrain

split ruin
#
_object = curatorMouseOver;
systemChat str (getPosWorld _object);
hallow mortar
#

"I don't want the object's position, so curatorMouseOver wouldn't work"
"OK, here's how to use curatorMouseOver to get the object's position"
πŸ€”

#

Try a combination of getMousePosition, screenToWorldDirection, and lineIntersectsSurfaces

split ruin
#

object position and world pos are kinda very close (practically similar), the object is where he is pointing with the mouse cursor, right?

hallow mortar
charred monolith
#

Hi ! I'm having trouble with a little thing i'm trying to make.

I'm trying to make an upward force so that a player can be lifted up, the problem is that everytime I try setVelocity or addForce the player ragdolls, or takes damage (For setVelocity) is there a way to make the player have a Force vector without those constraint ?

mortal folio
#

forgot to reply - yeah i ended up using screenToWorld getMousePosition with lineIntersectsSurfaces; it's not perfect since it breaks if the mouse is aiming towards the sky even if there's a building in the way, but it works well enough

pallid palm
#

@charred monolith what is the reason you want to lift the player up: did you want to set the player on top of a roof or ?

charred monolith
hallow mortar
hallow mortar
pallid palm
#

what i do is set a little trigger at the bottom of the ship: or object: and i have another object on the deck of the ship: or object: then i just setPos getPos player in the trigger its like a telaport script kinda like

charred monolith
hallow mortar
#

I'm glad you have that working for you, but teleporting is not what they're trying to do

pallid palm
#

agree

hallow mortar
charred monolith
#

Hmm yeah seems complicated. I've discovered that you could attach The player to PhysX object and use addForce on that object, however it cause a multitude of problem, like if the object collide with something the player just follow the objects axis so it moves in all direction cause by the collision, and it also block the player from moving their view, they are force to look in only one direction.

pallid palm
#

i guess thats why i did it my way πŸ™‚

#

i used the way i said: to jump up on a wall or roof of a building

#

but that was only in 1 PVP mission: The mission was a Attack and defend mission near the Castle

charred monolith
hallow mortar
#

Have you properly removed the stuff with attaching the player to a physics object? If they're still attached then it won't work on them.

charred monolith
#

Yes, I execute the code directly into the missions. So I execute one code with the attach separatly and manually. I've just restarted my mission, so there is no attachTo done, and it's still doesn't seems to work

hallow mortar
#

Can't reproduce, setVelocity works fine on a player with allowDamage turned off

charred monolith
#

I'm gonna try in vanilla see if there isn't some external influence

pallid palm
#

i never played Halo: So he wants to see the player: lifting up: is that correct: like in a tornado kinda like

charred monolith
pallid palm
#

is this in SP or MP

hallow mortar
#

If it's in SP then simulation is paused while you have the debug console open, and setVelocity may not take effect. Try testing in MP mode or adding a 0 spawn { sleep 1; ... };

charred monolith
pallid palm
#

copy that

charred monolith
charred monolith
pallid palm
#

nice

charred monolith
#

Thanks for you help guys ! I will now always test my script in local MP.

pallid palm
#

cool

#

i didn't really help it was all Nikko really

#

i was just trying to help πŸ™‚

charred monolith
#

Still thanks ^^ all help is appreciated.

pallid palm
#

cool thx m8

hushed turtle
split ruin
#

how can I make task marker invisible?

#

I want it to exist, not being objNull ...

hushed turtle
#

Task with objNull destination has no marker. You can later change destination to show the marker.

split ruin
#

task framework is such BS ... 😟

warm hedge
#

Why objNull doesnt work on your usecase

split ruin
#

I wanted to have task marker to exist so I can get its grid, something like

private _gridPos = mapGridPosition taskMarker;
systemChat format ["Task GPS GRID : %1", _gridPos];

so player can check GPS GRID instead of having magic marker on the map
but I solved this otherwise, with global var uberPos I use as a center of spawned task, units, etc. \

willow hound
# split ruin task framework is such BS ... 😟

Why on earth should the Task Framework incorporate an API that allows users to create tasks with invisible markers?
If you're using the Task Framework to interact with a task, you already know where the task marker is supposed to be. If your specific use case requires that there is an invisible marker at that location, you can easily create that invisible marker yourself.

split ruin
#
private _gridPos = mapGridPosition uberPos;
systemChat format ["Task GPS GRID : %1", _gridPos];

when I have time I want to make "real" radio call to observer

#

@willow hound issue is solved, but task framework is very limited, how you will get pos of task marker for example ?

#

I cannot find something like BIS_fn_getTaskMarkerPos πŸ˜†

willow hound
#

Aren't you the one who creates the tasks in the first place? In that case, you already know where the tasks are located, because you created them there ...

split ruin
#

what are we talking about ? πŸ˜΅β€πŸ’«
I found solution 3 comments before your comment

frail escarp
#

Why sleep command doesn’t seem to work?

stable dune
frail escarp
frail escarp
# stable dune Trying without a scheduled event or in the wrong place. Could you provide your ...

There we go (it's my first mission):
sleep 20;
cpt sideChat "Carlos, do you copy?";
sleep 3;
playerof sideChat "Hey Lieutenant...";
sleep 7;
cpt sideChat "Damn it, I dropped my radio...";
sleep 6;
cpt sideChat "You still there?";
sleep 4;
playerof sideChat "Obviously...";
sleep 2;
cpt sideChat "I need you to go somewhere. We've got some report about suspicious activity...";
sleep 4;
playerof sideChat "And where to?";
sleep 3;
cpt sideChat "Just get in the damn car. It's behind your post.";

stable dune
frail escarp
willow hound
#

Yes.
Alternatively, you can avoid the SQF file by using spawn in the trigger ...

[] spawn {
  sleep 20;
  cpt sideChat "Carlos, do you copy?";
  sleep 3;
  //Add the rest of the dialogue here ...
};
```... but I recommend using SQF files for scripts that are longer than a handful of lines. It's much easier to read and write code in a text editor instead of the small trigger expression input fields in the Eden Editor.
frail escarp
#

Thanks so much

real folio
#

Hello, complete smooth-brain noob here. I have a question regarding this code: #arma3_scripting message
which was a reply to this original question: #arma3_scripting message
Rather than scripted autosaves, i would like to utilize player-triggered saves via an addAction on an object. What's more, i'd like to implement a cooldown timer that requires a certain amount of time to pass in-game before it's usable again. My rudimentary understanding leads me to believe that enabling/disabling saving is an all-or-nothing proposition, and can't be worked around via script. Is this still the case three years later?

jagged mica
#

What's the standard when it comes to using remoteExec in mods? Ive got some local functions but I need them run globally, is it safe to use it or does it open pathways for abuse? Do I need to add them to CfgRemoteExec? Or is event-listener approach the game, such as CBA Global Events?

tulip ridge
#

Also removes the chance for your mod / script to simply not work because someone blocked things through CfgRemoteExec

#

CBA events also make the networking pretty easy, because you can just only add the event handlers where needed, e.g.

if (isServer) then {
    ["YourPrefix_doSomethingServer", {}] call CBA_fnc_addEventHandler;
};

if (hasInterface) then {
    ["YourPrefix_doSomethingClient", {}] call CBA_fnc_addEventHandler;
};

There's also the serverEvent, targetEvent, and ownerEvent functions as well

pallid palm
#

holy moly πŸ™‚

tulip ridge
willow hound
# real folio Hello, complete smooth-brain noob here. I have a question regarding this code: h...

Here's the situation (if my understanding of the conversation you linked is correct):
It is possible to disable all saving (including scripted autosaves with saveGame and manual saving from the pause menu) using enableSaving [false, false]. It is also possible to reenable saving with enableSaving [true, false].
The problem discussed in the original conversation is that saveGame did not work immediately after saving had been reenabled. As such, after reenabling saving with enableSaving [true, false], one had to wait at least until the next frame before using saveGame. That is what the code you linked to does: It enables saving, waits, saves and then disables saving again.
I do not know if one still has to wait between enableSaving and saveGame today.

#

You do not need enableSaving to implement a cooldown for your addAction-triggered saves (unless you want to disable manual saving from the pause menu so that addAction-triggered saving is the only available form of saving).

jade acorn
#

how can I apply a damage texture to a unit without showing the option to heal said person? Thought that setting a hitpoint damage would bypass this but nope, I guess it's because the treshold to show blood on unit is 0.51

rugged current
#

hello guys , can you plz share with me a good video for arma3 scripting ?

real folio
jagged mica
jagged mica
steel spoke
#

ok

#

hello chat

#

i have a script

#

works great in SP and local hosted MP

#

does not work in dedicated servers properly

#

Generally speaking, the script does this

  1. When you place down a command post object dynamically in zeus or instantiate one in eden, it should load command post init, which does this
/*
Function: 
    AWR_fnc_commandPostInit
Author:
    Queen
Description:
    initializes Command Post capture function on object
    breaks when placed in Eden on certain maps
Parameters:
    _object     - Command Post object <OBJECT>
    _name         - Sector Name <STRING>
    _designation     - Sector Designation <STRING>
    _owner        - initial owner <INTEGER> (OPTIONAL)
    _size        - trigger size for sector <INTEGER> (OPTIONAL)
    _isRespawn    - is command post a respawn <BOOLEAN> (OPTIONAL)
Returns:
    Nothing
Examples:
[this, "Imperial Command Post", "I", 1, 10, false] call AWR_fnc_commandPostInit;
[this, "Rebel Command Post", "R", 0] call AWR_fnc_commandPostInit;
*/

params ["_object", "_name", "_designation", ["_owner", 1], ["_size", 10], ["_isRespawn", false]];


if (is3DEN) exitWith {};
private _hasRun = _object getVariable ["Initialized", false];
if (_hasRun) exitWith {};

 


 //[] call AWR_fnc_progressBarInit;

private _position = getPosATL _object;

// createGroup and createUnit are needed to create modules
// creating them with createVehicle will not work
private _group = createGroup sideLogic;
private _sector = _group createUnit ["ModuleSector_F", _position, [], 0, "CAN_COLLIDE"]; // _position is [x, y, z]

_sector setVariable ["FirstRun", true];
//creates respawn if is respawn
_respawn = [_owner, _isRespawn, _object, _name] call AWR_fnc_commandPostRespawn;

// it is possible to change the sector's parameters using setVariable
_sector setVariable ["Name", _name, true];
_sector setVariable ["Designation", _designation, true];
_sector setVariable ["OwnerLimit", 1, true];
_sector setVariable ["sides", [west, east], true];
_sector setVariable ["DefaultOwner", _owner, true];
_sector setVariable ["CommandPostObject", _object, true];
_sector setVariable ["isRespawn", _isRespawn, true];
_sector setVariable ["respawn", _respawn, true];
_sector setVariable ["OnOwnerChange", "params ['_sector', '_owner', '_ownerOld']; [_sector, _owner, _ownerOld] call AWR_fnc_captureCommandPost;", true];

[_sector] call BIS_fnc_moduleSector; // initialises the sector

// after initialisation, sync an area trigger to the module, it will be the capture area
private _area = createTrigger ["EmptyDetector", _position];
_area setTriggerArea [_size, _size, 0, false, _size]; // change values depending on the size you want
_area setTriggerActivation ["ANY", "PRESENT", false];
_area setVariable ["isServerOnly", true, true];
_sector setVariable ["areas", [_area], true];

_object setVariable ["Initialized", true, true];
_sector setVariable ["FirstRun", false, true];
true;

code above creates a sector, and stores variables within the sector itself to store the current object state and whatnot.
when the sector is captured / swaps sides, it runs this

#
/*
Function: 
    AWR_fnc_captureCommandPost
Author:
    Queen
Description:
    Object replacer for when command post is captured
Parameters:

Returns:
    Nothing
Examples:
*/
params ["_sector", "_owner", "_ownerOld"];

private _firstRun = _sector getVariable "FirstRun";

if (_firstRun) exitWith {};

private _object = _sector getVariable "commandPostObject";
private _isRespawn = _sector getVariable "isRespawn";
private _respawn = _sector getVariable "respawn";

private _objectPosition =  getPosATL _object;

private _won = ["won", "won2", "won3", "won4"];

private _lost = ["lost", "lost2", "lost3", "lost4", "lost5", "lost6"];

switch (_owner) do
{
    case west: 
    { 
        private _newObject = "ls_commandPost_imperial_blue" createVehicle _objectPosition;
        _newObject setPosATL _objectPosition;
        _sector setVariable ["commandPostObject", _newObject, true];
        _sector setVariable ["Name", "Imperial Command Post", true];
        _sector setVariable ["Designation", "I", true];
        if (_isRespawn) then {[west, _newObject, "Imperial Command Post"] call BIS_fnc_addRespawnPosition;};
        playSound selectRandom _won;
        deleteVehicle _object;
    };
    case east: 
    {
        private _newObject = "ls_commandPost_rebel_red" createVehicle _objectPosition;
        _newObject setPosATL _objectPosition;
        _sector setVariable ["commandPostObject", _newObject, true];
        _sector setVariable ["Name", "Rebel Command Post", true];
        _sector setVariable ["Designation", "R", true];
        if (_isRespawn) then {[east, _newObject, "Rebel Command Post"] call BIS_fnc_addRespawnPosition;};
        playSound selectRandom _lost;
        deleteVehicle _object;
    };
    case sideUnknown:
    {
        if (_isRespawn) then {_respawn call BIS_fnc_removeRespawnPosition;};
    };
    default 
    {
        private _newObject = "ls_commandPost_rebel_red" createVehicle _objectPosition;
        _newObject setPosATL _objectPosition;
        _sector setVariable ["commandPostObject", _newObject, true];
        _sector setVariable ["Name", "Imperial Command Post", true];
        _sector setVariable ["Designation", "I", true];
        if (_isRespawn) then {[east, _newObject, "Imperial Command Post"] call BIS_fnc_addRespawnPosition;};
        playSound selectRandom _lost;
        deleteVehicle _object;
    };
};



which changes the commandpost object, plays a sound file and saves new variables into the sector

#

ignoring the respawn portion as that's an optional fun thing,

#

in dedicated MP, the script seems to refuse to actually spawn in the new object, and doesn't play the sound file

#

oh and here's my init

#
class AWR_commandPostImperial: AWR_commandPostImperial_Base
{
    displayName = "[80th] Imperial Command Post";
    editorCategory = "AWR_Props";
    editorSubcategory = "AWR_Utilities";
    class EventHandlers
    {
        init = "params ['_entity']; [_entity, 'Imperial Command Post', 'I', 1] call AWR_fnc_commandPostInit;";
    };
};
#

would love some help

#

thanks

tulip ridge
#

Pretty sure those BI functions need to be run on the server, and spawning one in Zeus makes it local to your machine

steel spoke
#

so it would theoretically only work in eden?

#

well

#

when i spawn in zeus

#

it creates the sector

#

and that works for everyone

tulip ridge
#

Oh actually init will run on all machines there, so not that

steel spoke
#

and i know it's calling properly

#

bc it deletes the commandpost on side change

#

but it doesn't create a new one

willow hound
# real folio Yes, i forgot to mention that aspect; I want the normal pause menu save to be di...

I think the save slots used by saveGame are separate from the slots used for manual saves. I think there are like two slots for saveGame and four or five for manual saves. I'm pretty sure that there is no limit to the number of saves you can create with saveGame; it almost certainly just overwrites previous saveGame saves automatically.
You should be able to play around with this stuff in the mission preview in the Editor. There, you should be able to create manual pause menu saves and you can also run saveGame through the debug console. You can see all available saves in the pause menu where you can load a previous save.

blissful current
#

How do I add a zeus entity slot on the lobby screen? I already have a zeus module that gives gamemaster to adminLogged. But can I do both?

tulip ridge
blissful current
#

I tried that but it's not showing up in the lobby.

#

I'm used to seeing it below the blue icon:

tulip ridge
#

I think that's only if the forced interface option is enabled

blissful current
willow hound
#

There are some virual entites that you can place in the Editor, including Virtual Curator ... under modules somewhere I think.

blissful current
#

Maybe that's what I'm thinking of.

willow hound
#

Systems β†’ Logic Entities β†’ Virtual Entities

blissful current
#

Oh interesting. Why is there one that doesn't have a side?

willow hound
#

All of them should be sideLogic.

blissful current
#

What is that?

exotic gyro
#

Does anyone know offhand if it's possible to find the world position of a memory point of an equipped weapon? usti hlavne, for instance

granite sky
#

IIRC Leopard posted recipes for that sort of thing here. Might be able to find it in search.

exotic gyro
#

The rub here is that I can't get an object ref to a proxy, so SelectionPosition won't work here.

pallid palm
#

i must thank all you Guys: ("To Many to say all the Names") for helping Me with my missions: its so Nice to play withOut any Erras: and everything working so perfect: WooHoo Arma 3: Many Many Thanks" i love it

eternal spruce
thin fox
#

if blufor units or players are inside the trigger, it will apply the safe zone script for them

eternal spruce
#

Because i cant fire any weapons in hand but i can in a vehicle, let me know what i did wrong

thin fox
eternal spruce
# thin fox try `player in thisList || {(vehicle player) in thisList}`

I did all of that and I know the script works because I got this message Zona Segura when i try to shoot a rifle, but still I'm able do use a vehicle's weapon, but never mind that i can work around it but I noticed i still take damage in the trigger area because i got shot down in an airplane, there must be something I did wrong.

thin fox
#

tomorrow I'll take a look what I did for vehicles, but I'm sure that I've just added that condition in the trigger

eternal spruce
#

Ok no problem

buoyant hound
#

Need guide for spawn a weapon from array list on ground and when player pick gun it will respawn after a few second

hushed turtle
thin fox
pallid palm
#

@hushed turtle yes it keeps my mind sharp: along with playing music and studying music: and along with Golfing: also i'm a nutritionists: iv been studying nutrition way back as far as when i was like 18 years old: So yes you are correct Sir

#

and yes im 64: but im a kidd at Heart

#

i learned so much in the last year with all you guys helping me: its Amazing

jagged mica
exotic gyro
#

So yeah, I'll do that and cache it for later

tulip ridge
#

How can I check if a string can be parseSimpleArray'd? Doing some UI work and I want some feedback to players that the input is invalid

still forum
still forum
still forum
tulip ridge
#

Sounds like a canParseSimpleArray ticket πŸ™‚

still forum
#

Or just let them run into the error for doing it wrong

#

run it directly after their input, if empty array tell them

tulip ridge
#

Oh does parseSimpleArray still return [] if it fails?
I hadn't checked what it returned on error yet, still trying to set the ui up how I want it

#

Oh it does neat, so yeah just check if the parsed one is empty and the input isn't "[]"

oak loom
#

Good morning, i have 30 mods on the server right now and I dont like the performance hit we are getting. I would like to have the mods in a folder on the desktop. Is there a current how to or a script to go off of or something that will let me do this? Thanks.

#

BTW new to scripting but made it thru the server setup

exotic gyro
#

If only thirty mods are hurting you, your mods should be replaced with better ones

oak loom
#

I get that server doesn't have clashes but I want to expand further to alot more. Rather than have them in the servers folders. Thx

exotic gyro
#

Do you mean you lack, like...storage space? I don't see why moving the folders would do something

oak loom
#

No space is fine. Keeping them in the game folder and using the -mod= is being a pain in the ass tbh

thin fox
oak loom
#

I'd like to keep them separate in a folder on the desktop and running out of space on the shortcut line is run out of space

#

That's what I want to do just dont have the k ow how to get this done. Folks have said you can do it just there's no how to for it from where I have looked. I know some servers running over 100 I just want this in place in case we get there too