Data Realms Fan Forums
http://45.55.195.193/

Zombie Spawner
http://45.55.195.193/viewtopic.php?f=73&t=20277
Page 1 of 1

Author:  Bad Boy [ Mon Nov 22, 2010 12:09 am ]
Post subject:  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.

Author:  Petethegoat [ Mon Nov 22, 2010 12:24 am ]
Post subject:  Re: Zombie Spawner

I can't see anything especially wrong, what exactly is the error? What line?

Author:  Bad Boy [ Mon Nov 22, 2010 5:52 am ]
Post subject:  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.

Author:  Roast Veg [ Mon Nov 22, 2010 5:47 pm ]
Post subject:  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.

Author:  Mad Alex [ Mon Nov 22, 2010 6:29 pm ]
Post subject:  Re: Zombie Spawner

You have: local AHuman = CreateActor("Zombie Medium" , "Undead.rte");
You want: local Zombieorgiveyourvaranothername = CreateAHuman("Zombie Medium" , "Undead.rte");

Author:  Bad Boy [ Tue Nov 23, 2010 3:06 am ]
Post subject:  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);

Author:  Roast Veg [ Tue Nov 23, 2010 3:30 am ]
Post subject:  Re: Zombie Spawner

Line 17 is where it defines the AHumanpos local variable.

Author:  Petethegoat [ Tue Nov 23, 2010 3:11 pm ]
Post subject:  Re: Zombie Spawner

Zombie.Pos = SceneMan:MovePointToGround(AHumanpos)

The arguments might be wrong, but try that.

Author:  Petethegoat [ Tue Nov 23, 2010 3:37 pm ]
Post subject:  Re: Zombie Spawner

Put it above this line: Zombie.Pos = AHumanpos

Author:  Petethegoat [ Tue Nov 23, 2010 5:06 pm ]
Post subject:  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.

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