#arma3_scripting

1 messages Β· Page 434 of 1

lusty canyon
#

what does making their missions safe mean? safe from what?

winter rose
#

safe from a guy injecting actions allowing him to spawn a tank for example

little eagle
#

People remotely executing code if they have managed to execute arbitrary code on their local machines already.

meager heart
#

dude, best anti cheating thing is admin πŸ˜€

winter rose
#

and BIS_fnc_call is -really- powerful as it can call on the server

little eagle
#

dude, best anti cheating thing is admin
This. It's the only anti cheating method you have.

meager heart
#

yep... sad_face.paa

little eagle
#

It also protects from spammers and griefers.

meager heart
#

πŸ€” -HC test/benchmark missions interesting

ornate pawn
#

Can somebody help me with this script? this addActions is for a laptop and when it gets executed it sets a texture on diferente monitors creating an animation effect but other players can

#

can't see the images changing

winter rose
#

setObjectTextureGlobal?

ornate pawn
#

its for a powerPoint that i'm creating

subtle ore
#

are you the new rock pusher Lou?

ornate pawn
#

[
  schoolLaptop,
  "Start Presentation",
  "images\take_ca.paa",
  "images\take_ca.paa",
  "_target distance schoolLaptop < 2",
  "_target distance schoolLaptop < 2",
  {},
  {},
  {
  PowerPointScreen_1 setObjectTexture [0, "scripts\BEW\PowerPoint\images\bg\desktop_1_ca.paa"];
PowerPointScreen_2 setObjectTexture [0, "scripts\BEW\PowerPoint\images\bg\desktop_1_ca.paa"];
PowerPointScreen_3 setObjectTexture [0, "scripts\BEW\PowerPoint\images\bg\desktop_1_ca.paa"];
schoolLaptop       setObjectTexture [0, "scripts\BEW\PowerPoint\images\bg\laptop\laptop_desktop_1_ca.paa"];
sleep 6;
PowerPointScreen_1 setObjectTexture [0, "scripts\BEW\PowerPoint\images\bg\desktop_2_ca.paa"];
PowerPointScreen_2 setObjectTexture [0, "scripts\BEW\PowerPoint\images\bg\desktop_2_ca.paa"];
PowerPointScreen_3 setObjectTexture [0, "scripts\BEW\PowerPoint\images\bg\desktop_2_ca.paa"];
schoolLaptop       setObjectTexture [0, "scripts\BEW\PowerPoint\images\bg\laptop\laptop_desktop_2_ca.paa"];
sleep 0.1;

  },
  {},
  [],
  0.5,
  1000,
  false,
  false
] call BIS_fnc_holdActionAdd;

#

even if i use setObjectTextureGlobal

#

other players can't see when the images are changing

winter rose
#

@subtle ore ?

are you the new rock pusher Lou?

you mean the sqf hard worker? πŸ˜„

subtle ore
#

@winter rose Same thing :p

winter rose
#

I wasn't sure I got it the right way, hehe
but hey I am on a run

#

next week I may be on a strike πŸ‡«πŸ‡·

subtle ore
#

Lol, Bullseye there isn't a lick of setObjectTextureGlobal In your code

ornate pawn
#

yeah i know

#

but like i said

#

even if use that command

#

it wont work

subtle ore
#

Please paste the revised if you can

ornate pawn
#

revised?

winter rose
#

actually it should work with setObjectTextureGlobal, so maybe the mission wasn't recompiled/redownloaded properly

#

also, the sleep 0.1 at the end doesn't do anything, you can remove it

subtle ore
#

Revised - New code that yoy were talking about inputing setObjectTextureGlobal

ornate pawn
#

haha the 0.1 sleep command is to change images faster so it creates a video effect

#

i had to cut the code in half in order to be able to put it here

meager heart
#

action priority 1000 like extremely huge* πŸ˜„

ornate pawn
#

cause its long

#

hahaha

subtle ore
#

change images faster
Whaaa...? That's suspension dude doesn't make any sense

ornate pawn
#

it is a long code

#

dude

#

[
  schoolLaptop,
  "Start Presentation",
  "images\take_ca.paa",
  "images\take_ca.paa",
  "_target distance schoolLaptop < 2",
  "_target distance schoolLaptop < 2",
  {},
  {},
  {
PowerPointScreen_1 setObjectTexture [0, "\scripts\BEW\PowerPoint\images\bg\desktop_1_ca.jpg"];
sleep 0.1;
PowerPointScreen_1 setObjectTexture [0, "\scripts\BEW\PowerPoint\images\bg\desktop_2_ca.jpg"];
sleep 0.1;
PowerPointScreen_1 setObjectTexture [0, "\scripts\BEW\PowerPoint\images\bg\desktop_3_ca.jpg"];
sleep 0.1;
PowerPointScreen_1 setObjectTexture [0, "\scripts\BEW\PowerPoint\images\bg\desktop_4_ca.jpg"];
sleep 0.1;
PowerPointScreen_1 setObjectTexture [0, "\scripts\BEW\PowerPoint\images\bg\desktop_5_ca.jpg"];
sleep 0.1;
PowerPointScreen_1 setObjectTexture [0, "\scripts\BEW\PowerPoint\images\bg\desktop_6_ca.jpg"];

  },
  {},
  [],
  0.5,
  1000,
  false,
  false
] call BIS_fnc_holdActionAdd;

#

that

#

you can see that the sleep 0.1; is very fast

#

so it change images on screens fast so it creates a video effect

winter rose
#

setObjectTextureGLOBAL please ^_^

subtle ore
#

Remove the sleep and you're watching the world unfold

ornate pawn
#

lol

winter rose
#

if you don't set it to sleep it will jump immediately to the last image though

ornate pawn
#

yeah

#

that's why it has that sleep command

#

cause i tried without the sleep command

winter rose
#

replace with

{
for "_i" from 1 to 6 do {
PowerPointScreen_1 setObjectTextureGlobal [0, format ["\scripts\BEW\PowerPoint\images\bg\desktop_%1_ca.jpg", _i]];
sleep 0.1;
}
}
ornate pawn
#

Lmao

#

okay thanks

winter rose
#

^ this code should do the job

ornate pawn
#

okay i will try it in a min

errant jasper
#

Isn't the problem with setObjectTextureGlobal, that when you pack your mission into a PBO, the one calling setObjectTextureGlobal uses the absolute path, so all other connected machines get an invalid path?

winter rose
#

dang that's a problem? o_o

errant jasper
#

I just recently had to rewrite BIS_fnc_setUnitInsignia since it did not work with insignias placed in the mission folder.

winter rose
#

dangdangdang... I may have to revise some missions

errant jasper
#

The way I do, since it is Arma that makes internally converts the relative path to the absolute, is to use my own "global" function, that then triggers the local command on each machine with the relative path.

winter rose
#

I see how to do it, but I totally was unaware of the issue! and I recently made missions using that

errant jasper
#

For BullsEyE|WORKS#3222, it might be enough with just a publicVariable that holds the current slides, and client then just has an event handler for that. And JIPs of course just add the event handler, and read the current value.

winter rose
#

well, good to know

meager heart
#

define mission root maybe in description with preproc

errant jasper
#

Well, yes that will work. But for setObjectTexture(Global) there is no need since supplying the relative path works fine. The problem is the setObjectTextureGlobal command that tries to apply the absolute path across the network. Basically, setObjectTextureGlobal is useless for textures stored in the mission.

meager heart
#

oh ic

errant jasper
#

But you are right, defining the mission root can be useful for config based entries. Like ORBAT textures stored in the mission.

#

insignia = __EVAL(MISSION_ROOT + "arstotzka.paa");

little eagle
#

setObjectTextureGlobal with sleep so short will not create a video effect, due to network delay and also the scheduler. This will not work.

winter rose
#

@ornate pawn so, result? πŸ˜ƒ

still forum
winter rose
#

yup, then/than

#

and OMG a new command πŸ˜„

still forum
#

A actually useful and awesome command

winter rose
#

performance-wise AND logical-wise

still forum
#

Finally we can yell at people who put a exitWith into their forEach to exit it early

subtle ore
#

😱

quartz coyote
#

Looks awesome !

robust geyser
#

tbh

#

All I want is the cmd for mapdraw for my boy @cold quartz can link athena to it

still forum
#

mapdraw?

robust geyser
#

The

#

Line drawing w/ cursor.

#

They didn't release it yet for scripting

meager heart
#

πŸ€”

robust geyser
#

from my knowledge

still forum
#

ACE has line drawing with cursor :u

robust geyser
#

Yeah, but vanilla has it as well.

#

Waiting for it to be released for he can link his mod to it and be able to show drawn lines from vanilla to his 2nd monitor app.

still forum
#

I would prefer my AddWeaponWithAttachmentsCargo(Global) command.

robust geyser
#

yessss

still forum
#

They just need to copy-paste :U Shouldn't take them that long

robust geyser
#

Yeah, not entirely sure why it takes them a while to actually put out some of this stuff.

winter rose
#

unit tests! QA!

robust geyser
#

lol

#

better ai pls

winter rose
#

They just need to copy-paste :U

I am into tests right now πŸ˜„

#

that's why

still forum
#

I already tested it thoroughly by reading it's code atleats 3 times!

winter rose
#

"oh! okay then, carry on"

robust geyser
#

lol

winter rose
#

TESTING IS FOR THE WEAK

#

TRUST YOUR CODE

#

I say that when I want to scare my colleagues away

lone glade
#

Finally we can yell at people who put a exitWith into their forEach to exit it early
@still forum
Nope

