Data Realms Fan Forums http://45.55.195.193/ |
|
"Conveyor zone" http://45.55.195.193/viewtopic.php?f=73&t=14686 |
Page 1 of 2 |
Author: | war_man333 [ Sat May 16, 2009 5:10 pm ] |
Post subject: | "Conveyor zone" |
Code: if (actor.Pos.X >= self.Pos.X - 24) and (actor.Pos.X <= self.Pos.X + 24) and (actor.Pos.Y >= self.Pos.Y - 25) and (actor.Pos.Y <= self.Pos.Y + 25) and (actor.PinStrength <= 0) then So basically this thing describes an area or a zone that's square-shaped, that's what I understood, but the problem is that I suck at offsets. So I thought maybe some of you guys could help me out here, I got a 288x192 sprite, and I want the red area to be the zone/area. I really suck at this stuff. |
Author: | mail2345 [ Sat May 16, 2009 6:21 pm ] |
Post subject: | Re: "Conveyor zone" |
General rule of thumb: Replace the X values(the first two) with half the width. Replace the Y values(the last two) with half the length. Much easyer than offsets. Code: if (actor.Pos.X >= self.Pos.X - 144) and (actor.Pos.X <= self.Pos.X + 144) and (actor.Pos.Y >= self.Pos.Y - 96) and (actor.Pos.Y <= self.Pos.Y + 96) and (actor.PinStrength <= 0) then |
Author: | war_man333 [ Sat May 16, 2009 6:52 pm ] |
Post subject: | Re: "Conveyor zone" |
But then it's the whole Module, then it's not just the red zone. |
Author: | mail2345 [ Sat May 16, 2009 7:26 pm ] |
Post subject: | Re: "Conveyor zone" |
Oh. My mistake. Code: if (actor.Pos.X >= self.Pos.X - 81) and (actor.Pos.X <= self.Pos.X + 81) and (actor.Pos.Y >= self.Pos.Y - 11) and (actor.Pos.Y <= self.Pos.Y + 11) and (actor.PinStrength <= 0) then Just copy out the area in paint, change the px dim to 1,1 , paste and measure the new px dim. |
Author: | war_man333 [ Sat May 16, 2009 7:38 pm ] |
Post subject: | Re: "Conveyor zone" |
You lost me at px dim? |
Author: | Grif [ Sat May 16, 2009 8:06 pm ] |
Post subject: | Re: "Conveyor zone" |
If Lua offsets are like every other programming language's offsets ever, you should define everything as if it's the fourth quadrant of a graph. EG, the top right corner would be X+24, Y+0; then X+whatever, Y+0; etc Not 100% sure, but that's how, say, C++ would do it, and how Area areas do it. |
Author: | war_man333 [ Sat May 16, 2009 8:21 pm ] |
Post subject: | Re: "Conveyor zone" |
Uhh. Okay? Another question, Code: for actor in MovableMan.Actors do Is there any way to make it focus on green team only, and ignore team red? |
Author: | mail2345 [ Sat May 16, 2009 8:26 pm ] |
Post subject: | Re: "Conveyor zone" |
war_man333 wrote: You lost me at px dim? Go to attributes in paint. Oh, and my calculations assume that the red area is an object centered around a point. |
Author: | Grif [ Sat May 16, 2009 8:35 pm ] |
Post subject: | Re: "Conveyor zone" |
war_man333 wrote: Uhh. Okay? Another question, Code: for actor in MovableMan.Actors do Is there any way to make it focus on green team only, and ignore team red? if actor.Team == 1 then Add that after the for loop but before anything else. |
Author: | war_man333 [ Sun May 17, 2009 9:01 am ] |
Post subject: | Re: "Conveyor zone" |
I'm getting this Property name was not followed by a value in xxx.rte/xxx.lua at line 1! Code: function Update(self) for actor in MovableMan.Actors do if actor.Team == 1 then if (actor.Pos.X >= self.Pos.X - 80) and (actor.Pos.X <= self.Pos.X + 80) and (actor.Pos.Y >= self.Pos.Y - 10) and (actor.Pos.Y <= self.Pos.Y + 10) and (actor.PinStrength <= 0) then actor.Health = 0; end end end |
Author: | Grif [ Sun May 17, 2009 9:12 am ] |
Post subject: | Re: "Conveyor zone" |
How in god's name are you getting an .ini error in a .lua file? How are you loading it? Are you using IncludeFile = whatever.lua? |
Author: | war_man333 [ Sun May 17, 2009 9:21 am ] |
Post subject: | Re: "Conveyor zone" |
Uhmmm... no... What do you do instead of IncludeFile? |
Author: | Grif [ Sun May 17, 2009 9:45 am ] |
Post subject: | Re: "Conveyor zone" |
ScriptPath = modulename.rte/script.lua In whatever object has the script attached. |
Author: | war_man333 [ Sun May 17, 2009 9:55 am ] |
Post subject: | Re: "Conveyor zone" |
So you don't need to include it in the index file? Thanks! |
Author: | geforz [ Sun May 17, 2009 10:27 am ] |
Post subject: | Re: "Conveyor zone" |
You should also add the corresponding "end" for "if actor.Team == 1 then" |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |