Clone programming

Started by code4240, October 24, 2009, 06:59:12 AM

Previous topic - Next topic

code4240

How do you give a clone AI? I created a clone, but it does nothing but stand around.

I did add a state controller for the AI activation var with the trigger "ishelper(152)", but the AI was very limited, and had glitches.

[State -2, Helper]
type = Helper
trigger1 = !numhelper(152)
helpertype = player
name = "Clone?"
ID = 152
stateno = 0
pos = 100,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
persistent = 1

The code to create the character. Using -2 for easier char testing

[State -3]
Type = varset
Trigger1 = ishelper(152)
var(59) = 2

The inadequate AI activator code...
Flandre 4ever!

Cyanide

The helper needs keyctrl = 1 in order to let it into state -1. You still need to control how it uses the common states though.

Clones are horrible. And don't use player. Don't. Even if someone comes in here telling you it's ok DO NOT USE PLAYER. Seriously. Don't use it. I may repeat this a bit more to hammer it home. No player type helpers. Ever. Bad idea.

Is that enough?

Basically in order to code a decent clone you have to control ALL it's state changes. Every single one of them. Walk, run, stand, jump. Not just the attacks. You may find it beneficial to remove the helpers access to the character attacks as well. You don't need a variable at all for this. Just the ishelper trigger.

If it ishelper, it has AI, if it's !ishelper, then the move cannot be activated.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.