YesNoOk
avatar

Creating clones that act like "full characters" (Read 7943 times)

Started by JustNoPoint, September 21, 2016, 05:02:19 am
Share this topic:
Creating clones that act like "full characters"
#1  September 21, 2016, 05:02:19 am
  • ******
    • www.justnopoint.com/
So I'm not really having a lot of luck finding characters that make clones. POTS's Rare Akuma isn't labelled well enough for me to follow it's huge amounts of code.

So I'm trying to figure this out myself.

Right now I have a character creating the clone correctly. Depending on which kick you press for the command the character has a clone created and jump, dash forward, or dash back.

An example, for the jump the character does the specified animation and at animelem = 11 a helper is created 35001. In state 35001 I currently set it's velocities then send it to the character's jumping state.

This is where I kinda lose my game plan. You can have up to 2 clones at once. So I think I'm needing a var to tell which clone is which.

To confirm, no matter what stateno the helper goes into it will remain NumHelper(35001), correct? So if someone did 2 of the jumping clones I could track them with NumHelper(35001) and their var, right?

Once I get a good plan I can just code up some AI blocks for their limited skill sets they'll use. But I want them to be able to fully get hit. Not sure what to do with throws yet though. Guess they probably shouldn't be throwable? Seems being able to throw them could really break some stuff. Especially cinematic supers.
Re: Creating clones that act like "full characters"
#2  September 21, 2016, 05:03:59 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
I did it in Zeori by accident. You really just create a helper with keyctrl = 1 and it will respond to your commands in -1. That's it.

And you can easily track if the Helper is a Helper by using IsHelper(ID).
Re: Creating clones that act like "full characters"
#3  September 21, 2016, 05:08:46 am
  • ******
    • www.justnopoint.com/
Well this one won't be controlled by your inputs. It will have a set of AI commands it'll use under certain conditions. Not that that changes your point :P

Use IsHelper to track my helper. Sounds simple enough. What happens when you're Zeori gets hit with a throw? How do I do his clones super? The airplane super never allowed the next round to occur and I had to skip his intro due to massive debug floods. So I kinda gave up trying to figure out how to do it. The cmd list didn't help me much either with your crazy names!
Re: Creating clones that act like "full characters"
#4  September 21, 2016, 05:11:05 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
Clones do supers when you input the normal super command. If his clones get hit by a throw, if I recall correctly, they go into the normal throw state with the required gethits. If you do not want this behavior, you can take care of it with HitBy and HitOverride.
Re: Creating clones that act like "full characters"
#5  September 21, 2016, 05:18:41 am
  • ******
    • www.justnopoint.com/
I meant what is the input for your move that makes clones with Zeori? So I can better take a look at the coding.

Thanks for the tip about the hitby and override stuff. I'll test allowing throws at 1st to connect. If I have to use the nothitby SCTRL to make sure he can't be thrown I guess it'd be best to place that in his -2 so any state he's in as the helper can be set to be immune. Instead of having to go to every possible state he could go in and apply them in the event he's also a helper in said state.

Re: Creating clones that act like "full characters"
#6  September 21, 2016, 05:26:28 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
QCBx2+P (Tri-Formation)
Re: Creating clones that act like "full characters"
#7  September 21, 2016, 05:41:34 am
  • ****
    • China
    • http://vans.trinitymugen.net/
I have plenty of experience working with clones and MUGEN.

Helpertype = Player has a couple of perks that can be useful with clones, particularly the fact that you can disable access to -1 while keeping two active copies of statedef -2 and -3. This is useful for certain things.

Usually a good idea with clones is having a "stand by" state to control when to despawn them. If you need more examples of clone coding, I can provide some as well.
Re: Creating clones that act like "full characters"
#8  September 21, 2016, 05:56:10 am
  • ******
    • www.justnopoint.com/
I'll try and put something together tomorrow with what I have. But by a stand by state I was thinking of allowing the clone to return during any idle animation. Wouldn't I just make it so when the root does the merge back command the helper will return on its 1st idle?

