Author Topic: auto target p4 when p2 is dead?  (Read 113 times)

Offline kooloo

  • User
  • **
    • View Profile
auto target p4 when p2 is dead?
« on: November 06, 2009, 01:09:09 PM »
one of the character uses the code below:

[State 1301, pos]
type = PosSet
trigger1 = time = 0
x = enemy,pos X
y = 0

However in simul mode, this code triggers a problem coz the character will only fly to P2 instead of P4 even when P2 is long dead..

I tried

[State 1301, pos]
type = PosSet
trigger1 = time = 0
trigger1 = P2 != life
x = P4,pos X

but it didn't work.

Any suggestions ?
y = 0

Offline Byakko

  • Contributor
  • ******
    • View Profile
Re: auto target p4 when p2 is dead?
« Reply #1 on: November 06, 2009, 01:11:54 PM »
Try changing "enemy" for "enemynear".
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

Online Rajaa

  • Global Moderator
  • ******
  • I don't make any sense.
    • View Profile
    • RajaaBoy's Temple
Re: auto target p4 when p2 is dead?
« Reply #2 on: November 06, 2009, 01:18:26 PM »
^That won't work. To solve this you'll either need to use enemynear(0) and enemynear(1) and detect when one or the other is dead using an abundance of triggers and sctrls.

The simple way is to use p2bodydist x or p2dist x, this always works for any enemy player that's near you, the "p2" is just for show. Works for player 4 as well. Whoever you're facing. Disregards dead players automatically.

I'd change the "posset"" to a" posadd" then use "p2dist x" as a trigger. That would work.

x = p2dist x

also I don't think p2 != life is legitimate at all. '!p2life or p2life=0' works, though.

Offline kooloo

  • User
  • **
    • View Profile
Re: auto target p4 when p2 is dead?
« Reply #3 on: November 06, 2009, 11:17:07 PM »
Thanks man !!

I tried this:

[State 1301, pos]
type = Posadd
trigger1 = time = 0
trigger1 = p2life !=0
x = p2dist x
y = 0

[State 1301, pos]
type = Posadd
trigger1 = time = 0
trigger1 = p2life =0
x = p4dist x
y = 0


But it didn't work. the character still targets the deadbody rather than the alive enemy..

Any suggestions ?

Online Rajaa

  • Global Moderator
  • ******
  • I don't make any sense.
    • View Profile
    • RajaaBoy's Temple
Re: auto target p4 when p2 is dead?
« Reply #4 on: November 07, 2009, 07:54:14 AM »
P4dist x/y, is not a legitimate trigger and it will crash mugen. Only, p2dist x/y. Remove the life triggers, they are not needed and your thinking about it too hard. To ignore dead opponents is built into p2dist triggers, you don't need to use any other triggers to insure this.

[State 1301, pos]
type = Posadd
trigger1 = time = 0
x = p2dist x
y = 0

This should be fine.