Jump to content

Can i use timer.scheduleFunction and Start command?


Fallen_Tyrael

Recommended Posts

Hi all,

 

I'm trying to get Uncontrolled AI to start their engines after a set time. so when they get shot down they will respawn instantly then sit on the tarmac and startup after X amount of time.

 

Here's what have:

if not Group.getByName('GroupName') then
mist.respawnGroup('GroupName', true)
mist.scheduleFunction(Group.getByName('GroupName'):getController():setCommand({["id"] = "Start", ["params"] = {}, }), timer.getTime() +120)
end

 

I have tried different variations of the code above but I cant seem to get it to work and was hoping someone here could help me or point me in the right direction?

 

Thank you in advance.

Link to comment
Share on other sites

Don't think you can call the function quite like that. It is expecting a function name alone as the first variable and then the second variable has all the inputs.

 

 

Might have to do a lazy hack of creating a function to do that.

 

 

function start(gName)
Group.getByName('gName'):getController():setCommand({["id"] = "Start", ["params"] = {}, })
end

 

 

On death code

mist.scheduleFunction(start, {gName}, timer.getTime()+120)

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Hi Grimes,

 

That worked, thank you so much! As you can probably tell I'm pretty new to this and I had looked for days to try and solve that one myself so much appreciated :)

Ill now go and see if adding multiple groups to that function start will work.

 

I maybe back...

 

Thank you again.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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