Would I need to have the helper go to a stand by state anyway?
Re: Creating clones that act like "full characters"
#9  September 21, 2016, 06:14:10 am
  • ****
    • China
    • http://vans.trinitymugen.net/
It depends on what you want to do. In my case, my clone had to behave as a "limb" of the root while being a full copy.

The stand-by state was used as a "visual trick" to change the helper and the root's positions as I saw fit.
Re: Creating clones that act like "full characters"
#10  September 21, 2016, 07:57:53 pm
  • *****
  • Shame on you!
    • USA
This is where I kinda lose my game plan. You can have up to 2 clones at once. So I think I'm needing a var to tell which clone is which.
To confirm, no matter what stateno the helper goes into it will remain NumHelper(35001), correct? So if someone did 2 of the jumping clones I could track them with NumHelper(35001) and their var, right?
 Not sure what to do with throws yet though. Guess they probably shouldn't be throwable? Seems being able to throw them could really break some stuff. Especially cinematic supers.
The clones, you could try to do basic math inside the helper's ID =
ID = (35001+numhelper(35001))
This way, if helper 35001 doesn't exist, it's 35001+0. If it does, 35001+1. Right?

Or if 2 is the max you just make two helper calls. One that checks numhelper(35001) = 0 and the other that checks numhelper(35001) > 0 and give it a second ID number.

I'm not sure if the root can read the variables of the children. I think I've always just use ParentVarSet. What would you need to track inside the clones? A lot can be figured out with just stateno & animations.

With throws, you'd have to have a check in statedef 0 to see if it's the helper and send it back to what ever state you need. When the throw ends the selfstate will send you to state 0. If the clone is exactly the same sprites as P1, throws should work normal. Which sounds like it's the case because you send it to state 40.
Your clone can die. If P2 just focuses on it, it'll die if it gets hit enough. Pretty sure it starts with the same life as P1. If you dont want this to happen I guess you could make a lifeadd in -2 that only gives to the clone(s).
I have mixed feelings about letting the clone get thrown. If you CANT throw the clone, P2 kinda wastes attacks, sometimes Ultras. If it CAN get thrown, P1 has all the time in the world to set up for P2 to come out of the throw. Which isn't that fair to P2. The visual effects of the Ultra throw should work like normal. If P2's author didn't code the throw with 0 hitboxes, that's P2's fault and not yours.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Creating clones that act like "full characters"
#11  September 21, 2016, 08:18:41 pm
  • ******
    • www.justnopoint.com/
I'm removing the ability for it to be thrown. It'll interfere with too many cinematic supers.

Changed things a bit. Now all 3 variant Clones start off with the same animation. So all 3 variants have been simplified to Helper(3501) which is the same as the animation they begin with.

Right now I have it set to see which button the player pressed.
[State 1000, VarSet]
type = VarSet
trigger1 = !time
var(41) = ifElse(command="c",2,ifElse(command="b",1,0))

So inside the helper I have this
[State 0, VarSet]
type = VarSet
trigger1 = !Time
trigger1 = !Var(1)
var(1) = root, Var(41) + 1

[State 0, VarSet]
type = VarSet
trigger1 = !Time
trigger1 = Var(1) > 0
var(2) = root, Var(41) + 1

Var(1) is the 1st clone that can be created and Var(2) is the second. Depending on which button you pressed you get a different clone variant. Var(1) = 3 gives you the jumping one. So right off the bat he jumps. And will be more of an anti air and air to ground fighter.

2 makes him dash forward and is his melee mode. Mostly ground based attacks and pressure.

1 makes him dash back and play defensively.

It looks like I have to add all the AI routines to the states he can go in. So I'll probably have to over write all his common states won't I?

