View unanswered posts | View active topics It is currently Fri Dec 27, 2024 1:43 pm



Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
 Problems with attaching brains on an actor (details inside) 
Author Message
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post Problems with attaching brains on an actor (details inside)
So, for my latest mod I'm trying to have an AHuman that carries a brain. When it's dead it should drop said brain, thus the brain would still be in control, just with no more mobility. Is this possible with lua or without lua? I tried AddAttachable = Actor and CopyOf = <said brain name>, but it doesn't work.

Thanks for whoever can help me.


Last edited by carriontrooper on Thu Jun 04, 2009 2:23 pm, edited 1 time in total.



Sat May 30, 2009 11:08 am
Profile YIM WWW
User avatar

Joined: Thu May 15, 2008 11:40 am
Posts: 1527
Location: In heaven, everything is fine.
Reply with quote
Post Re: How to attach a brain on an actor...
I was wanting the exact same thing. Though more comical, a butler/maid who holds your brain for you.

I think you can pin actors onto actors, so can brains?


Sat May 30, 2009 2:02 pm
Profile
User avatar

Joined: Mon Feb 12, 2007 12:46 am
Posts: 1765
Location: ..............
Reply with quote
Post Re: How to attach a brain on an actor...
If I remember correctly, there was a mod that allowed you to combine 2 actors to be one single actor with a single button, but they still have separate HP, and one actor still lived if the other died.

Let me find it.....


Sat May 30, 2009 2:37 pm
Profile
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post Re: How to attach a brain on an actor...
Must use piipu's lua code then? hmmmm....
I'll make 2 versions of my mod then, for B22 and for B23.


Sat May 30, 2009 3:03 pm
Profile YIM WWW
User avatar

Joined: Mon Feb 12, 2007 12:46 am
Posts: 1765
Location: ..............
Reply with quote
Post Re: How to attach a brain on an actor...
B22 doesn't allow Lua for anything except missions.


Sat May 30, 2009 3:28 pm
Profile
User avatar

Joined: Sun May 11, 2008 12:50 pm
Posts: 899
Reply with quote
Post Re: How to attach a brain on an actor...
Code:
function Create(self)
   self.gun = CreateACrab("Lasor")
        self.gun.Pos = self.Pos
   self.gun.Team = self.Team
   self.gun.PinStrength = 0
   self.gun.GlobalAccScalar = 0
   self.gun.AIMode = Actor.AIMODE_PATROL
   MovableMan:AddActor(self.gun)
end

function Update(self)
     
   if MovableMan:IsActor(self.gun) then
   self.gun.Pos = Vector(self.Pos.X + 8,self.Pos.Y - 6)
   self.gun.Vel = self.Vel
   self.gun.RotAngle = self.RotAngle
   end
   if actor.HFlipped == true then actor.Hflipped = false
   end
end

function Destroy(self)
   self.gun:GibThis()
end


Taken from P3lbox's crab turret thingy, works quite well. (Yes, it does exactly what piipu did with his drone)


Sat May 30, 2009 3:31 pm
Profile WWW
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post Re: How to attach a brain on an actor...
wait what? I am blind in lua so tell me which is which on that code...


Sat May 30, 2009 3:50 pm
Profile YIM WWW
User avatar

Joined: Thu May 15, 2008 11:40 am
Posts: 1527
Location: In heaven, everything is fine.
Reply with quote
Post Re: How to attach a brain on an actor...
It's been mentioned that the ability for a robot taking your brain to replace its head will be a feature in CC. It's quite possible now but it's still not implanted.


Sat May 30, 2009 4:04 pm
Profile
User avatar

Joined: Sun May 11, 2008 12:50 pm
Posts: 899
Reply with quote
Post Re: How to attach a brain on an actor...
carriontrooper wrote:
wait what? I am blind in lua so tell me which is which on that code...

Ok here's a quick explanation:
Code:
function Create(self)

The following following this line is run when the actor is created.
Code:
   self.gun = CreateACrab("Lasor")
        self.gun.Pos = self.Pos
   self.gun.Team = self.Team
   self.gun.PinStrength = 0
   self.gun.GlobalAccScalar = 0
   self.gun.AIMode = Actor.AIMODE_PATROL

This block of code sets various parameters for the actor that's gonna be created in the future. (Such as its team, AIMode, etc.)
Code:
   MovableMan:AddActor(self.gun)

Finally, this creates the actor.

Code:
function Update(self)

Code following this line is run while the actor still exists. (I think its every millisecond, but I'm not sure)

Code:
   if MovableMan:IsActor(self.gun) then
   self.gun.Pos = Vector(self.Pos.X + 8,self.Pos.Y - 6)
   self.gun.Vel = self.Vel
   self.gun.RotAngle = self.RotAngle
   end
   if actor.HFlipped == true then actor.Hflipped = false
   end

This block makes the actor move and rotate with the parent.

Code:
function Destroy(self)

Guess what this does! Everything following this runs when the actor is destroyed.
Code:
   self.gun:GibThis()

This Gibs the turret we attached to our actor.

Someone correct me if I missed something or if I'm just wrong.


Sat May 30, 2009 7:28 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: How to attach a brain on an actor...
You could also just remove the brain actor in the same sim update as you add it do someone's inventory.

Remember, kiddies, AddInventory works for Actors, AHumans, ACDropships, even ACRockets.


Sat May 30, 2009 7:43 pm
Profile
User avatar

Joined: Sun May 11, 2008 12:50 pm
Posts: 899
Reply with quote
Post Re: How to attach a brain on an actor...
Grif wrote:
You could also just remove the brain actor in the same sim update as you add it do someone's inventory.

Remember, kiddies, AddInventory works for Actors, AHumans, ACDropships, even ACRockets.

Oh oops, forgot about that, thanks.


Sat May 30, 2009 8:01 pm
Profile WWW
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post Re: How to attach a brain on an actor...
Help guys! The brain did attach, but now the actor it's attached to moves on its own to the right! How to fix this??
Here's the code for the .lua, based off roon3's code above:

Code:
function Create(self)
   self.brain = CreateActor("Mainframe")
      self.brain.Pos = self.Pos
   self.brain.Team = self.Team
   self.brain.PinStrength = 0
   self.brain.GlobalAccScalar = 0
   self.brain.AIMode = Actor.AIMODE_SENTRY
   MovableMan:AddActor(self.brain)
end

function Update(self)
     
   if MovableMan:IsActor(self.brain) then
   self.brain.Pos = Vector(self.Pos.X,self.Pos.Y)
   self.brain.Vel = Vector(0,0)
   self.brain.RotAngle = self.RotAngle
   end
   if actor.HFlipped == true then actor.Hflipped = false
   end
end


Mon Jun 01, 2009 3:44 am
Profile YIM WWW
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: How to attach a brain on an actor...
Add
Code:
self.brain:SetWhichMOToNotHit(self,-1)
to create function.


Mon Jun 01, 2009 5:35 pm
Profile
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post Re: How to attach a brain on an actor...
Oh, ok. Thanks piipu, I'll try that and report back.


Tue Jun 02, 2009 3:09 am
Profile YIM WWW
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post Re: How to attach a brain on an actor...
Tried it... still doesn't work! I'll post the mod here, and you guys determine what the heck is wrong with the mainframe bot??


Attachments:
File comment: The problem.
modbotsB23.rar [109.27 KiB]
Downloaded 257 times
Tue Jun 02, 2009 11:27 am
Profile YIM WWW
Display posts from previous:  Sort by  
Reply to topic   [ 25 posts ]  Go to page 1, 2  Next

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.069s | 15 Queries | GZIP : Off ]