View unanswered posts | View active topics It is currently Thu Apr 25, 2024 12:23 pm



Reply to topic  [ 4 posts ] 
 Timed spawner trouble 
Author Message
User avatar

Joined: Sat Jan 17, 2009 8:53 am
Posts: 79
Location: Philippines
Reply with quote
Post 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?


Tue May 19, 2009 7:25 pm
Profile YIM WWW
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post 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.


Tue May 19, 2009 7:40 pm
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post 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.


Wed May 20, 2009 1:17 am
Profile
User avatar

Joined: Sat Jan 17, 2009 8:53 am
Posts: 79
Location: Philippines
Reply with quote
Post Re: Timed spawner trouble
Oh. Okay. Thanks. :D


Wed May 20, 2009 4:24 am
Profile YIM WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.100s | 15 Queries | GZIP : Off ]