-- content removed --
Thread Rating:
|
Simple things.
|
|
|
08-14-2013, 06:36 AM
08-14-2013, 08:19 PM
Thanks given by: Gad
08-15-2013, 04:38 AM
Code: int get_closest_enemy(){loadTarget() itself returns the object type of the loaded object; -1 if it doesn't exist. (change !=-1 into ==0 and also add a team check to only get enemies - this one will actually get the closest object right now) Thanks given by: Gad
08-15-2013, 01:31 PM
(08-15-2013, 09:49 AM)Gad Wrote:Try: Code: (self.team != target.team && target.type == 0 && (target.state != 12 || target.state != 18))- target must be in different team than you - target must be a character The third condition will always yield true. If the char is in state 12, the second part will make it valid (state != 18), if he is in state 18, the first validates it. Any other state is passed as well. Not quite sure what you're trying to achieve there ![]() (08-15-2013, 09:49 AM)Gad Wrote: And ofcourse the script is red by the program every frame?Yup. (08-15-2013, 09:49 AM)Gad Wrote: and btw, can't i use abs(self.x - target.x) to get distance?You might want to add the z-component, too. If you're really picky, y as well. The proper way would be sqrt((self.x - target.x)² + (self.y - target.y)² + (self.z - target.z)²). Distance in 3D-space. But then again, if you just go for the x-component, it shortens down to the abs(self.x - target.x) part. So I guess that's fine, too. (08-15-2013, 09:49 AM)Gad Wrote: Hmmm, the get_closest function seems to be jamming.Just to rule out anything, do you call "get_closest_enemy()" in your AI? Also, have you tried to print out the target-index + its xdistance? (08-15-2013, 09:49 AM)Gad Wrote: Just wondering.The game will most likely throw a synchronization-error at you once the AI behaves differently from normal.
Silverthorn / Blue Phoenix
~ Breaking LFE since 2008 ~ "Freeze, you're under vrest!" - Mark, probably. » Gallery | » Sprites | » DeviantArt
08-15-2013, 04:10 PM
(08-15-2013, 09:49 AM)Gad Wrote: Hmmm, the get_closest function seems to be jamming.How do you know it sticks to one selected target? Are you loading your target before your other stuff? The games basic AI selects it's own target and starts the ego function with it, so that might be the reason your target selection doesn't really do anything at all (or at least look like it). Basically if you don't intend to do something special you don't have to select targets inside the ego function - it's easier to just work with the pre selected one. (08-15-2013, 09:49 AM)Gad Wrote: Just wondering.It is, but whenever two computer characters with different AI are fighting both games will run differently and get a sync error once the checksum (I think it works by checking the object hp only) on both games differs.
08-16-2013, 01:11 PM
(target.state != 12 || target.state != 18)
what it checks: my target's state is not 12, OR, my target's state is not 18. if my target's state is 12, then it is true that my target's state is not 18. therefore my condition is true. if my target's state is 18, then it is true that my target's state is not 12. therefore my condition is true. if my target's state is 9001, then it is true that my target's state is not 12. therefore my condition is true. (target.state != 12 || target.state != 18) is not equivalent to (target.state !=12 && target.state != 18) Azriel~
08-16-2013, 01:22 PM
(This post was last modified: 08-16-2013, 01:39 PM by Silverthorn.)
(08-16-2013, 12:58 PM)Gad Wrote:Well, can you phrase in words how you want it to be?(08-15-2013, 01:31 PM)Blue Phoenix Wrote: The third condition will always yield true.doesn't In case you're thinking of something along the lines of "target.state may be neither 12 nor 18", the above snippet is correct. Guess you managed to confuse me completely in my last post ![]() (08-16-2013, 12:58 PM)Gad Wrote:Heh, I just wanted to be on the safe side(08-15-2013, 01:31 PM)Blue Phoenix Wrote: Just to rule out anything, do you call "get_closest_enemy()" in your AI? Also, have you tried to print out the target-index + its xdistance? ![]() Have you tried to print out object-id AND xdistance to see if it changes at all? Maybe even print out all t0-objects currently in-game and check manually if it picked the right one? az u so ninja-y
Silverthorn / Blue Phoenix
~ Breaking LFE since 2008 ~ "Freeze, you're under vrest!" - Mark, probably. » Gallery | » Sprites | » DeviantArt | |
|
« Next Oldest | Next Newest »
|
Users browsing this thread: 1 Guest(s)

Chat




![[Image: ZucdcMY.png]](https://i.imgur.com/ZucdcMY.png)