Infinity MUGEN Team

IMT Main => M.U.G.E.N Guides & Tutorials => Topic started by: supermystery on December 08, 2008, 07:58:44 AM

Title: Figuring out p2 distances and using accurate values
Post by: supermystery on December 08, 2008, 07:58:44 AM
This something i use in debug mode to judge how far an opponent is, its also very useful for when your doing the AI too. Put the coding under statedef -2.


Code: [Select]
[State -2, DTC]
type = DisplayToClipboard
trigger1 = 1
text = "P2BodyDist X = %d, P2BodyDist Y = %d, Frontedgedist = %d, Backedgedist = %d"
params = Floor(P2BodyDist X), Floor(P2BodyDist Y), frontedgedist, backedgedist
IgnoreHitPause = 1


You should be able to see more information when you use debug mode (Ctrl + D).

Heres an example of what it looks like:

(http://img252.imageshack.us/img252/6889/debugaz9.jpg)

Title: Re: Figuring out p2 distances and using accurate values
Post by: pkon on December 08, 2008, 08:39:43 PM
Thank you for the code. now i can code my ai better.
Title: Re: Figuring out p2 distances and using accurate values
Post by: Excursion on December 26, 2008, 02:24:23 PM
Sorry I'm late with a reply, but this code helped me out immensely, thank you supermystery  :)
Title: Re: Figuring out p2 distances and using accurate values
Post by: O Ilusionista on December 26, 2008, 02:54:37 PM
This code is good and very used..but doesn't works well on simul modes. Plus, P2BodyDist gives the distance of P2 FRONT CLSN position, not his X axis position. P2DistX give you p2 X axis position though.

For simul modes, you should use EnemyNear:

Quote
[State -2, Debug Info]
type = DisplayToClipboard
trigger1 = roundstate > 0
text = "P2 Distance X: %f, P2 Distance Y: %f"
params = (Pos X-(enemyNear, Pos X)), (Pos y-(enemyNear, Pos y))

It will return a negative value, because you're on a negative position from p2.
SimplePortal 2.3.5 © 2008-2012, SimplePortal