Also I tried adding this to the -2 and it didn't prevent him from being thrown. Is this something else I'll have to do for all states the clone can go into?
;Don't throw clones
[State -2, NotHitBy]
type = NotHitBy
trigger1 = IsHelper(3501)
value = ,NT,ST,HT
time = 1

For the lifebars each clone will have it's own. I assume I use a variable that decreases by the amount of gethitvar damage and such. Once it is zero the clone dies.

EDIT: Just tested and the clone indeed does die after several hits. The var method may not be best. I wonder if I could just set it's life using IsHelper and lifeadd to decrease it down to the 200 life he should have.

EDIT2: Well the life part was simple enough. Lifeset SCTRL at !Time :P
Last Edit: September 21, 2016, 08:26:03 pm by Just No Point
Re: Creating clones that act like "full characters"
#12  September 21, 2016, 11:12:37 pm
  • ******
  • 日本は素晴らしい国です。
I have plenty of experience working with clones and MUGEN.

Helpertype = Player has a couple of perks that can be useful with clones, particularly the fact that you can disable access to -1 while keeping two active copies of statedef -2 and -3. This is useful for certain things.

Usually a good idea with clones is having a "stand by" state to control when to despawn them. If you need more examples of clone coding, I can provide some as well.
You should have coded it into piccolo before leaving! D: It would had been a great help towards JNP.
Re: Creating clones that act like "full characters"
#13  September 21, 2016, 11:41:50 pm
  • ******
    • www.justnopoint.com/
It'd help the deadline I want to meet but this way I get to learn at least. It'll help me in future WIPs. I just need to make sure I should be adding the clone coding to the common states or if that's not the best way to do this.
Re: Creating clones that act like "full characters"
#14  September 22, 2016, 12:54:00 am
  • *****
  • Shame on you!
    • USA
You could do like my Yun&Yang (You know where to find it :P )
I made every state the clone went into add 20,000. So state 210 would be state20,210.
If your clone doesn't have access to every single state this might be the easiest way. It does take some -2 stuff and I think there was 1 hiccup when landing, but it was only visual. So if your clone uses the same sprite and palette as P1 you'll never see the change.
----
Realized Yun&Yang are under button control so it might not work exactly the same. But it should.

Just a point, you could have dropped the var and made the changeanim watch for the button presses. Then made the state do whatever depending on the animation.

I'd think you should be able to code the AI into -1 like normal. Just do the IsHelper check. That's how Yun&Yang work.
An idea if it wont work at all. You make an invisible helper that acts like statedef -1. It just runs and runs. All it does is set a parentvar to which ever stateno. The Clone would use the parent variable in the changestate and switch to it.
You could write out all of the AI. depending on crouching/standing/air you'd lock in a variable. Then that variable would be read in all of the changestates in that blank helper. Then you'd do the random check to see what works. With good triggeralls you probably wouldnt see any lag ever. At the end of the Clone's state you could change the parentvar to fire off inside the blank helper.
Or you'd have a ton of changestates in stateno -2 constantly running I'd think.
 

----
from Yun&Yang

;+++++++++++++++++++++++++++++++++++++++++++++++
;NO THROWS!
[State -2, NoThrow]
type = NotHitBy
triggerall = IsHelper(718)
trigger1 = 1
value =  ,NT,ST,HT
time = 1
ignorehitpause = 1
;persistent =
vVv Ryuko718 Updated 10/31/22 vVv
Last Edit: September 22, 2016, 01:01:48 am by Odb718
Re: Creating clones that act like "full characters"
#15  September 22, 2016, 01:14:17 am
  • ******
    • www.justnopoint.com/
I'll see if I can get the clone to jump toward P2 in the -1

Right now I have it programmed in his jump start state so if he's the helper and p2 is 50 pixels or less he jumps upwards. If p2 is more than 50 away he jumps forward. Since all that is programmed inside state 40 I'm not fully sure how to tell it to do that in -1