winter rose
#

readability first!

#

except for sqf where short-named vars will improve performances πŸ˜„

lone glade
#

it won't

still forum
#

Please don't start that argument @lone glade otherwise I would need to say things that no one here wants to hear.

lone glade
#

that people using sentences as vars should be πŸ—ž 'ered ?

still forum
#

Yes. Paper them all

winter rose
#

50 chars is fine

#

runs away

meager heart
#

readability first!
BIS_fnc_showRespawnMenuInventoryLimitRespawn yeah...

robust geyser
#

lol

still forum
#

readbility first!
AddWeaponWithAttachmentsCargo(Global) YEAH MAN

meager heart
#

tbh this ^ is... like.... better ?

lone glade
#

modelToWorldWorld says hi

meager heart
#

visualworldvisualworld

winter rose
#

if (unit call _myFnc_fnc_UnitIsAliveAndNotDeadAndAlsoHeMustHazAGunKThxBai) then { (…) }

#

btw I didn't say how it is, I said how it should be :p

tough abyss
#

Is there a command to return the level of zoom in an optic?

lone glade
#

No, but you can calculate it yourself, that's what we did for ace arsenal stats

still forum
#

name length for script commands doesn't matter

tough abyss
#

Well, all I want to know is if they are zoomed in (say on the LRPS) or using the zoomed out mode.

still forum
#

but variable length does matter-ish

lone glade
#

ooooooh

#

no you can't

still forum
#

@lone glade is that findIf command actually on dev-branch? Didn't see that in changelog anywhere.

winter rose
#

same

lone glade
#

good point, lemme check

#

might've been added today, gimme 2 minutes

still forum
#

Not in todays changelog

lone glade
#

it's in

#

[0,1,2,3,10,5] findif {_x == 10} returns 4

tough abyss
#

Why wouldn’t it?

#

Oh miss read

#

My bad

still forum
#

I guess I can scrap my intercept variant of that then πŸ˜„

#

One done. A couple dozens more to go

peak plover
#

What happend to the github thing u guys were doing for arma

still forum
#

My PR is ready. But I'm scared of clicking the merge button

lone glade
#

MERGE THAT GODDAMN PR DED

still forum
#

merged

#

I still hate you

lone glade
#

weeeeee

#

the color of hypertext is bit hard on the eye but it's fine.

still forum
#

hypertext? XD

lone glade
#

text with hyperlinks

still forum
lone glade
#

you know, clickable text that get you to web pages

still forum
#

Yeah we don't have any design yet πŸ˜„

subtle ore
little eagle
#

NOTE: Because command findIf terminates as soon as it finds an element that fulfills the condition, it is more efficient then count in scenarios where you need to check for presence / absence of at least one element that evaluates to true.

#

than*

still forum
#

:U

#

WTF

#

I fixed that tho

lone glade
#

@little eagle for count yes, not for foreach.

robust geyser
#

Will { _x enableFatigue false; } forEach (units group player); disable stamina for everyone?

still forum
#

no

robust geyser
#

ree

still forum
#

only for units in the group of player

subtle ore
#

Heh

robust geyser
#

trying to execute a code while on multi to disable fatigue

subtle ore
#

On multi to disable fatigue? What?

robust geyser
#

Using Achille's execute code module to execute a script in order to disable fatigue on a multiplayer server.

subtle ore
#

GROSS. 🀒

robust geyser
#

Current fatigue settings on the server are like.. 1lb = no stam lol

#

it's fed

#

f'd

subtle ore
#

And so are you for using archilles,

{
    _x enableFatigue false;
} forEach allPlayableUnits;
robust geyser
#

yes

little oxide
#

animate not JIP on simple objects ?

subtle ore
#

@little oxide Well I don't know mr read the wiki man, what's the problem you're having?

little oxide
#

I have a animate on server on my simple object, but when connect i don't see the animate

still forum
#

a animate?

little oxide
#

yeah i have an animation on my object, when created with simple object, i animite it on my server, but when i connect to my server so JIP, i don't see the animation working at alll

#

it's a limit of simpleobject or just a bug

little eagle
#

So findIf is a replacement for anything like:

private index1 = -1;

{
    if (cond1) exitWith {
        index1 = _forEachIndex;
    };
} forEach array1;

index1

right?

still forum
#

yes

little eagle
#

Be honest. Did this really need a command?

#

You save one if command per iteration, which isn't much, at the cost of ugly looking code.

#

And people freak out after #. I don't understand.

still forum
#

it also saves performance

#

:3

lusty canyon
#

i have a killed EH on a hostile plane, when triggered how reliable is it to get the correct killer player object if it doesnt die right away but dies due to crashing?

subtle ore
#

If the cause of death is crashing then it will return null

#

however the instigator

#

will not

lusty canyon
#

so i should always just get the instigator (select 2) instead of the select 1?

little eagle
#

Pretty sure the killer is the pilot if the plane crashes. And the same should be true for the instigator.

#

Not <null>

subtle ore
#

Rock pusher probably has something to say about it

#

Not if it was damaged beforehand?

#

It's sort of like if you were to kill somebody after they were injured

little eagle
#

killed eventhandler is not concerned with who damaged the object last, no.

lusty canyon
#

so whats the most reliable way to get the player obj that made the plane crash?

subtle ore
#

Then what is with instigator? It's the same thing as killer at that point

little eagle
#
_plane addEventHandler ["HandleDamage", {
    params ["_plane", "", "", "_source"];

    if !(_source in [objNull, driver _plane]) then {
        _plane setVariable ["commy_lastDamageSource", _source];
    };
}];

_plane addEventHandler ["Killed", {
    params ["_plane"];

    private _source = _plane getVariable ["commy_lastDamageSource", objNull];
}];

Something like this maybe.

lusty canyon
#

how about i use the hit EH to record a tally of each instigators hit on the plane? when the plane crashes the player with the highest hit count WINS πŸ˜‰

#

yeah ill go with lastdamagesource, seems more reliable than anything else since it works even if the plane died in air

#

thanks bigC

peak plover
#

How do I get vector

#

to addVelcoity

#

That moves target away from player

strange urchin
#

Wouldn’t you just take the vectorFromTo?

#

From the player to the target?

meager heart
peak plover
#

hmm, yeah

little eagle
#

Every vector, except 0,0,0; points away from the player.

peak plover
#

oaky

meager heart
#

need some corrections for this

player addAction ["Test move thing",{
    private _caller = _this select 1;
    private _eyePos = eyePos _caller;
    private _target = cursorTarget; 

    if (!isNull _target) then {
        private _vector = _eyePos vectorAdd (_eyePos vectorFromTo getPosWorld _target);
        private _targetDir = _eyePos vectorFromTo getPosWorld _target; 
        private _vectorUp = _targetDir vectorCrossProduct [0,0,0]; 
        private _speed = 10;
        private _velocity = _targetDir vectorMultiply _speed;

        _target setVectorDirAndUp [_targetDir, _vectorUp]; 
        _target setVelocity _velocity; 
    };
}];
#

i'm horrible with vectors

little eagle
#

_this param [1];
What's the point?

meager heart
#

*fixed

little eagle
#

You could've written param [1] without the _this.

#

Because the unary syntax of param uses _this. That was what I was talking about.

meager heart
#

rgr

little eagle
#

You wrote _eyePos vectorFromTo getPosWorld _target twice. Seems like a waste.

#

Vector cross product with 0,0,0 is always 0,0,0.

#

Also a waste.

#
    private _vdir = _origin vectorFromTo _target;
    private _vlat = vectorNormalized (_vdir vectorCrossProduct [0,0,1]);
    private _vup = _vlat vectorCrossProduct _vdir;

This is how you get an up vector for setVectorDirAndUp.

meager heart
#

oh ic with vectorNormalized

little eagle
#

Yeah, and [0,0,1]. You know, pointing upwards.

#

0,0,0 is not a normal vector. It's the null vector. Cross product with the null vector is another null vector.

#

I wonder what the normalized null vector is according to SQF / Arma πŸ€”

meager heart
little eagle
#

Well yeah. You don't want to change the vehicles direction. Previously your setVectorDirAndUp code just failed silently, because you produced an invalid up vector.

#

Now that that is fixed the code works. Just not how you intended it.

torn juniper
#

hey commy2 - RE: your suggestion yesterday using killed EH works fine but not in mp sessions

#

and mpkilled doesn't seem to work

#

just trying to delete a weapon on a players dead body

little eagle
#

The MP eventhandlers are junk, yeah.

torn juniper
#

