Data Realms Fan Forums
http://45.55.195.193/

Timed spawner trouble
http://45.55.195.193/viewtopic.php?f=73&t=14787
Page 1 of 1

Author:  ramonimbao [ Tue May 19, 2009 7:25 pm ]
Post subject:  Timed spawner trouble

So I'm trying to make something that can spawn neutral Mega Crabs so that, while I'm playing against the enemy team, there are Mega Crabs everywhere killing us. And [part] of my code for it is something like:
Code:
function Update(self)
   if timer:IsSimPastMS(30000) then
      megacrab = CreateACrab("Mega Crab")
      megacrab.Team = -1
      timer:Reset()
   end

or something like that... (Not at my game PC right now so I don't really remember and it's kinda 2 AM so yeah...)

So I spawn my object, and it should spawn the Mega Crab after 30 seconds and once I spawn it, it lags for 30 seconds...

Then 30 seconds later, the lag's gone. Mega Crabs are nowhere to be seen.

HALP?

Author:  piipu [ Tue May 19, 2009 7:40 pm ]
Post subject:  Re: Timed spawner trouble

Code:
function Update(self)
   if timer:IsSimPastMS(30000) then
      megacrab = CreateACrab("Mega Crab")
      megacrab.Team = -1
      megacrab.Pos = Vector(SceneMan.Scene.Width * PosRand(), 0)
      MovableMan:AddActor(megacrab)
      timer:Reset()
   end
end

This makes them fall out of the sky.

Author:  Daman [ Wed May 20, 2009 1:17 am ]
Post subject:  Re: Timed spawner trouble

@OP

Not setting a position, or adding an actor. The 30 second lag is 30 seconds because they get garbagecollected for sitting in memory not in use.

Author:  ramonimbao [ Wed May 20, 2009 4:24 am ]
Post subject:  Re: Timed spawner trouble

Oh. Okay. Thanks. :D

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/