Jump to content

Recommended Posts

Posted (edited)

Hey guys & gals,

I am working on getting respawning on a timer to work, using Mist script.

I have instant respawn working with the following script:

if not Group.getByName('RUS-T72B-6') then
   mist.respawnGroup('RUS-T72B-6', true)
 end

 

but now I want certain groups to respawn after a certain amount of minutes so they dont respawn in your face right away.

I used:

if not Group.getByName('RUS-T72B-6') then
   mist.respawnGroup('RUS-T72B-6', 120)
 end

 

but they keep respawning instantly, the timer doesn't work and I cant find anything that will work with this simple script. I do have to say, this is my first time using anything like Mist, the coding is new to me, I get the basics but I cant do anything fancy with it yet.

Could I get some help with just a simple respawn timer script?

Best Regards & Thanks in advance.

Edited by DCS.Tyrant
Posted (edited)

Just use the schedule function:

https://wiki.hoggitworld.com/view/MIST_scheduleFunction

 

local respawnGroup = "RUS-T72B-6"
if not Group.getByName(respawnGroup) then
	mist.scheduleFunction(mist.respawnGroup, {respawnGroup}, timer.getTime() + 120)
  end

EDIT: See you posted it 2 places and you got the solution. 🙂

Edited by Kanelbolle
Posted
21 minutes ago, Kanelbolle said:
local respawnGroup = "RUS-T72B-6"
if not Group.getByName(respawnGroup) then
	mist.scheduleFunction(mist.respawnGroup, {respawnGroup}, timer.getTime() + 120)
  end

Silly question...

Wouldn't above code segment schedule a respawn each and every time that the segment is invoked? So (depending on how you set up the segment to be invoked) you may be looking at a lot of respawns for after that group vanishes...

Posted
2 hours ago, cfrag said:

Silly question...

Wouldn't above code segment schedule a respawn each and every time that the segment is invoked? So (depending on how you set up the segment to be invoked) you may be looking at a lot of respawns for after that group vanishes...

I do not know the condition the script is launched so i do not presume what condition the code is executed.
Only gave an example of how to schedule a function. What condition this code is launched under is up to OP.

But yes, it will if just launched in a loop or in a way that do not take this in to account.

 

Posted
4 hours ago, Kanelbolle said:

Just use the schedule function:

https://wiki.hoggitworld.com/view/MIST_scheduleFunction

 

local respawnGroup = "RUS-T72B-6"
if not Group.getByName(respawnGroup) then
	mist.scheduleFunction(mist.respawnGroup, {respawnGroup}, timer.getTime() + 120)
  end

EDIT: See you posted it 2 places and you got the solution. 🙂

 

I indeed received several solutions, thank you so much!

I will try them all and hopefully I can learn to do things like this a bit better, thanks to your help.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...