View unanswered posts | View active topics It is currently Mon Dec 30, 2024 11:17 pm



Reply to topic  [ 3 posts ] 
 Dual Mode Actors? 
Author Message
User avatar

Joined: Fri Apr 02, 2010 5:13 pm
Posts: 23
Reply with quote
Post 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!


Mon May 31, 2010 11:23 pm
Profile
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post 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


Last edited by Petethegoat on Tue Jun 01, 2010 5:04 pm, edited 2 times in total.



Mon May 31, 2010 11:33 pm
Profile WWW
User avatar

Joined: Fri Apr 02, 2010 5:13 pm
Posts: 23
Reply with quote
Post Re: Dual Mode Actors?
Thank you so much! :D


Tue Jun 01, 2010 12:18 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.052s | 15 Queries | GZIP : Off ]