Data Realms Fan Forums
http://45.55.195.193/

Dual Mode Actors?
http://45.55.195.193/viewtopic.php?f=73&t=18881
Page 1 of 1

Author:  Commander Clark [ Mon May 31, 2010 11:23 pm ]
Post subject:  Dual Mode Actors?

Hello, CC Forum.
I was wondering if it would be possible to have an actor that would be able to switch from a translucent intangible form to a normal solid form, like the Ghost Twins form the matrix. I was thinking that the best way to do this would involve a modified Dual Weapon Mode Switcher (Like CaveCricket's). I already have both actors, the one that hits MOs, and the one that is translucent, all I need is the lua script.

P.S. I'm just beginning to comprehend lua, so please give me the whole script as opposed to a tiny chunk of coding.

Thanks!

Author:  Petethegoat [ Mon May 31, 2010 11:33 pm ]
Post subject:  Re: Dual Mode Actors?

Lua Tutorial
Lua Documentation

Start with those to improve your Lua. As for your script, you need to check a key, then create a new actor with the old actor's position and velocity, then remove the old actor.
Something like this:
Code:
function Update(self)
   if self:IsPlayerControlled() and UInputMan:KeyPressed(key) then
      local new = CreateAHuman("youractor");
      new.Pos.x = self.Pos.x;
      new.Pos.y = self.Pos.y;
      new.Vel = self.Vel;
      self.ToDelete = true;
   end
end

That is utterly untested and most likely will not work. Consider it a base to work from.
Also, a list of keystrokes with their corresponding numbers. by Darlos.

Edit:
Forgot to actually add the actor to the scene and set the team. I was also setting the position incorrectly.
Code:
function Update(self)
   if self:IsPlayerControlled() and UInputMan:KeyPressed(key) then
      local new = CreateAHuman("youractor");
      new.Pos = self.Pos;
      new.Vel = self.Vel;
      new.Team = self.Team;
      MovableMan:AddActor(new);
      self.ToDelete = true;
   end
end

Author:  Commander Clark [ Tue Jun 01, 2010 12:18 am ]
Post subject:  Re: Dual Mode Actors?

Thank you so much! :D

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