Also I think for convenience I'll make 2 different helper ids instead of 1 that uses a var to differentiate. The var(1) will still need to be used to determine which style clone to use. There is no different animation for each button that's why I used the var to track the button that was pressed in root.
Re: Creating clones that act like "full characters"
#16  September 22, 2016, 08:01:11 am
  • *****
  • Shame on you!
    • USA
I've used the same exact animation just doubled/renumbered to differentiate the statenos in the past. It doesn't take any more resources to copy/paste the animation a second or third time. To the people playing it looks exactly the same but to the program it's different enough.
I know it's not a big deal to use a variable for what you're doing, just pointing out techniques for anyone reading.

With it being statedef 40, and with the checks in 40 to set the velocities I'm not exactly sure either. You could make a custom state.
Does it enter into statedef 40 though?
One thing you can do for accurate testing to see if it'll jump forward is to allow it only if P1 is in a certain statedef. One you know you have to hold forward on.
You could leave the code in statedef 40. Then put the triggers in -1 so it enters 40. It would act right.
I think I've coded jumping AI and I couldn't put it in statedef 40. I had to put it in 50 with the vels already set. But I could be mistaken.
 
[State -1, JumpJump]
type = ChangeState
value = 40
triggerall = ishelper(3501)     ;you may need a numhelper(3501) check above this for debug flood
triggerall = (statetype = s) && ctrl
trigger1 = p2bodydist x = [1,50]
trigger2 = p2bodydist x = [51,250]  ;you could change this.
trigger3= root,stateno=710             ;this state you have to hold forward in. used only for testing
trigger4 = root,stateno=200            ;basic attack. used for testing neutral jump

Also, using the two helper numbers you may have to do something about the trigger alls. Maybe
triggerall = (ishelper(3501))   ||  (ishelper(3502))
would work for you
vVv Ryuko718 Updated 10/31/22 vVv
Last Edit: September 22, 2016, 08:07:30 am by Odb718
Re: Creating clones that act like "full characters"
#17  September 22, 2016, 03:57:51 pm
  • ******
    • www.justnopoint.com/
;NO THROWS!
[State -2, NoThrow]
type = NotHitBy
triggerall = IsHelper(718)
trigger1 = 1
value =  ,NT,ST,HT
time = 1
ignorehitpause = 1
;persistent =
This didn't work. Clones can still be thrown.

Also this won't send the helper to state 40 for some reason,
[State -1, Clone Jump]
type = ChangeState
value = 40
triggerall= IsHelper(3501) || IsHelper(3502)
trigger1 = statetype = S
trigger1 = ctrl

 I'm thinking it may be easier to override the common states and program the helper's actions straight to them. I had the jumping working fine in State 40

This way I could also code the nothitby and the width because P2 walks right through my clones currently
Re: Creating clones that act like "full characters"
#18  September 22, 2016, 10:59:52 pm
  • *****
  • Shame on you!
    • USA
I think it may be sending it to state 40 but mugen instantly makes it land because the behind the scenes stuff isn't adding up. I think that's why I had to do the velset and send it to state 50. You should have kept the stuff that allows state 40 to work. The AI just needs to be able to enter the state. Just have the ishelper check to adjust the things only for the clones.

and I know this is kinda obvious, but did you swap 718 with your #? As far as I know my clone can't be thrown. If you download it you'll see you cant throw him while he's active (or inactive but that dont count)

Did you add a playerpush? Look into how push blocks work.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Creating clones that act like "full characters"
#19  September 22, 2016, 11:43:33 pm
  • ******
    • www.justnopoint.com/
Yes I changed the number to my number :p

I didn't mess with playerpush because I thought that by default it was enabled. Maybe by default it's disabled with helpers? I'll have to check.
Re: Creating clones that act like "full characters"
#20  September 23, 2016, 01:13:16 am
  • *****
  • Shame on you!
    • USA
Maybe the throw has something to do with the fact the character isn't "solid"?
Could it be that my clone has keyctrl?
vVv Ryuko718 Updated 10/31/22 vVv