(β•―Β°β–‘Β°οΌ‰β•―οΈ΅ ┻━┻

#

same code works on client but not server, both global though

#

ugh

little eagle
#

Wait, does it work in SP or "on client"?

torn juniper
#

SP

little eagle
#

There's no client in SP.

torn juniper
#

yea - I meant works in SP not a client on a server

little eagle
#

Post code?

torn juniper
#

ok - 1 sec

#

works fine for SP so I would actually make a clean version and not that

#

just trying to pick any method, tried directly removing from player, going through nearest objects clearing cargo/removing weapons.. treating it as a cargo object/weapon holder treating as a player

#

no dice

#

it correctly displays that a player has weapons in all those searches but never removes it

little eagle
#

Where is this executed from?

meager heart
#
player addAction ["Test move thing",{
    private _caller = _this select 1;
    private _eyePos = eyePos _caller;
    private _target = cursorTarget; 

    if (!isNull _target) then {
        private _targetDir = _eyePos vectorFromTo getPosWorld _target; 
        _target setVelocity (_targetDir vectorMultiply 10); 
    };
}];
```da hotfix v 3. https://gyazo.com/ea93eacee01214102c030064d0fcfe37
@peak plover
#

Β―_(ツ)_/Β―

torn juniper
#
_player addMPEventHandler ["MPKilled", {_this call Server_onMpKilled}];
player addEventHandler ["Killed", { _this call Client_events_onKilled}];```
#

on player creation is first one (serverside) and second is in a postinit

#

I have another method which would be scanning the inventory when someone opens up gear and deleting a weapon but that would be terrible running that on an InventoryOpened EH

#

😦

little eagle
#

Which is the one you linked?

torn juniper
#

both

#

the code is the exact same for each

little eagle
#

lol

torn juniper
#

was originally trying just server and copied it directly to client/sp and made a regular EH with it and it removes all weapons fine

#

now just trying to worry about server

little eagle
#

And the point of this is to remove the pistol, rifle, launcher and binocular from the player units once they die?

meager heart
#

lul

torn juniper
#

was trying to do just launcher, but yes if needed/only way is to remove it all then I would remove everything and I could add it back to the body I guess

little eagle
#
// initPlayerLocal.sqf
params ["_unit"];

_unit addEventHandler ["killed", {
    params ["_unit"];

    _unit removeWeapon primaryWeapon _unit;
    _unit removeWeapon secondaryWeapon _unit;
    _unit removeWeapon handgunWeapon _unit;
    _unit removeWeapon binocular _unit;
}];

Isn't this basically just this?

torn juniper
#

yes - that would work for the player in SP

unborn ether
#

^ MP too.

meager heart
#

even underwater on dedicated πŸ˜„

little eagle
#

Have you actually tried this in MP, Andrew?

#

I'm not 100% sure removeWeapon works with the binocular. It might need unlinkItem. I can never remember this.

torn juniper
#

I'll give it a shot using initplayerlocal - had it in a mod before

unborn ether
#

unassignItem will do 100%

#

sorry unlinkItem is a way, it will vanish

little eagle
#

unassign fails if the inventory is full. And it just puts it into the containers, not removes the item.

meager heart
#

removeWeapon works with the binocular < works

little eagle
#

Thanks.

meager heart
#

#100

torn juniper
#

starting up the server now - will see

little eagle
#

🍿

meager heart
#

slight tension in the auditorium

unborn ether
#

just a random text you just read

warm bronze
#

Andrew is typing

torn juniper
#

I don't know if I should be surprised or upset.. probably both

It doesn't work

I used sublime to search all mods I am running and there is a file called that removes all killed eventhandlers
player removeAllEventHandlers "Killed";

#

bruh

#

salt

little eagle
#

🀦🏻

torn juniper
#

I dunno why I didn't think of that lol

little eagle
#

This is why any code using removeAllEventHandlers and removeAllActions is always bad code.

unborn ether
#

infiSTAR does that alot

little eagle
#

Well yes. As I said.

torn juniper
#

annoying is what it is

#

lol

little eagle
#

Who wrote it?

meager heart
#

seems like Andrew - Today at 05:13 πŸ˜„

torn juniper
#

nono I didn't put remove all EH

#

I would feel worse if so

little eagle
#

Well, someone did.

unborn ether
#

@torn juniper If you are using infiSTAR /* Revert Killed EH */ _RKH = false; /* true or false */

torn juniper
#

im not but that is good info to know
Making a mod, all testing in base arma 3 works fine but loaded up exile to try and check compatibility and well.. thats where the line came from

#

they unhook a lot of eventhandlers which I rely on

#

I guess thats where my issue lies

little eagle
#

Any other mods loaded?

unborn ether
#

One Does Not Simply Walk into Mod

torn juniper
#

nope

#

just mine and that

little eagle
#

Good luck with that then. lol

torn juniper
#

yea it works disabling that

#

lol

little eagle
#

Was there ever any doubt really?

torn juniper
#

not once I figured out that it removed all eh

#

lol

little eagle
#

I mean, if I post something here and it doesn't work... Means pretty much always you fucked up somewhere.

torn juniper
#

of course πŸ˜› but yea I was annoyed thinking that arma was not letting me do something but nope I got exiled

#

blind sighted

meager heart
#

also about that infiSTAR addon... maybe that menu will add couple more options and maybe that will/can help for new guys... but imo it will just broke more than it will add...

torn juniper
#

the 30 euro addon?

meager heart
#

well... i know i'm started it, but that is really bad topic tbh, let's just stop it... sorry

tough abyss
#

if only arma was client-sided C++ the amount we could stop shady stuff would drastically increase

#

page gaurds all the memorys

meager heart
#

which values will be better to get from object for _target setVelocity (_targetDir vectorMultiply <value>),
trying to make it like slight push, but it should be universal for all kind of land vehicles... mass or size of bounding box / some value ?

#

was trying to help... now creating my own things with vectors lol

meager heart
#

problem solved with getMass

warm gorge
#
params [
    ["_object", objNull, [objNull]],
    ["_title", "", ["", []]],
    ["_script", "", [""]],
    ["_arguments", nil, [[], nil]],
    ["_priority", 1.5, [0]],
    ["_showWindow", true, [true]],
    ["_hideOnUse", true, [true]],
    ["_shortcut", "", [""]],
    ["_condition", "true", [""]],
    ["_radius", 50, [0]],
    ["_unconscious", false, [false]],
    ["_selection", "", [""]],
    ["_memoryPoint", "", [""]]
];

_object addAction [_title, _script, _arguments, _priority, _showWindow, _hideOnUse, _shortcut, _condition, _radius, _unconscious, _selection, _memoryPoint];
[_object, "Test", "", nil] call SR_fnc_addAction;

Any idea why this function isn't working?

#

16:28:45 Error 12 elements provided, 3 expected

robust hollow
#

memory point is in 1.81, so not out yet

warm gorge
#

Oh wow silly me, didn't even realise. Cheers

fringe torrent
#

Not sure where to ask
Is it possible to fire an Tigris when attached to a Taru...upsidedown

meager heart
#

yeah... at the same time you can fire with the goats as projectiles, to make it more immersive

fringe torrent
#

Sarcasme.....helpfull

meager heart
#

ok... serious answer:
Dear SabuMaru, yes you can, feel free to do so.

zenith totem
#

Does missionNamespace pass properly through remoteExec?

#

i.e. Would the following work

[missionNamespace,["globalVarOnClient",123]] remoteExecCall ["setVariable",remoteExecutedOwner];
meager heart
#

what for you doing that ?

zenith totem
#

Server sided handling of some data like cash

#

Basically the client will remoteExec a request to the server with data for logging purposes where the server will update their balance by an amount in a database and tell the client the new balance and whether the transaction was successful or not

#

If I can pass missionNamespace in remoteExec, that means I can simply call a function in a scheduled environment and have it wait until the server has finished it's part and return true/false (success) to whatever needs to update the balance

#

waitUntil {!isNil _randomTransactionVar}

#

I could achieve the same through publicVariableClient but that has risk of var clashes

#

I suppose I could always make a wrapper function if it doesn't

meager heart
#

well i don't get why you doing it this way... you can just set/getvariables to/from missionNamespace...

that means I can simply call a function in a scheduled environment
you can run any function in sheduled...

zenith totem
#

It needs to be set in the client's missionNamespace (global var space)

#

It's no good if I set that directly on the server lol

meager heart
#

you understand that missionNamespace is global, yes ?

zenith totem
#

Global to the client

#

setVariable will only set it on all clients if you tell it to

#

Which I do not want to do

#

I want to set a global var on a specific client

#

Because otherwise there's a (very small) risk of var clashing

#

And unnecessary data transmission if it were global to all clients

#

Although, looking at the wiki, you can now use a client ID in place of the true/false global arg

meager heart
zenith totem
#

Not what I need, but there's is new functionality in the command that works

#

It's own of those commands you use so often that you never need to check the wiki for syntax lol

lusty canyon
#

i cant seem to access missionNS get/set in the debug console, is there a restriction in that scope?

little eagle
#

: Does missionNamespace pass properly through remoteExec?
Yes.
There is no point in using remoteExecCall over remoteExec here.

warm gorge
#

Shouldnt remoteExecCall be used preferrably with basic functions that arent very intensive?

little eagle
#

remoteExec is identical to remoteExecCall for commands. So all you do by using REC is making your code look more complicated than it has to be.

warm gorge
#

Oh for commands yeah, didn't read up enough

little oxide
#

Anyone have the path of offroad p3d, I don't have my PC and i need it

lusty canyon
#

i want to spawn one plane at a time at map center, each time a player shoots down a plane they get score +1, then the next plane spawns after.


if (!hasInterface && !isServer) then {
    _startPos = [worldSize / 2, worldsize / 2, 0];
    _numPlaneWaves = [1,2,3,4,5];
    _plane = objNull;
    {
        waitUntil { (!alive _plane || _forEachIndex == 0) };                
        _plane = createVehicle ["O_Plane_Fighter_02_Stealth_F", _startPos, [], 0, "FLY"];
        createVehicleCrew _plane;
        _dir = direction _plane;
        _plane setvelocity [(sin _dir*300),(cos _dir*300),0];
        [(group _plane),_startPos,4000] call BIS_fnc_taskPatrol;
        
        _plane addEventHandler ["HandleDamage", {
            params ["_plane", "", "", "_source"];
            if !(_source in [objNull, driver _plane]) then {
                _plane setVariable ["DW_IMS_LAST_DMG_SOURCE", _source];
            };
        }];                
        _plane addEventHandler ["Killed", {
            params ["_plane"];
            private _lastHitByPlayer = _plane getVariable "DW_IMS_LAST_DMG_SOURCE";
            _scoresArr = [];
            {
                if ( _x == _lastHitByPlayer ) then {
                    _updateScore = (_x getVariable "DW_IMS_PLAYER_SCORE") +1;
                    _x setVariable ["DW_IMS_PLAYER_SCORE",_updateScore];
                };
                _scoresArr = _scoresArr + [(name _x),(_x getVariable "DW_IMS_PLAYER_SCORE")];                        
            } foreach (allPlayers - entities "HeadlessClient_F");                    
            missionNamespace setVariable ["DW_IMS_SCOREBOARD",_scoresArr];                
        }];    
    } foreach _numPlaneWaves;
};

but it doesnt work at all

still forum
#

Well.. You are spawning a plane in the ground.. I think..

little eagle
#

What's the point of setting all the player's scores to 0 at the beginning? This won't work for JIP anyway, so just handle 0 as the default value when using getVariable and remove that code block.

lusty canyon
#

ive tried running isolated bits of it locally and it works, the plane is in the air with crew and patrols as normal but when its on the HC nothing happens

#

ok ill get rid of that block

little eagle
#

waitUntil { (!alive _plane || _forEachIndex == 0) };
The or is pointless as null is always not alive.

#

Have you checked the HC's RPT file? Added some diag_log to see if the code was executd? Where is this executed from anyway?

lusty canyon
#

for that conditional i want to make it create veh on first loop, but all subsequent loops have to wait until the previous plane dies first before creating new one

little eagle
#

Yeah, and that is what this would do.

lusty canyon
#

yeah something seems to fuck up once its on the hc, ill add some diag logs and split it up some more

little eagle
#

It should never work really, because as dedmen pointed out, the plane would spawn at the ground level and probably just collide with it and explode.

lusty canyon
#

that part i tested multiple times, it does work

#

everything else tho doesnt

#

it even follow the flight path after banking a bit

#

"fly" isnt ground level "none" is ground level

little eagle
#

z=0 is ground level though.

meager heart
#

your _startPos z/heght is 0

lusty canyon
#

well all i saw in game wasthe pilot was pretty good at recovering lol
what if i get rid of the z index and turn it to pos2d

#

will the createveh "fly" auto add the z coord?

little eagle
#

It shouldn't, but who knows. The command already treats boats over sea different than other vehicles.

#

It's chaos.

lusty canyon
#

yeah i have problems spawning boats, is always underwater even with asl z + 3000

winter rose
#

why not setPosASL/setPosATL if you prefer?

#

(^ for planes)

unborn ether
#

^ createVehicle position argument is PositionAGL for boats and PositionATL for land vehicles, which are both you've mentioned at once basically.

#

anyways I still prefer using setPos afterwards. Not sure how createVehicle treats vehicles exactly.

fleet wind
#

Is there a command to force nightvison on or off. And if there is, Is it possible to do the same with thermals

fleet wind
#

ty

lusty canyon
#

i have a custom scoreboard array i would like to display.

example array data
[ 
    ["player1name", 5],
    ["player2name", 2],
    ["player3name", 1]
]

cant seem a way to get that into a single hint (cant use systemchat cuz disabled) array size count based on allplayers.
i dont want to make any messy UI custom dialogs just for this

fleet wind
#

The links you ave me before dont seem to work for what i am trying to do. @lusty canyon I want to Force night vission on a player. Not enable disable it.

#

nvm that link wont work πŸ˜‰

fringe torrent
zenith totem
#

@fringe torrent You can only do that because there's "animations" setup up by BIS to do so, there's no way to do it the other way round other than maybe embedding the vehicle in the ground but you'd probably need to godmode the vehicle

fringe torrent
#

Attachto object on ground
Wanna get the turret underneath a taru
As the blackfoot is just horror on a publicserver
I wanna create a alternitive

And things don’t work upside down for some reason

#

@zenith totem thanx anways

zenith totem
#

Generally weapons on vehicles don't work when the vehicle is upside down

#

You could remove weapons from the blackfoot if that works for what you want

obsidian chasm
#

Do I have to make an entirely new cfggroups file for OPFOR (currently have Blu working fine) or can I add an 'east' extension onto my file as it is?

#

ive looked everywhere for help on this but nothing seems to correlate with my issue lol

nocturne basalt
#

Hi guys. I trying to make a sound that moves around my object.
when using playSound3d, the sound is stuck to where the object was when playSound3d was called.
I also tried to move the object around (setVelocity or animating it) but the sound wont move.

Is it possible to make moving sounds?

#

could I have like a radio that flyes around a house?

subtle ore
#

you can use createSoundSource with a CfgSfx entry and it may move thay way. Dunno.

nocturne basalt
#

ok thanks Ill try

errant jasper
#

Sounds have to have a speaker (or source). I was making a mission where I had to create audio at certain positions. playSound3d did not work because of mission paths varying in MP. So I send message over the network, and created a fake hidden object that played the sound.

#

You could use that and then move it around

little eagle
#

Either createSoundSource or say3D. These two commands are the only ones that create potentially moving sounds.

nocturne basalt
#

@errant jasper I tried playing it from a hidden object that I move around but it didnt work. right now Im creating and deleting objects at certain points. works fairy ok, but it gets choppy

little eagle
#

I'd say createSoundSource is ideal for looping sounds, say3D is "ideal" for one-time moving sounds and playSound3D is ideal for one-time stationary sounds.

nocturne basalt
#

ok thanks Ill try say3d

little eagle
#

createSoundSource and say3D both need mission or addon configs, and they look different for both. For playSound3D a soundpath is enough, although it has to be dynamically created when used in a mission which is also cumbersome.

#

It's a huge mess, but once you get used to it, the scripting itself is simple enough. It's all documented on the wiki for each of the commands.

nocturne basalt
#

ok. Im trying to make an hidden object where I use say3d now, and attacing it to an animation

#

Ill let you know how it works out

errant jasper
little eagle
#

Another difference is, that playSound3D and createSoundSource have global effects. Which means the code has to run on only one machine (e.g. server). But say3D has local effects, which means the script has to run on every machine, or you need to use remote execution.

#

Man, when Dedmen ever finishes the blog, this might warrant a post.

nocturne basalt
#

like this [_v, "mySound"] remoteExec ["say3D", 0, true];

#

right?

little eagle
#

Minus the true. Or do you want the sound to start over each time a client connects?

still forum
#

@little eagle It won't be finished before people posted lots of stuff

#

so post something :u

nocturne basalt
#

ohhh no I dont. I remove that

little eagle
#

The 0 is explicit code I guess, but it's not needed either, as that is the default: execute everywhere.

nocturne basalt
#

thanks

steep gazelle
#

anyone knows how to make RHS Grad shoot at distances longer than ~1200 meters?

nocturne basalt
#

@little eagle It worked by the way. Only issue now is that my attached object has choppy movements when attaching it to a translation animation. This also causes the sound to get choppy

little eagle
#

"attached to a translation animation" Huh?

#

@errant jasper Here's a tip. You can use #particlesource as object class and then you don't have to worry about hiding the object. It's currently the fasted created and lowest cost entity type we know of.

nocturne basalt
#

attached object dragged along a translation animation

errant jasper
#

@little eagle Neat! Thanks for the tip.

edgy dune
#

question

subtle ore
#

Ask instead of asking if you can ask a question

edgy dune
#

is there away to get the vehicle position index for a player, so like if the player is in the driver seat ,how can you get -1, if they are in gunner get 0 and so on

edgy dune
#

thx

#

w8 task force radio?

#

oh i c nvm im stupid

still forum
#

I use that for TFAR to check on what turret place a player is. But I guess that only works if you already know what turrets exist

#

Eh...

#

What did you expect to happen?

alpine walrus
#

like go unconscious

#

with ace 3

#

i have this wait a moment

still forum
alpine walrus
#
if (player getVariable ["ACE_isUnconscious", TRUE]) then {
hint format ["Script active"];
};
};```
but when i enter in the lobby, and join at first spawn, when i die nothing happend, when i do respawn and join again, when i spawn the script start
#

and i'm not in ACE_isUnconscious

still forum
#

Uh...

#

I think you should go back to looking at the scripting basics

#

your code there doesn't really make sense

#

Just read what i linked

alpine walrus
#

well

#

explain me

#

when i go unconscious *

#

for first nothing happend

#

and when i respawn the script start

still forum
#

I don't know.

alpine walrus
#

well

#

thx ^^

unborn ether
#
 * Example:
 * [bob, true] call ace_medical_fnc_setUnconscious;
#

Its just not a simple setVariable i suppose.

alpine walrus
#

i need to take the variable

#

not to set...

#

^^

still forum
#

But why did you post player setVariable "ACE_isUnconscious" then?

#

setVariable is obviously not getting it

alpine walrus
#

yeah i write wrong i know it, and after i write just a second

#

bc i see i write the wrong code

#

^^

still forum
#

player getVariable ["ACE_isUnconscious", TRUE]
Are you sure you want true as default value?

alpine walrus
#

when he go unconscious

#

there is true or false

still forum
#

I know that?

#

Well I'll just assume you know exactly what you are doing... Good night o7

lusty canyon
#

is it possible to get a list of all the defined vars in a specific namespace?

fringe torrent
#

how can i make the tracks on verhicles are invisible
tried

AA_7 animate ["Track_R",0];```
an when doing animationSourcePhase gives me that value back in game
but they still show

