View unanswered posts | View active topics It is currently Fri Apr 26, 2024 3:16 am



Reply to topic  [ 10 posts ] 
 Zombie Spawner 
Author Message

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Zombie Spawner
local AHuman = CreateActor("Undead.rte/Zombie Medium");
This line should be the problem, should look more like local AHuman = CreateActor("Zombie Medium" , "Undead.rte");
Everything else looks fine to me, but you may want to wait for judgment from a proper lua pro.


Mon Nov 22, 2010 12:09 am
Profile
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post Re: Zombie Spawner
I can't see anything especially wrong, what exactly is the error? What line?


Mon Nov 22, 2010 12:24 am
Profile WWW

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Zombie Spawner
It should be a comma not a slash on line 19.
You have: local AHuman = CreateActor("Undead.rte"/"Zombie Medium");
You want: local AHuman = CreateActor("Zombie Medium" , "Undead.rte");
That is assuming the line counts are correct.

The spaces shouldn't do anything. Basically with the / you're trying to do math on something that can't be mathed. Again though, I might be wrong, but I don't think I am.


Mon Nov 22, 2010 5:52 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Zombie Spawner
Either you're using a modded Undead.rte, or I have no idea.

Test it out with zombie thin and large, to see if the same thing happens.


Mon Nov 22, 2010 5:47 pm
Profile
User avatar

Joined: Sat Oct 17, 2009 2:07 pm
Posts: 127
Reply with quote
Post Re: Zombie Spawner
You have: local AHuman = CreateActor("Zombie Medium" , "Undead.rte");
You want: local Zombieorgiveyourvaranothername = CreateAHuman("Zombie Medium" , "Undead.rte");


Mon Nov 22, 2010 6:29 pm
Profile ICQ

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Zombie Spawner
Sorry for screwing up the last one, I don't have CC at the moment, or any scripts for it, so I was doing it from memory and ignored the less glaring errors. I should have taken a better look and checked first.

Anyway, I believe your problem is that the name of what you are trying to spawn doesn't match the actor you created. Line 21 (and for that matter 20) is the problem.
I don't know what you named it, but you have to get the names to match up.
So, if your line 19 looked like this:
local Zombie = CreateAHuman("Zombie Medium" , "Undead.rte");
Your line 20 should look like this:
Zombie.Pos = AHumanpos
And your line 21 like this:
MovableMan:AddActor(Zombie);

Note however, that to keep consistency with the rest of the names in the script (doesn't really matter, just makes more sense), you might want to use the following instead for lines 19 - 21.
local AHuman = CreateAHuman("Zombie Medium" , "Undead.rte");
AHuman.Pos = AHumanpos
MovableMan:AddActor(AHuman);


Tue Nov 23, 2010 3:06 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Zombie Spawner
Line 17 is where it defines the AHumanpos local variable.


Tue Nov 23, 2010 3:30 am
Profile
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post Re: Zombie Spawner
Zombie.Pos = SceneMan:MovePointToGround(AHumanpos)

The arguments might be wrong, but try that.


Tue Nov 23, 2010 3:11 pm
Profile WWW
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post Re: Zombie Spawner
Put it above this line: Zombie.Pos = AHumanpos


Tue Nov 23, 2010 3:37 pm
Profile WWW
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post Re: Zombie Spawner
Code:
function Create(self)
   self.SpawnTime = math.random(50, 100);
   self.Frame = 1;
end

function Update(self)
   self.Frame = 1;
   local AHumanamount = 1;
   for actor in MovableMan.Actors do
      if actor.PresetName = "Zombie Medium" then
         AHumanamount = AHumanamount + 1;
      end
   end
   self.SpawnTime = self.SpawnTime - math.random(.5, 1) / AHumanamount;
   if self.SpawnTime < 0 then
      self.SpawnTime = math.random(50000, 100000) / SceneMan.SceneWidth;
      local AHumanpos = Vector(math.random(0,SceneMan.SceneWidth), 0);
      if SceneMan:CastStrengthSumRay(AHumanpos, AHumanpos + Vector(0,0),0,0) == 0 then
         local Zombie = CreateAHuman("Zombie Medium","Undead.rte");
         Zombie.Pos = SceneMan:MovePointToGround(AHumanpos,16,12);
         MovableMan:AddActor(Zombie);
      end
   end
end

Try that.


Tue Nov 23, 2010 5:06 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 10 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.067s | 15 Queries | GZIP : Off ]