kovvalsky 13 Posted November 20, 2014 (edited) if you have a _player variable (i.e. _player = player) and player is killed, _player becomes a nullObject when respawn.. Is there any way to get player's new body without Event Handlers or Event Scripts? thankyou! ---------------------------------------------------- SOLUTION FOUND: ---------------------------------------------------- if you assign a name to the player, you can ask to that name with this: call (compileFinal "playerName") if you want's a player object variable: _playerVar = call (compileFinal "playerName") ---------------------------------------------------- i.e. if you have a player named "Soldier1" in the editor call (compileFinal "Soldier1") is equal to Soldier1 so: getPosATL (call (compileFinal "Soldier1")); it's the same as: getPosATL Soldier1; this prevents objNull on respawn when you have assigned a unit to a variable Edited November 21, 2014 by KoVValsky Share this post Link to post Share on other sites
jshock 513 Posted November 20, 2014 Could you provide more context as to why you can't/won't use an EH, and what script your running that needs the player? Because I can't think of a reason to not just use the EHs. Share this post Link to post Share on other sites
kovvalsky 13 Posted November 20, 2014 i'm playing with FSM, trying to make a homemade Revive script. i know how to do that with EH, but I'm curious and i want to explore other options, if any. :j: maybe with vehicleVarName.. i dont know :j: Share this post Link to post Share on other sites
jshock 513 Posted November 20, 2014 :j: maybe with vehicleVarName.. i dont know :j: Ahhh, but as you said, player goes to nullObject after death, so the var name would also return null :p. But couldn't you just have a check, see if _player is null, if it is, get "player" again, then continue on with what you need too? Other than that I might have some sort of concept using get/set variable, but need some time to sit and think about it :p. Share this post Link to post Share on other sites
kovvalsky 13 Posted November 20, 2014 jeje yeap.. but if you assign a name on editor.. and check that name on debugConsole.. it works Share this post Link to post Share on other sites
jshock 513 Posted November 20, 2014 jeje yeap..but if you assign a name on editor.. and check that name on debugConsole.. it works Well, of course, but I believe it still goes null until the player respawns, at which point I believe the "name" is then reassigned, so I guess if you had a loop running and had a check for if it's null, then a waitUntil it isn't null, then continue with the loop, but who knows, my brain is dead today :confused:. Share this post Link to post Share on other sites
kovvalsky 13 Posted November 20, 2014 (edited) but need some time to sit and think about it :p. jeje dont worry. dont expend time on this.. I'll do it with EH thank you for your time JShock! :p (im still open to suggestions) :p ---------- Post added at 19:30 ---------- Previous post was at 18:37 ---------- i found this, and works!!: Player name: P1 _player = [_this,0,objNull] call BIS_fnc_param; //Get player's name _pName = vehicleVarName _player; //If don't have name assign one if (_pName == "") then { _pName = Format ["P%1%2",floor (random(100)),floor (random(100))]; _player setVehicleVarName _pName; Call Compile Format ["%1 = _player;",_pName]; }; // _player = call (compileFinal "P1") //Assign player object to a variable _player = call (compileFinal _pName); so, if you have a name assigned and use call compileFinal "name" it works Edited November 21, 2014 by KoVValsky Share this post Link to post Share on other sites
naizarak 4 Posted November 20, 2014 onplayerrespawn.sqf has the player's old unit and new units as parameters https://community.bistudio.com/wiki/Event_Scripts Share this post Link to post Share on other sites
jshock 513 Posted November 20, 2014 onplayerrespawn.sqf has the player's old unit and new units as parametershttps://community.bistudio.com/wiki/Event_Scripts Yep, but he had said he wanted to steer away from EHs and Event Scripts. :p Share this post Link to post Share on other sites
Tajin 349 Posted November 20, 2014 Who says you can't use eventhandlers in combination with fsm ? Let the eventhandler assign an objectVariable and you can make use of that in fsm. TBH, I don't see a real benefit in making a revivescript with fsm. Share this post Link to post Share on other sites
kovvalsky 13 Posted November 20, 2014 (edited) Who says you can't use eventhandlers in combination with fsm ? no one. TBH, I don't see a real benefit in making a revivescript with fsm. only for testing.. but i see a lot of benefits. (no EH, no loops (+ -), multiple states, visual interface, easy to do) I'll do more things besides REVIVE Edited November 20, 2014 by KoVValsky Share this post Link to post Share on other sites
Tajin 349 Posted November 21, 2014 Yeh the visual interface and ease of use are probably the biggest advantages and can be really useful for certain things. Other than that, no big difference. I just think that in case of a revivescript, an EH is actually more useful. (especially if you want to avoid loops, because you're FSM will have to loop a lot if you don't use an EH) Share this post Link to post Share on other sites
kovvalsky 13 Posted November 21, 2014 (edited) i dont know how to work FSM internally.. and if is more expensive with the performance. take a look if you want, and see how it works: no loops, only conditions.. but remember, work in progress :P FSM_A3Revive for now, im working between unconscious and main state animations.. Edited November 21, 2014 by KoVValsky Share this post Link to post Share on other sites
das attorney 858 Posted November 21, 2014 I don't think performance would be much of an issue either way (unless you're doing crazy stuff in respawn). The way I see it is the player is dead and in limbo land, so your PC won't have to calculate all the rubbish it normally has to when you're alive. Plus if you have any scripts running when player is alive, terminate them when he's dead and resume on respawn. Share this post Link to post Share on other sites
kovvalsky 13 Posted November 21, 2014 thankyou Das Attorney, i think that too. Now, my question is if this FSM can have problems with the default IA FSM... Share this post Link to post Share on other sites