Home   Help Search Login Register  

Author Topic: Is a Respawn based on a global timer possible?  (Read 1619 times)

0 Members and 1 Guest are viewing this topic.

Offline REED

  • Members
  • *
Is a Respawn based on a global timer possible?
« on: 15 Sep 2008, 17:24:16 »
Hello everyone.  I am wondering if it is possible to build a respawn system that works on a global timer.  Something like every 5 minutes all the dead players are respawned at the same time.  I am pretty green when it comes to scripting but at the same time I have no problem learning, Im just not sure what direction to take if this is possible.  Ideally, the player would die and go to the Kegety's Spectating script and show the player the countdown for the global respawn.
With my limited knowledge I would assume I need to add an event handler to fire Kegety's spectating script upon death but I am lost after that.  Any help would be greatly appreciated.  :)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Is a Respawn based on a global timer possible?
« Reply #1 on: 15 Sep 2008, 18:13:02 »
Keg's spec script does not require event handlers. Just read the installation notes and this Biki page on event scripts. As for what you want, it is possible. You can indirectly get all players to respawn at the same time. Your only option is to put respawning players in a holding area and then after a certain time move them up to the battlefield. A more realistic way to do this would be to have an AI vehicle that ferries back and forth between the respawn and the battlefield every x minutes.

edit: modding Keg's script is way beyond someone with no scripting experience. Way too much info. You would spend your time better giving  waiting players something to do e.g. a target range on which to practise weapons.
« Last Edit: 15 Sep 2008, 18:32:18 by Mr.Peanut »
urp!

Offline REED

  • Members
  • *
Re: Is a Respawn based on a global timer possible?
« Reply #2 on: 15 Sep 2008, 19:37:45 »
Thanks for the reply, the event bases scripts is very helpful.... looking through them it appears that the spectator script runs off onPlayerRespawnAsSeagull.sqf

Code: [Select]
; Initialize spectating script when player dies
; Set the following to limit visible sides:
;  KEGsShownSides = [west, east, resistance, civilian];
_this execVM "spect\specta.sqf";

So might it be possible to add a loop in there to check a global timer and f it meets the criteria then it would respawn the player?  I would attempt to test it but I am not sure what the most efficient way to make a global timer would be.  I will keep digging and if I find something I will report back.  Thank you

Offline i0n0s

  • Former Staff
  • ****
Re: Is a Respawn based on a global timer possible?
« Reply #3 on: 15 Sep 2008, 19:46:04 »
You can't influence the time when the player respawns, there is no possibility.
You can only hold him off the battlefield as Mr.Peanut described.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Is a Respawn based on a global timer possible?
« Reply #4 on: 15 Sep 2008, 20:56:33 »
I do not think you will be able to find a way to cleanly "turn off" Keg's spec script. In OFP it was as simple as closing the main dialog. It might be this simple for ArmA to hide and unhide the dialog, but the scripts also add keyboard eventhandlers.  I do not think it was designed to be turned on and off. You are correct that the first step is simple: rename "onPlayerRespawnAsSeagull.sqf" to "onPlayerRespawnOtherUnit.sqf".

For a timer you either write a looping script or use a trigger. I would use a trigger because you will need a way to get all the units in the respawn area. Add a trigger that entirely covers the area where respawnees will be located, side present, repeatedly, timeout. Set the timeout to how many seconds you want players to wait. I will assume that the players are respawning in an area that they will not otherwise visit in game.
Condition
Code: [Select]
this && ({isPlayer _x} count thisList) > 0In the OnActivation field you place what you want to happen to the players e.g.
Code: [Select]
{if (isPlayer _x) then {_x setPos getMarkerPos "markMyBattlefield";};} forEach thisList;
« Last Edit: 15 Sep 2008, 20:59:35 by Mr.Peanut »
urp!