View unanswered posts | View active topics It is currently Thu Nov 28, 2024 11:18 am



Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
 Flashbang 
Author Message
User avatar

Joined: Sun May 11, 2008 12:50 pm
Posts: 899
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post 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
Profile
User avatar

Joined: Sun May 11, 2008 12:50 pm
Posts: 899
Reply with quote
Post Re: Flashbang
Uh... Actually, most of that is just comments


Sat May 23, 2009 3:20 pm
Profile WWW
User avatar

Joined: Sat May 05, 2007 6:04 pm
Posts: 2901
Reply with quote
Post 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
Profile
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post 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
Profile YIM
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post 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
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 21 posts ]  Go to page Previous  1, 2

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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.033s | 13 Queries | GZIP : Off ]