Jump to content
Sign in to follow this  
creartan

script checking variable passed by eventhandler, correct me, how to?

Recommended Posts

MPeventhandler

_this addMPEventHandler ["MPRespawn","(_this select 0) execVM 'respawnscript.sqf'"];

respawnscript.sqf <<- problem is here; it seems it cannot do the variable check? "if (_this == variablezz)"

or what is the right way to do?

if (_this == variablezz) then
{
_this execVM "gearscript.sqf";
};

error..

gearscript.sqf

removeallweapons _this;
etc..

---------- Post added at 05:46 ---------- Previous post was at 05:35 ----------

oh my..

is our variable transfered to the new unit, or not?

Share this post


Link to post
Share on other sites

variablezz is the variable name tobe checked to the unit,

i want to check _this is, _this variable name is variablezz.

if (_this == variablezz) then..

if (_this == variableaa) then..

Share this post


Link to post
Share on other sites

I would think that it should work, but you may still need to wait until the var name isn't null before using it (but that shouldn't be the case). Another thing to try is the isEqualTo command in place of the "==", not sure if that would solve it, but it's more effecient anyhow :p. You could also try a standard Respawn EH as well (I've personally never used the MP respawn EH).

Share this post


Link to post
Share on other sites

ohya the basic knowledge,

is the variablename of the OLD unit get transfered to the NEW unit?

MPrespawn and respawn will it effect in multiplayer?

because im creating this for multiplayer

Share this post


Link to post
Share on other sites

I do believe it does, but that variable name is null until that unit is respawned(after death of course), so I think it's just dependent on when the EH fires, before or after the new unit's variable name is intialized.

Share this post


Link to post
Share on other sites

i just make a trial error, and i think the variable is left to the old unit,

but im not sure maybe until the old unit get deleted by deletevehicle this;

and how to prevent the creation of the new unit?

and the this setVariable ["BIS_enableRandomization", false];?? where to put it?

Share this post


Link to post
Share on other sites
and how to prevent the creation of the new unit?

Turn off respawn?? Or what do you mean by that?

Share this post


Link to post
Share on other sites

repsawn is on.

or maybe the problem is because of

changing the var ingame

Player setVehicleVarName "ranger";

ranger = Player;

ingame, and didnt get registered to the old respawnEH??

---------- Post added at 06:34 ---------- Previous post was at 06:27 ----------

because when i use Editor varname it respawned with the same variable,

but when i use ingame by script

Player setVehicleVarName "ranger";

ranger = Player;

it will respawn with different variable;

and cannot intterract with action assigned to him

but when i try to change back to that variable "ranger", the variable "ranger" is unavailable

i dont know.. confused, is im doin wrong when changing variable?

Edited by creartan

Share this post


Link to post
Share on other sites

Well if you can use player to set as ranger, you can just use player in whatever script your running, it's the same difference, no need to assign the player a variable name, as the variable player is already native for our use...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×