any one know what animation state the tracks need to be in ?
warm bronze
#

how does one propagate setOvercast across a server via script?

winter rose
#

weather is supposed to be synchronised across the network, for all players

warm bronze
#

So if I execute 0setOvercast 1; on a trigger that executes on server. It will propagate/sync globally.

winter rose
#

yes, but the change won't be immediate though; you will have to "apply" it with forceWeatherChange

#

less than a second later, players will be sync'

meager heart
#

also if that for mission params BIS_fnc_paramWeather works

meager heart
lusty canyon
#

my simple addAction doesnt appear in the players scrollwheel menu

_satComHQ = createVehicle ["Land_DataTerminal_01_F", player, [], 0, "none"];

_satComHQ addaction ["<t color='#7396ff'>IMS SUPPORT:</t> SPAWN IN JET", 
{
    _caller = (_this select 1);
    _airportPos = missionNamespace getVariable "DW_IMS_MAP_POS_AIRPORT";
    _jet = createVehicle ["rhsusf_f22", _airportPos, [], 10, "NONE"];
    _caller action ["getInPilot", _jet];
}, 
"args", 400, true, true, "", "(alive _target)", 15, false
];
meager heart
#

πŸ™„

lusty canyon
#

its working locally now, but not global, how do i global it without remoteExec or cfg init?

