|
FAQ
• Search • Login
|
Author |
Message |
Roon3
Joined: Sun May 11, 2008 12:50 pm Posts: 899
|
Re: Flashbang
I don't think that's possible... The disabling code should look something like this: Code: for Billy in MovableMan.Actors do if (Billy.Pos.X <= self.Pos.X + ### and Billy.Pos.X >= self.Pos.X - ### and Billy.Pos.Y <= self.Pos.Y + ### and Billy.Pos.Y >= self.Pos.Y - ###) then -- ### is radius of the flash in pixels Billy.AIM_SHARP = false; -- I have no idea how to access AIM_SHARP and WEAPON_FIRE so this probaly not the way to do it Billy.WEAPON_FIRE = false; -- Once again, this won't work, but its how the code should look like
|
Sat May 23, 2009 2:56 pm |
|
|
MaximDude
Joined: Wed Nov 22, 2006 3:19 pm Posts: 2073
|
Re: Flashbang
Roon3 wrote: I don't think that's possible... The disabling code should look something like this: Code: for Billy in MovableMan.Actors do if (Billy.Pos.X <= self.Pos.X + ### and Billy.Pos.X >= self.Pos.X - ### and Billy.Pos.Y <= self.Pos.Y + ### and Billy.Pos.Y >= self.Pos.Y - ###) then -- ### is radius of the flash in pixels Billy.AIM_SHARP = false; -- I have no idea how to access AIM_SHARP and WEAPON_FIRE so this probaly not the way to do it Billy.WEAPON_FIRE = false; -- Once again, this won't work, but its how the code should look like
This makes my eyes bleed DX How do I even start a lua script??? ARGH!!! I thought learning C was hard...
|
Sat May 23, 2009 3:15 pm |
|
|
Roon3
Joined: Sun May 11, 2008 12:50 pm Posts: 899
|
Re: Flashbang
Uh... Actually, most of that is just comments
|
Sat May 23, 2009 3:20 pm |
|
|
Metal Chao
Joined: Sat May 05, 2007 6:04 pm Posts: 2901
|
Re: Flashbang
MaximDude wrote: Roon3 wrote: I don't think that's possible... The disabling code should look something like this: Code: for Billy in MovableMan.Actors do if (Billy.Pos.X <= self.Pos.X + ### and Billy.Pos.X >= self.Pos.X - ### and Billy.Pos.Y <= self.Pos.Y + ### and Billy.Pos.Y >= self.Pos.Y - ###) then -- ### is radius of the flash in pixels Billy.AIM_SHARP = false; -- I have no idea how to access AIM_SHARP and WEAPON_FIRE so this probaly not the way to do it Billy.WEAPON_FIRE = false; -- Once again, this won't work, but its how the code should look like
This makes my eyes bleed DX How do I even start a lua script??? ARGH!!! I thought learning C was hard... Without comments it is just Code: for Billy in MovableMan.Actors do if (Billy.Pos.X <= self.Pos.X + 111 and Billy.Pos.X >= self.Pos.X - 11 and Billy.Pos.Y <= self.Pos.Y + 111 and Billy.Pos.Y >= self.Pos.Y - 111) then Billy.AIM_SHARP = false; Billy.WEAPON_FIRE = false;
Much easier to read, if less informative and harder to use. I can understand that and I haven't even tried Lua.
|
Sat May 23, 2009 3:52 pm |
|
|
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
Re: Flashbang
Nope, you don't just directly access controller states. You need to get the actor's controller first, then use a certain function on the controller. Also, good lord, there's a better way to check a distance between actors. Code: for Billy in MovableMan.Actors do local flashRange = 111; local distanceX = self.Pos.X - Billy.Pos.X; local distanceY = self.Pos.Y - Billy.Pos.Y; local distance = math.sqrt(distanceX ^ 2 + distanceY ^ 2); if distance <= flashRange then local BillyController = Billy:GetController(); BillyController:SetState(Controller.AIM_SHARP, false); BillyController:SetState(Controller.WEAPON_FIRE, false); end end
|
Sat May 23, 2009 4:05 pm |
|
|
MaximDude
Joined: Wed Nov 22, 2006 3:19 pm Posts: 2073
|
Re: Flashbang
Darlos9D wrote: Nope, you don't just directly access controller states. You need to get the actor's controller first, then use a certain function on the controller. Also, good lord, there's a better way to check a distance between actors. Code: for Billy in MovableMan.Actors do local flashRange = 111; local distanceX = self.Pos.X - Billy.Pos.X; local distanceY = self.Pos.Y - Billy.Pos.Y; local distance = math.sqrt(distanceX ^ 2 + distanceY ^ 2); if distance <= flashRange then local BillyController = Billy:GetController(); BillyController:SetState(Controller.AIM_SHARP, false); BillyController:SetState(Controller.WEAPON_FIRE, false); end end -___-' That made it so much easier...
|
Sat May 23, 2009 5:24 pm |
|
|
|
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
|
|