strange urchin
#

Impossible

lusty canyon
#

someone said remoteExec is evil so i cant use it anymore 😭

#

this means nobody is using addaction, only cfg useractions?

#

is there a limit to how much you can cram into missionNS? after testing on a server running for +3 hrs none of my setters or getters are working????

strange urchin
#

Whoever told you that has never made a good MP mission

zenith totem
#

^

#

Are you sure they didn't tell you that remoteExec without a CfgRemoteExec whitelist is evil

#

remoteExec enabled without whitelisting would allow anyone who can gain arbitrary SQF execution on their local client the ability to execute arbitrary SQF on any client

#

Or maybe they don't know how BE filters work and got kicked anytime they tried something lol

strange urchin
#

Lol

cedar kindle
#

@lusty canyon allVariables

meager heart
#

too late πŸ˜”

lusty canyon
#

how can you create entire preset groups of infantry? like the viper team? or a recon squad?
i always just create group through manual array of whatever infantry i can find

meager heart
#

CfgGroups ?

lusty canyon
#

how can i get that through sqf?

meager heart
#

like the viper team
how can i get that through sqf?
check "Escape From Tanoa" mission

lusty canyon
#

nvm then ill just stick with my arrays, how about that ghost hotel structure , BIS made it like the freedom all cut up, did they make a handy spawner fnc for it too?

meager heart
#

afaik you will have to build that puzzle

#

spawn every segment...

lusty canyon
#

thats crazy, the alignment alone >.<

meager heart
#

@lusty canyon

lusty canyon
#

yeah says not working in a3, plus BIS didnt tag the ghost hotel as a composition

#

still good tho, i can use some of those existing stuff, thanks @meager heart

meager heart
#

gl

lusty canyon
#

@meager heart can we get the list of composition classnames through cfg >> _arr ?

meager heart
#

check first link, if compositions included in mission, you can do something like missionConfigFile >> "CfgCompositions"

lusty canyon
#
_cfgDisplayName = [];
_cfgClassName = [];
_cfg = configFile >> "CfgCompositions";

for "_i" from 0 to count _cfg - 1 do 
{
    _class = _cfg select _i;
    if (isClass _class) then 
    {
            private _name = getText (_class >> "name");
            _cfgDisplayName pushBack format ["%1", if (_name == "") then {"N/A"} else {_name}];
            _cfgClassName pushBack format ["%1", configName _class];        
    };
};

maybe something like this??

winter rose
#

I think the mission maker shouldn't be the one to define CfgRemoteExec actually...
the game should, analyse the code and at least allow only the code found in scripts (and functions used by the game itself of course) if we want more precision then we can add or set specific commands or destinations

#

the only issue with this automatic thing would be string-based remote exec, like remoteExecCall [_command,] or remoteExecCall [format ["setPos%1", selectRandom ["ATL", "ASL"]] but then you could manually add

#

I do think that Server Network Security shouldn't be made by the mission indeed.

lusty canyon
#

yeah server admins should be able to override whatever settings the mission maker has put in.
afterall where would these poorly made missions go without someone paying for a ds?

lusty canyon
#

i have a cute civvy prop plane


_jet = createVehicle ["I_C_Plane_Civil_01_F", player, [], 1, "NONE"];

_mag = ["2000Rnd_20mm_shells","300Rnd_CMFlare_Chaff_Magazine"]; 
{ _jet addMagazineTurret [_x,[-1]]; } foreach _mag;

_wep = ["Twin_Cannon_20mm","CMFlareLauncher"]; 
{ _jet addWeaponTurret [_x,[-1]]; } foreach _wep;

i cant seem to add any weapon mag to it, is this more that that Its ILLEGAL for civs to have military hardware Laws Of War IDAPussies BS????

#

thank you useless DLC

#
  1. as an alternative is there a prop plane in CUP/RHS that i can add weaps to?
#

found the antonov but its so damn slow!

naive estuary
#

I think the issue is that the civ prop plane doesn't have a turret. addWeaponTurret adds a weapon to a vehicle turret.

#

There are some exceptions, I am pretty sure that the gbu launcher can be added to turretless vehicles (and players.)

lusty canyon
#

oh so if i just did addweapon instead then it might work?

#

bah didnt work either

little eagle
#

I just used the code you posted and I can use flares with the jet.

#

Plane. It's not a jet.

lusty canyon
#

no weaps tho

little eagle
#

lmb I can fire the gun.

#

I can use the weapon too.

lusty canyon
#

holy shit, ur right i gave up completely when the UI didnt change

#

hidden weapons!

little eagle
#

What do you mean ui?

lusty canyon
#

it doesnt add the weapon ui at the bottom right

#

but it can shoot hah! thanks for testing it more bigC

#

now i just have to give obscene amounts of ammo

little eagle
#

Well, the plane unit info type display doesn't show any weapons as the vehicle has none.

#

getText (configFile >> "CfgVehicles" >> typeOf cameraOn >> "unitInfoType")

#

"RscUnitInfoAirPlaneNoWeapon"

lusty canyon
#

i cant do anything about that in sqf right?

little eagle
#

Well, you cannot change this config entry, but you could manually add the controls with ctrlCreate and update them yourself every frame.

#

I don't think anyone ever did this, but it should be possible.

lusty canyon
#

doesnt seem worth the performance hit just to see how much ammo is left so i add 80,000 ammo πŸ˜‰

#

the copilot can shoot too sweet!

little eagle
#

Are you scared of "every frame"? There would be no noticable performance impact if done right.

#

I mean, the ui already is updated every frame anyway.

lusty canyon
#

yeah i have addactions that had complex conditionals that lagged me down so yeah scared af

little eagle
#

Well, "if done right".

lusty canyon
#

well i do shit code with a balls to the walls dont give a fuck attitude (unless i make arma hard crash)

#

πŸ‘Œ

meager heart
#

do you have -showScriptErrors in startup params, jayTAC ? πŸ˜€

lusty canyon
#

nope, so you wouldnt want to use my mods, its practically malware at this point !

#

i just look at rpt

meager heart
#

πŸ˜„

lusty canyon
#

will that param give me more stuff or its the same as rpt?

meager heart
#

no

#

it will show script errors on screen

#

but sometimes something fails silently...

lusty canyon
#

yeah its the silent types i hate, is there a way to make your own parallel rpt that only contains your mods errors?

little eagle
#
findDisplay 46 ctrlCreate ["RscText", 10127];

private _fnc_update = {
    params ["_display"];

    private _string = "";
    if (typeOf cameraOn == "I_C_Plane_Civil_01_F") then {
        _string = str (cameraOn ammo "Twin_Cannon_20mm");
    };

    (_display displayCtrl 10127) ctrlSetText _string;
};

findDisplay 46 displayAddEventHandler ["MouseMoving", _fnc_update];
findDisplay 46 displayAddEventHandler ["MouseHolding", _fnc_update];
#

There. Ammo counter only for this jet.

meager heart
#

commy, disableSerialization on top of that ^ ?

little eagle
#

Only if you execute this from a scheduled script.

meager heart
#

that will be probably in init.sqf...lol

little eagle
#

You could also wrap it into isNil.

#

There. Edited so it doesn't need disabled serialization...

meager heart
#

jayTAC is in safe now πŸ˜„

lusty canyon
#

wow, going the extra mile! thanks commy! seriously go backstab BIS and make Arma 4 already before they do, call it "ANMA 4" and it will be a modders paradise!

modern sand
#

Does anyone know why lbSetCurSel doesn't seem to work when it's inside of a function (that I know for a fact is being called) but works fine in the debug console? Seeming this is what I'm using (both in the script & debug console) SQF lbSetCurSel [6, 0]; Yes, that is the correct IDC btw

little eagle
#

Have you tried the binary version? This one depends on detecting the active display and I never trusted that.

modern sand
#

What's the binary version if you don't mind me asking?

little eagle
modern sand
#

Example 2?

little eagle
#

Alternative syntax. "Binary" because it has arguments on the left and right side.

#

Yeah, also example 2.

modern sand
#

I've tried example 2, but doesn't seeming to work. I'm guessing because my dialogs idc is too long. Or I might be getting the class wrong

little eagle
#

Oh, is it greater than 1e7 ?

#

Ten million.

modern sand
#

let me check, that is probably the exact reason

#

yes omg how didn't I think of that

#

-_-

#

let me change that and I'll play around with it lol

little eagle
#

SQF uses single-precision floating-point format and integers too big might suffer from rounding errors.

modern sand
#

yes

tranquil needle
#

does anyone here could help me how to script?

modern sand
#

"how to script" is a very broad term.

tranquil needle
#

true true

modern sand
#

Just in general?

tranquil needle
#

one sec

#

my friend was asking for help

#

and here seemed like good place to ask

modern sand
#

Do you have any experience with writing code in any other scripting languages before?

#

@little eagle yer that is the exact reason why I can't seem to use "Example 2" (_control). Hopefully this fixes the issue I'm having with lbSetCurSel

tranquil needle
#

@modern sand

#

do you mind if i pm you?

indigo snow
#

just put questions in here

modern sand
#

if you want, idm just don't expect an answer ASAP

tranquil needle
#

np

still forum
#

@lusty canyon is it possible to get a list of all the defined vars in a specific namespace? Look at allVariables

lusty canyon
#

got it thanks, but nobody told me its so large my client crashed when i tried to output it

still forum
#

πŸ˜„ Β―_(ツ)_/Β―

unborn ether
#

which one? The biggest is missionNamespace it has around 2756 variables in vanilla, and it doesnt crash for me πŸ˜„

still forum
#

None of mine crash for me. And I'm running more than a few mods

lusty canyon
#

im running 90 mods and missionNS killed me

#

why doesnt basic string concat work!?!?!?! why does the most basic shit have to be so difficult !!!

unborn ether
#

string concat, but how's that around your missionNamespace?

lusty canyon
#

unrelated

unborn ether
#

Ehm.

#

String concat works just fine?

lusty canyon
#

how do you concat player names from foreach allplayers

#

i want to display to it hint

little eagle
#
hint (allPlayers apply {name _x} joinString "/n");
unborn ether
#

^

little eagle
#

Is it /n or \n , I can never remember?

lusty canyon
#

so joinstring replaces +

unborn ether
#

\n

little eagle
#

joinString doesn't replace +, as it does something completely different?

lusty canyon
#

i cant just do _varString + "sdlkfjklsdfj"

little eagle
#

Sure you can.

lusty canyon
#

whats the apply keyword?

still forum
#

@little eagle Just think of the fΓΌhrer.
The arm goes up to the right like \o So it's the same for \n or \t and such. The arm always goes out to the right

little eagle
#

It's a command and not a keyword. It takes and array on the left side and a piece of code on right side, and creates a new array with the same size containing all the return values of the code block where _x is a magic variable for the element with that index of the array of the left side.

#

o/ would be the right arm, Dedmen.

#

Muscle memory.

still forum
#

If you'd look from behind yeah

#

But you gotta look people in the face m8

little eagle
#

Just say backslash.

unborn ether
#

the best explanation of how you remember when to backslash

#

πŸ˜„

still forum
#

If you laugh about it. You won't forget it

unborn ether
#

πŸ’― no jokes

little eagle
#

Too bad I have weird humor.

lusty canyon
#

do you still need to add broadcast TRUE with setvars on missionNS? or doesnt matter?

#

is there only one missionNS or all clients have to update their copy of it?

#

sometimes my getvars mNS just dont work maybe cuz i didnt add broadcast true?

meager heart
#

need to add broadcast TRUE with setvars on missionNS?
if you need to broadcast it then jawohl else nein

lusty canyon
#

in other words why would i need to broadcast something thats already global in scope? (mNS)
or am i not understanding the broadcast thing at all?

meager heart
still forum
#

missionNamespace is global.

#

But not broadcasted

#

Yes. You are not understanding it

winter rose
#

global, but not network-speaking – we are talking about a namespace, which applies on a -machine-

lusty canyon
#

so all clients do not share from a single mNS but have their own local copy that doesnt auto update without broadcasting? ive been assuming there is only one mNS and thats on the server.

still forum
#

correct. Everyone has their own

#

I don't know of anything that everyone shares and only exists on the server.

#

serverTime maybe

lusty canyon
#

so all the namespaces are copied everywhere? including HC? and the only time all of them get updated is when u broadcast true? doesnt that defeat the point of making them global? is there no auto-sync?

meager heart
#

addPublicVariableEventHandler < semi-auto-sync*

still forum
#

no namespaces are copied anywhere

#

No there is no autosync.

#

No That is not autosync

meager heart
#

semi-auto-sync*

little eagle
#

Every client has a different mission namespace. Global and local variables have nothing to do with local and global commands.

#

setVariable has local effects, unless you use the true/public flag, then it has global effects.

still forum
#

No auto sync at all @meager heart

lusty canyon
#

jesus efcpdt! i have to use an EH just to declare a pretend global var?? id given up on this arma code a long time ago but im a masochist and i want more pain!! my mistress is called "Locality" and i am her bitch

little eagle
#

It's not automatic if you have to do it manually.

#

i have to use an EH just to declare a pretend global var??
No.

still forum
#

No you don't.

#

That EH is completly irrelevant

lusty canyon
#

i should of never learned about remoteExec, should of just stayed in the wonderfully peaceful world of single locality pc, running stuff in virtual arsenal non the wiser

still forum
#

I agree

meager heart
#

PublicVariableEventHandler will detect if variable was broadcasted and will execute code... looks like kinda automatisation, but yes you have to add manually Β―_(ツ)_/Β―

little eagle
#

That... is not what anyone here was talking about. Not even close.

still forum
#

What?

#

That doesn't change anything on the variable being broadcasted

#

It happens no matter if you have the PVEH or not

peak plover
#

Can 2 users trigger same pveh and cause errors

#

Like exactly same time

little eagle
#

You mean if two machines set the same variable and on a third machine they arrive on the same frame?

peak plover
#

Yeh

little eagle
#

One of them will arive first, trigger the event, then the second arives, overwrites the variable with the new value and triggers the event again.

#

The only problem with sending around globals at the same time is, that they will take different values on all the machines. Depending on when they arrive.

peak plover
#

Publicvarsrv

#

Better to re a function. Why make it into a pveh

meager heart
#

imo the worst thing about pveh - possibility to broadcast from any pc to all...

peak plover
#

U can also do that with re

meager heart
#

no i mean if in mission was used pveh

#

hackers was using it with bis_fnc_mp

lusty canyon
#

how do you global exec addAction to an object?


_satph = createVehicle ["Land_SatellitePhone_F", player, [], 0, "CAN_COLLIDE"];

private _addActionsSatPH = {        
    params = [_satph];            
        _satph addaction ["TEST GLOBAL ACTION", 
        {         
            _satPhoneObj = (_this select 0);
            hint str(typeof _satPhoneObj);
        }, 
        "args", 400, true, true, "", "(alive _target)", 15, false, ""
        ];
};
[_satph] _addActionsSatPH remoteExec ["BIS_fnc_call", 0];

doesnt work

#

and why is there no addActionGlobal (do i have to createvehicleLocal globalExec instead?)

little eagle
#

Instead of:

_satph addAction [
    "TEST GLOBAL ACTION", {
        _satPhoneObj = (_this select 0);
        hint str(typeof _satPhoneObj);
    }, "args", 400, true, true, "", "(alive _target)", 15, false, ""
];

You write:

[_satph, [
    "TEST GLOBAL ACTION", {
        _satPhoneObj = (_this select 0);
        hint str(typeof _satPhoneObj);
    }, "args", 400, true, true, "", "(alive _target)", 15, false, ""
]] remoteExec ["addAction"];
lusty canyon
#

why cant i just pass an entire block and do whatever inside? say its an array of obj needing the addaction and other stuff like add dmg EH? you would have to do multiple remoteExec? isnt that worse than just one big remoteExec?

little eagle
#

Of course you can also use BIS_fnc_call, but then you have to fix this line:

[_satph] _addActionsSatPH remoteExec ["BIS_fnc_call", 0];
#

If there is an array next to a variable, then your code has broken syntax. There always has to be one command inbetween at least.

lusty canyon
#

so [_satph] call _addActionsSatPH remoteExec ["BIS_fnc_call", 0]; ?

little eagle
#
[_satph, _addActionsSatPH] remoteExec ["BIS_fnc_call"];
#

Or wait.

#

Nah, I think that's right.

#

[params, code] call BIS_fnc_call;

strange urchin
#

You sure that works?

little eagle
#

Yes.

#

Well, of course you have to fix the other syntax error:

params = [_satph];

->

params ["_satph"];
strange urchin
#

Wouldn’t _addActionsSatPH have to exist on the other machine?

little eagle
#

No, the whole array is sent including the local function.

#

Forgot the quote marks in my syntax fix.

obsidian chasm
#

How can I make the friendly AI not go instantly crazy when friendly fire happens?, it seems like its going to be an issue

lusty canyon
#

gosh didnt realize i had so many syntax booboos in that one, it works now with the changes. ty

little eagle
#

Define "instantly crazy".

obsidian chasm
#

instantly turn you into an enemy to them

lusty canyon
#

i did a handleScore + handleRating EH to fix that

strange urchin
#

Yeah

#

Happens when you go renegade

lusty canyon
#
player addEventHandler ["HandleRating", { (_this select 1) max 0; }];
 player addEventHandler ["HandleScore", { (_this select 1) max 0; }];
little eagle
#

Or just give the players a million score.

#
player addRating 1E7;

in init.sqf. Done.

meager heart
#

HandleScore < server only (if that for mp mission)

winter rose
#

player addScore (-(score player) +10e10) hehe

obsidian chasm
#

i got an error

little eagle
#

Fix it.

obsidian chasm
winter rose
#

script error.

obsidian chasm
#

Hm, why?

#

Did I put that in the wrong place or something?

#

where would you put that bit?

strange urchin
#

Change handlescore to _this select 2

meager heart
#

thats bcuz jayTAC dont have -showScriptErrors startup param πŸ˜€

lusty canyon
#

@meager heart haha so true

obsidian chasm
#

huh I think I am putting this line in the wrong place, where do I put it?

strange urchin
#

Just try what I said

#

Change the code in handle score

meager heart
#

or put there false

strange urchin
#

Because _this select 1 returns the player there

obsidian chasm
#

nope, still errors

strange urchin
#

What’s it say this time?

obsidian chasm
#

i think im putting it in the wrong file

strange urchin
#

Oof

obsidian chasm
strange urchin
#

Replace it all with this:

#
player addEventHandler ["HandleRating", { (_this select 1) max 0; }];
 player addEventHandler ["HandleScore", { (_this select 2) max 0; }];
obsidian chasm
#

its right to be in the init.sqf ...right?

little eagle
#

Why bother with the score if only the rating is what effects this?

strange urchin
#

No clue

#

Wasn’t my idea

obsidian chasm
#

back to the original error

little eagle
#

Just delete the HandleScore line. The HandleRating line is enough.

obsidian chasm
#

hey progress

#

lol

strange urchin
#

Yeah, listen to commy2

obsidian chasm
#

did that, same error

little eagle
#

Always.

obsidian chasm
#

ffs

#

can it not just be as simple as "ai will not fire upon receiving friendly fire" bohemia? come on

strange urchin
#

Are you restarting the mission?

little eagle
#

It essentially is though.

obsidian chasm
#

yes

strange urchin
#

You doing it from editor?

obsidian chasm
#

ok its working

#

thats a big relief as I can't be having Americans turning on me when I accidently kill them in my vietnam jungle mission lmao

#

thanks guys

#

One day I'd love to be able to do this stuff on me own

#

hm, thats odd. I get the error when I load from editor but not from normal play.

#

hows that work?

strange urchin
#

That’s because the showscripterrors param is off

#

In editor, it acts like it’s on

#

But otherwise, it doesn’t just so it doesn’t bother players

obsidian chasm
#

I imagine it will be fine then for the mission

strange urchin
#

wrong

obsidian chasm
#

i dont mind if its on in editor

strange urchin
#

Bad habit

obsidian chasm
#

player addEventHandler ["HandleRating", { (_this select 1) max 0; }];

#

thats what you said to put in, right?

strange urchin
#

Yes.

#

I hope you didn’t save while in editor

obsidian chasm
#

...why

strange urchin
#

Er, mission

#

In mission from editor

little eagle
#

The error might not be shown in outside the edior, but it will still be printed in the log file and break the script.

obsidian chasm
#

😐

meager heart
#

also ```sqf
player addEventHandler ["HandleRating",{0}];

obsidian chasm
#

great, that is there all the time now

#

🀣

#

brilliant

obsidian chasm
#

So that error will always be in my mission now?

#

..wtf

little eagle
#

No.

obsidian chasm
#

I removed it completely but it still shows..i dont know what to do

little eagle
#

Save the file. Load the mission.

obsidian chasm
#

I have..it still shows

strange urchin
#

Are you loading from save?

obsidian chasm
#

nvm im retarded

#

lol

#

So that thing will always put that error up then?

strange urchin
#

Shouldn’t.

obsidian chasm
#

guess i need to find a different way to have my allies not turn on me in case of accidental FF

winter rose
#

An error doesn't "stay" in a mission.

If your code is incorrect when executed, it will trigger an error, you just have to correct it and you won't see it again

little eagle
#

It's really not this difficult.

obsidian chasm
#

ye its sorted

#

it is difficult when youre crash coursing this by yourself

turbid tide
still forum
#

because createVehicle automatically makes sure that doesn't happen

#

read the wiki page of createVehicle

turbid tide
#

ok thanks

ionic orchid
#

has anyone managed to use __EXEC/__EVAL in description.ext and get it to work without MakePbo.exe complaining about it?

still forum
#

makePBO shouldn't even think about touching description.ext

#

that file is not binarized

ionic orchid
#

cool, cheers dude

tough abyss
#

i need the hostage script

#

Anybody know

manic sigil
#

Does screentoworld only intersect terrain? Is there a command that returns any interactive object intersected?

little eagle
#

Yes. lineIntersectSurfaces is the newest and best raycast command.

manic sigil
#

so many parameters TT_TT

little eagle
#

Yeah, it's great.

austere granite
#

You are great

little eagle
#

ikr

#
private _posStart = AGLToASL positionCameraToWorld [0,0,0];
private _posEnd = AGLToASL positionCameraToWorld [0,0,1000];

lineIntersectsSurfaces [
    _posStart, _posEnd,
    cameraOn, objNull,
    true, 1,
    "GEOM"
] param [0, []] params [["_intersectPos", _posEnd], "", ["_intersectObj", objNull]];
#

There. _intersectPos will be ASL position of the first intersection. _intersectObj will be the object or <null>. 1000 meters raycast.

wary vine
#

could someone take a look at something for me, see if it can be tidied up a little bit ? im pretty sure it can be done, but not sure what to do xD

little eagle
#

waitUntil {_itemsReturned};

#

This will either wait forever or pass first try.

#

Definitely bugged/weird script.

wary vine
#

its shouldnt do either.

#

its defaulted as false, and at the end of the return function, it returns true;

#

oh shit./

little eagle
#

The variable is never changed. Variables don't change their values retroactively.

wary vine
#

i get what your saying xD

#

ill have to put a global in for that...

#

sec

manic sigil
#

Fff. Finally got script to register on lineintersectssurfaces, now it's throwing my objects up above ground level to the same amount as the target is above sea level... my head hurt just trying to write that.

little eagle
#

Are you using what I wrote?

manic sigil
#

Yeah, that's from the wiki right? Or very similar.

little eagle
#

Dunno, made it up myself on the fly.

#

_intersectPos is ASL format. What are you doing with that position?

manic sigil
#

It's a really basic (at least, for use) defense placement script - if player has toolkit, addaction "place sandbag." Action checks if the target position is under 5m away, then places the sandbag there, setting direction on the player.

little eagle
#

setPos or what?

manic sigil
#

then {ShortSand = createVehicle ["Land_Bagfence_Short_F", Placepos select 0, [], 0,'CAN_COLLIDE']; ShortSand setdir getdir player; };

#

Sorry, dunno how to make it fancy on discord :/

wary vine
#

three ` before and after

little eagle
#

```sqf
//code here
```

manic sigil
#

'''
then {ShortSand = createVehicle ["Land_Bagfence_Short_F", Placepos select 0, [], 0,'CAN_COLLIDE']; ShortSand setdir getdir player; };

#

Shit

wary vine
#

`

#

just under esc key

manic sigil
#

Ahh.

#

Getting off topic.

#

The testing place is 226m asl, and the sandbags appear... 226m above my head.

little eagle
#

Anyway, createVehicle uses the AGL format. My position is ASL format. Use ASLToAGL to convert these.

manic sigil
#

Ahh.

wary vine
#
then {
  _shortSand = createVehicle ["Land_Bagfence_Short_F", ASLToAGL (placePos select 0), [], 0,'CAN_COLLIDE']; 
  _shortSand setdir (getdir player); 
};
#

why do the objects need to be global ? for a reason ?

austere granite
#

you probably don't want to have a local sandbag

#

that means only one client sees it... πŸ˜„

wary vine
#

no.. I mean the variable...

#

this should still create a sandbag for everyone, unless createVehicleLocal is used.

manic sigil
#

This is just the outline stage, one I've got it working I'll fit it back to multiplayer.

#

Minor success - sandbags now appear at player's head.

wary vine
#

I mean, do you need to reference "ShortSand" again ?

manic sigil
#

Nah, it's more for bugtesting - checking getpos ShortSand if I didn't see it appear.

wary vine
#

so your trying to place a sandbag where the player is looking ?

manic sigil
#

Yeah, got it - the lineintersect needed to ignore the player.

wary vine
#

Nice.

manic sigil
#

And now it stacks πŸ˜„

wary vine
#

might be cleaner if you used a var passed from the addaction for the object.

#

ill get an ex together 2 seconds.

manic sigil
#

Sure πŸ˜ƒ Networking code and locality are my weakness, I have a bad habit of just wrapping everything in a {code}remoteexec["bis_fnc_call",0] shell and praying.

wary vine
#
myTag_fnc_placeFunction = {
  params ["_type"];
  _object = createVehicle [_type, ASLToAGL (placePos select 0), [], 0,'CAN_COLLIDE'];
  _object setdir (getdir player);
};

placableActions = [];

private _objects = [
  "obj1",
  "obj2",
  "obj3"
];

private _displayName = {function to retrieve displayname};

{
  placableActions pushback (player addaction [format ["Place %1",_itemDisplayname],myTag_fnc_placeFunction,_x])
}forEach _objects;
#

{function to retrieve displayname}; there are a few around the place.

manic sigil
#

Nice, and I'm glad you wrote that up for posterity's sake, future generations searching the logs and all... but I should have said from the outset, my project is for remote execution on the public servers >_> I'm kinda enamored with the admin console and it's possibilities on the zeus servers.

wary vine
#

right.

#

I think im getting confused...

#

if I use
_return = [] call something

#

does it wait for the call to finish before It continues ?

warm gorge
#

Yes @wary vine, otherwise you wouldn't be able to use it's return value after it.

wary vine
#

Thanks πŸ˜ƒ

#

sorts one of my issues.

#

Now shorted the bit i sent earlier.

manic sigil
#

Entrenching script is functional for MP, if a bit janky for using addAction and all... but my attempts to add it to the Zeus interface are problematic. Problem is resolved by creating a trigger that, ideally, runs whenever someone places an object - but I can't suss out how to have a player addAction command change a variable such that a trigger will notice. I imagine it's something to do with PublicVariable, but I've run out of time and brainpower to test.

meager heart
little eagle
#

Stop with the trigger talk already 🀒

warm gorge
#

How would I go about getting a smooth CPR animation? I'm currently trying to use the MedicStart animation with playActionNow in a loop, but cant seem to get it working properly as it just makes the player stand all the way back up again. Hopefully im using the right animation for this. I heard this animation was meant to loop, not sure if this has anything to do with me testing in singleplayer.

meager heart
#

that one is kinda special, also its "interruptible"

0 spawn {
    hint "Animation started";
    player playaction "medicStart";
    sleep 60; //--- set any delay you want
    hint "Exit animation";
    player playaction "medicStop";
};
```try it in debug console ^
also when animation will start, press any move keys
#

@warm gorge

#

interruptible... interruptable πŸ€”

#

can be interrupted*

little eagle
#

It's "interruptible".

meager heart
#

thanks πŸ˜„

warm gorge
#

@meager heart Cheers for that, ill give it a go shortly. Was wondering why it kept cancelling. I think ill just disable input while the animation is being played

meager heart
#

btw there is really nice "throw" animations, seems like unused

warm gorge
#

Grenade throw animations?

obsidian chasm
#

Have any of you guys made it so AI can fire flares? I can use the modules to make it look like they fire flares but the brightness etc is really bad on the basic arma 3 ones

little eagle
#
driver _plane forceWeaponFire ["CMFlareLauncher", "Burst"];
obsidian chasm
#

I imagine that's only if they have said item equipped?

#

I'm doing a vietnam mission so don't think that applies

little eagle
#

The plane has to have flares for the pilot to fire them, yes.

obsidian chasm
#

No I mean Ai infantry based on spawn triggers

#

Vietcong spawn, red flare goes up

#

the module flares for arma are useless lol

little eagle
#

Pretty simple.

obsidian chasm
#

Ah I'm not using ACE myself

little eagle
#

Wouldn't stop you from copying the script. It's very basic.

obsidian chasm
#

so how exactly does the script work, sorry

little eagle
#

Creates a lightsource, then sets some parameters like color, birghtness and intensisity, then attaches the light source to a projectile, then starts a timer to delete the light source.

meager heart
#

πŸ˜„

obsidian chasm
#

interesting

meager heart
#

maybe you can just spawn flare and set velocity for it πŸ˜€

little eagle
#

He said they're too dim.

obsidian chasm
#

ye they dont light up the ground like in this;

#

basically I want Vietcong to spawn via blufor trigger, Flare module goes off upon VC spawn for immersion

peak plover
#

For gameplay, not rly immersion

#

Lightwource

#

Wud do it

#

I wonder if they have fps impact

still forum
#

Ofcause they do

#

each light source costs 0.00375 fps

#

Most things have some fps impact.

#

And if you can see them then 100% they do

peak plover
#

Yeh, but how bad

still forum
#

I think light sources also count towards the dynamic light limit?
So you can only have a dozen or two.

#

I'd say more than negligible

#

Less than a SQF comment in a PFH

peak plover
#

Dynamic light, doesn't even cast dynamic shadows

#

What does dynamic light mean

#

That it can draw light to surfaces and objects?

obsidian chasm
#

@little eagle So how would I go about implementing this into my mission then? please

#

also you know what would be nice, if you could draw the shapes for triggers GWfroggyPepoThink

peak plover
#

πŸ˜‚

winter rose
#

[14:57] nigel: Dynamic light, doesn't even cast dynamic shadows

nope, but Enfusion does it πŸ˜„ I was happy to notice it yesterday

peak plover
#

Yeh, saw that on flare. I was blown away

warm gorge
#

@meager heart I just tried the code you showed me earlier for the CPR animation, but for some reason it ends the animation after the first pump, even with my hands completely off the keyboard

meager heart
#

πŸ€”

#

did you tried that code in console or you added animation in your scripts ?

warm gorge
#

Tested through the console, added a sleep at the start to make sure the pause menu wasnt interrupting it

meager heart
#

just checked in game... also added sleep and it's still playing lol

winter rose
#

spawn { sleep 3 ; player playMove "_animName_"; }; @warm gorge Β ?

meager heart
#

still playing πŸ˜„

warm gorge
#

Alright I figured out what it was, I was using a civilian sided character which must have bugged out the animation. Just tried with a BLUFOR character and it worked, however it seems like this animation is different to the one I was looking for. Ive seen it on several servers, its just a constant CPR animation while someone is being revived,

winter rose
#

yeah, don't use people for your tests or disable their AI πŸ˜ƒ

warm gorge
#

I was the player though, just not sure why it wouldnt work for civilian sided players. I guess ill just have to try and find the animation I want to use, proving quite difficult though. Appreciate the help though guys πŸ˜ƒ

meager heart
#

anim viewer will help then... (btw still playing lol)

winter rose
#

they can try to move, run away, etc
never trust a civilian πŸ˜„

warm gorge
#

Can actions be viewed in the animation viewer?

winter rose
#

actions like top body "hi gesture", nope

obsidian chasm
#

How hard is it to add a timer or something similar to delete a bunch of units that were spawned in via triggers. Would it be adding a line of some sort to the actual trigger or do I need to make a new script for this?

#

or would I add something into this part of my groups trigger

// If it's night, use NVS scopes instead
if !((dayTime > 4.5) and (dayTime < 20)) then {
{_x setUnitLoadout [[nil,nil,nil,"optic_nvs",nil,nil,nil],nil,nil,nil,nil,nil,nil,nil,nil,nil]} forEach (units _newGrp);
};

sleep (30 + (random 30));

// Stalk players
waitUntil {sleep 5; simulationEnabled (leader _newGrp)};

_stalk = [_newGrp,group (allPlayers select 0)] spawn BIS_fnc_stalk;
{_x disableAI "Autocombat"} forEach (units _newGrp);
_newGrp setBehaviour "Stealth";
_newGrp setCombatMode "Red";

rancid ruin
#

@obsidian chasm easy

#

[] spawn {sleep 600; {deleteVehicle _x} forEach units _newGrp}

#

someshit like that

#

actually not someshit like that cos you'd have to pass the _newGrp to the spawn scope

#

[_newGrp] spawn {sleep 600; {deleteVehicle _x} forEach units _this select 0}

#

someshit like that maybe

#

my sqf rusty

obsidian chasm
#

so I imagine I'd just add that to the file I posted?

rancid ruin
#

yeah try it out

#

i didn't test it

#

might need some brackets around the shit at the end

#

and someone will turn up here in a moment and say forEach is bad

obsidian chasm
#

didnt work, sadly

#

probably doing it wrong though

tough abyss
#

Peach field Apple tree Tempest Automatic How to prevent harvest

silent saffron
#

.

still forum
#

@silent saffron ?

silent saffron
#

nono..

winter rose
#

What the heck did I just read?

little eagle
#

spam

still forum
#

@open vigil Are we getting hit by a bunch of spambots?

open vigil
#

Not that I’m aware of

#

@silent saffron @tough abyss We don’t take kindly to spam here.

tough abyss
#

ok.... sorry'

obsidian chasm
#

Um, anybody used Als Monsoon script? my helicopter AI wont land anytime I have it activated. I genuinely didn't think the Ai could detect weather.. can I make him not?

#

ok, just had to make the script sleep longer, what a crazy interaction though

torn juniper
#

for eventhandlers - adding an event handler to a player over and over - if its the same exact EH it doesn't seem to keep adding it to the player/unit

#

only if its a new/unique EH

#

am I correct with this testing of mine or should I be worried? πŸ˜›

still forum
#

What?

#

Same exact EH aka the same script?

#

Or same name?

#

What is a unique EH?

torn juniper
#

same script - one second I'll show you what I mean

still forum
#

How do you determine if it doesn't work

#

returns same EH ID?

torn juniper
#
Take_EH = player addEventHandler ["Take", { _this call events_onTake_1}];
Take_EH = player addEventHandler ["Take", { _this call events_onTake_2}];
Take_EH = player addEventHandler ["Take", { _this call events_onTake_3}];

That will bump up the EH index when added because they are pointing to different code

but this returns the same EH index when added to the player

Take_EH = player addEventHandler ["Take", { _this call events_onTake}];
Take_EH = player addEventHandler ["Take", { _this call events_onTake}];
#

is that just a fluke that I am somehow getting and I should check myself

#

or is that correct and can arma manage that

still forum
#

I never saw that it does that

#

But I don't think anyone every tried

#

because doing that is kinda dumb anyway

torn juniper
#

right - that was the example but what I am doing is a postinit and it spawns a hook file that will wait until there is a player and then add eventhandlers to them and then right after it will wait until there isn't a player or the player is dead and call the hook file again

#

which in turn readds the eventhandlers on the player and the index never seems to increase

still forum
#

you mean after adding it after the unit respawned