YesNoOk
avatar

Spawning Clones and Stopping with Var (Read 2212 times)

Started by shadowhand23, December 20, 2018, 07:33:40 pm
Share this topic:
Spawning Clones and Stopping with Var
New #1  December 20, 2018, 07:33:40 pm
  • ***
  • Been Burning S#$t since 94
I'm creating a move for one of my characters where he summons controllable clones for a set period of time. These clones can deal damage to the  opponent, but they can be kill if they are hit only once by the opponent. As soon as the clones are killed, another is spawned and this happens for a set period of time before no more clones can be spawned and the fight continues as normal. After trying to set this up using a Var, my mugen crashes without warning. Can someone help me to see if I have things working in order? Here is the code below.

;----------------------------------------------------
;Summon exact copy of playable clones
;----------------------------------------------------

[statedef 95673]  <========== State of the move that spawns clones
type = S
ctrl = 0
movetype = I
physics = N
anim = 95673

[State 0, Doppleganger timer]    <============ Varset timer for the  clones to last while spawned
type = Varset
trigger1 = animelem = 1
trigger2 = time >=800
var(29)= 1
ignorehitpause = 1
persistent = 0


[State 95673, Helper]
type = Helper
triggerall = var(29) = 1
trigger1 = numhelper(127) < 2 ;How many clones can be onscreen at a time
trigger1 = gametime%10 = 0          ;Spawn rate (how fast they spawn)
trigger2 = numhelper(127) = 0      ;0 = Autospawn when clone is defeated, -1 = no Auto spawn when clone is defeated
helpertype = player
name = "Mind Clones"
ID = 127
stateno = 83645
pos = random%200 - random%200,0  <======= Makes the Clones drop onto a random position
postype = p1
facing = 1
keyctrl = 1
ownpal = 1

[State 0, End]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------
;Clones of Player
;---------------------------------------------------------------------
[statedef 83645]


[state 83645]
type = lifeset
trigger1 = 1
value = 1       <================= Max Health for clone. Increase for more

[State 95673, PosSet]
type = PosSet
trigger1 = parent,screenpos x <= 150
x = random%200
y = -300


[state 83645]
type = changestate
trigger1 = life > 0
value = 100019   <==========Clones fall from the sky

[State 83645, DestroySelf]
type = DestroySelf
triggerall = numhelper(127)
trigger1 = root,stateno != 95673
trigger2 = root,var(29) = 1    <========= Suppose to stop when Varset reaches end of timer

Last Edit: December 23, 2018, 04:45:01 pm by shadowhand23
Re: Spawning Clones and Stopping with Var
#2  December 20, 2018, 08:07:17 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Does the player stay in State 95673 throughout the duration of this move?

If the player changes states before the Var triggers... it simply won't trigger :P

Also, the very last controller has triggerall = numhelper(127) which should instead be parent,numhelper(127).
However, I don't think this is a necessary trigger at all and should be outright removed.


You may want to instead spawn an invisible Helper, that then spawns the controllable helpers.  It would not need the "animelem = 1" trigger (only time based).
Then in the controllable helpers, change "root,var(29)" to "parent,var(20)"

Re: Spawning Clones and Stopping with Var
#3  December 20, 2018, 08:44:44 pm
  • ***
  • Been Burning S#$t since 94
Does the player stay in State 95673 throughout the duration of this move?

If the player changes states before the Var triggers... it simply won't trigger :P

Also, the very last controller has triggerall = numhelper(127) which should instead be parent,numhelper(127).
However, I don't think this is a necessary trigger at all and should be outright removed.


You may want to instead spawn an invisible Helper, that then spawns the controllable helpers.  It would not need the "animelem = 1" trigger (only time based).
Then in the controllable helpers, change "root,var(29)" to "parent,var(20)"

Yes the character last the entire duration, I made sure of that by increasing the animation times. (max ticks 814). Ok so let me see if I understand this order, please correct me if I didn't fully understand.

1. In my main character state, create a invisible helper
2. In the invisible helper state, create the playable clone helpers and the Varset Timer
3. In the clone helper state make them destroyself, when the invisible helper's varset reaches 0

now here is what I'm trying to achieve

1. Main character creates clones of himself that has access to the cmd file, while also being the spawn point for the clones
2. Main character Spawns playable clones at a set amount of time, before leaving the clone spawn state.
3 Clones can only get hit once, before dying and fading away, and then stop spawning completely after The main character leaves spawning state
4. Main character can change state if any of the clones defeats the enemy
Re: Spawning Clones and Stopping with Var
#4  December 20, 2018, 10:50:20 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
1. Main character creates clones of himself that has access to the cmd file, while also being the spawn point for the clones
If you need any help with this aspect, I can't help really as I'm not sure what's necessary for the clones to be controllable.  Someone else will have to assist on this part.

2. Main character Spawns playable clones at a set amount of time, before leaving the clone spawn state.
Spoiler, click to toggle visibilty

3 Clones can only get hit once, before dying and fading away, and then stop spawning completely after The main character leaves spawning state
Code:
[State 83645, DestroySelf]
type = DestroySelf
trigger1 = StateType = H
trigger2 = root,stateno != 95673
trigger3 = root,Time >= 800

4. Main character can change state if any of the clones defeats the enemy
Code:
[State 0, End]
type = changestate
trigger1 = animtime = 0
trigger2 = numhelper(127)
trigger2 = helper(127),movecontact
trigger2 = roundstate = 3
value = 0
ctrl = 1

Re: Spawning Clones and Stopping with Var
#5  December 21, 2018, 01:36:49 am
  • ******
    • www.justnopoint.com/
Re: Spawning Clones and Stopping with Var
#6  December 21, 2018, 07:04:23 am
  • ***
  • Been Burning S#$t since 94

I can't help really as I'm not sure what's necessary for the clones to be controllable.  Someone else will have to assist on this part.

You may want to check out my Piccolo as he creates clones that do a number of things.
http://network.mugenguild.com/balthazar/char_piccolo.html

@AltoidDealer - I figured it out how to control the clones. I changed the helper type to "player" which allows access to the -1,-2,-3  states and gave it keyctrl = 1 which  also give access to the cmd file. in the cmd file, i added this trigger "triggerall = !ishelper" in all the commands that I don't want the clones to have access to. I only want them to have basic attacks and not use supers or specials as their only job is to distract, while the main character just sits back, spawns them while he heal himself at the same time. The problem I have now I cant figure out is:

1. The clones have access to the main player's 5150 state. I have a trans code there that fades the clones out while they are on the ground. Because they share the same state (5150) as the Main, the main character also fades out like the clones when he is defeated instead of just dying and lying on the ground without fading away as normal.

2. When the helper type is "Normal" I cant for the life of me  get the damn things to turn around to face p2. they just face straight ahead no matter if they are behind the enemy or not. I reasearched and I found a similar post with the same issue, and I think the answer was to use the turn code. That doesn't work as the only way I could get the clones to turn was to keep them in helper type "Player". Is there a way to get them to turn while they are in helper type "normal"? because i'm starting to think my crashing issues might have something to do with the helper type being player instead of normal.


@Just No Point - Hey I downloaded this character about a year or so ago when I had a crappy computer and couldn't play mugen like I wanted! I personally think it is the best piccolo out. I will most definitely downloaded him again. Ill keep you guys updated


EDITED AND UPDATED




3 Clones can only get hit once, before dying and fading away, and then stop spawning completely after The main character leaves spawning state
Code:
[State 83645, DestroySelf]
type = DestroySelf
trigger1 = StateType = H
trigger2 = root,stateno != 95673
trigger3 = root,Time >= 800

I tried using that in the clone state, but it didn't work I just got an error then crash. I tried this:

[State -3, DestroySelf]
type = DestroySelf
triggerall = ishelper(127)
trigger1 = parent,stateno != 95673
trigger2 = winko


and it worked as intended, but i'm still unable to find out the reason for the random crash during gameplay when using the move that spawns the clones. The crashing seems to occur when the clone is attacking, then all of a sudden BAM! crash no error message, just straight to desktop.


Last Edit: December 21, 2018, 11:58:10 am by shadowhand23
Re: Spawning Clones and Stopping with Var
#7  December 21, 2018, 03:36:12 pm
  • ******
    • www.justnopoint.com/
Last Edit: December 21, 2018, 03:41:37 pm by Just No Point
Re: Spawning Clones and Stopping with Var
#8  December 21, 2018, 04:26:06 pm
  • ***
  • Been Burning S#$t since 94
Helpers cannot access -2 and -3. Only -1 using keyctrl = 1 like you did

I’d also use hitoverride to make the char go to a death state
http://mugenguild.com/forum/topics/hitoverride-sctrl-170151.0.html

Ah I see I thought all negative states where available. Thanks you for clearing that up. Hmmm I never thought to use a hit override! I use that alot for my super/regular counter moves to go into another state, but I've never done it to go to death state to where it work exactly like the Main Character's death state. How exactly would I code that to mimic the knockdown, hit ground, then lie there dead animation? would it be something like this?

Example:

[Statedef 8210]  <========== State of Move
type = S
movetype = I
physics = S
ctrl = 0
anim = 8210
velset = 0, 0
sprpriority = -90

[State 0, 1 Hit Override]
type = HitOverride
trigger1 = Time >= 0
slot = 7
Stateno = 8675309 (Just for example)    <========== State to go to after being hit
attr = SCA, NP, SP, HP
ignorehitpause = 1

;---------------------------------------------------------------------------
;Dying after hit
;---------------------------------------------------------------------------
[Statedef  8675309]    <========= State from hit override
type = S
movetype = A
physics = S
ctrl = 0
anim = 8675309
facep2 = 1
velset = 0, 0
sprpriority = 1

[State 5120, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 5150        <================== Death State
ctrl = 1
Last Edit: December 21, 2018, 04:53:56 pm by shadowhand23
Re: Spawning Clones and Stopping with Var
#9  December 21, 2018, 06:53:53 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
I'm not too savvy with HitOverride, but in State 5150 you could just include the IsHelper trigger in your trans code to prevent Player 1 from also fading away.

You may need to also include a DestroySelf controller in State 5150?

Re: Spawning Clones and Stopping with Var
#10  December 21, 2018, 07:52:19 pm
  • ***
  • Been Burning S#$t since 94
I'm not too savvy with HitOverride, but in State 5150 you could just include the IsHelper trigger in your trans code to prevent Player 1 from also fading away.

You may need to also include a DestroySelf controller in State 5150?

I should give that a try since I used Ishelper in other places. I'll give both methods a try and see how it goes. I'll keep you guys updated

UPDATE:

Ok that worked exactly how I wanted it, now I just gotta figure out why my clones are not dying on one hit, even though I have the "Lifeset" trigger set to one. The only way I can get the clones to die is if I jump and they get hit out of the air, but if I'm standing on the ground, I can hit them multiple times and they wont die. I can hear the K.O scream but they are still standing.

Just one more quick question, how would I go about temporally disabling access to specific special moves in the Cmd file for the Main character during the duration of a "Time Stop" super, and then giving access back when the super has ended without using a Var? I know for the helper I just use the "ishelper" trigger, but I cant remember how to do it for the Main character without it acting a little wonky.
Last Edit: December 22, 2018, 12:19:43 am by shadowhand23
Re: Spawning Clones and Stopping with Var
#11  December 22, 2018, 05:10:28 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Just one more quick question, how would I go about temporally disabling access to specific special moves in the Cmd file for the Main character during the duration of a "Time Stop" super, and then giving access back when the super has ended without using a Var? I know for the helper I just use the "ishelper" trigger, but I cant remember how to do it for the Main character without it acting a little wonky.
triggerall = StateNo != [XXXX,XXXX]
?

Re: Spawning Clones and Stopping with Var
#12  December 22, 2018, 10:39:29 am
  • ***
  • Been Burning S#$t since 94
Just one more quick question, how would I go about temporally disabling access to specific special moves in the Cmd file for the Main character during the duration of a "Time Stop" super, and then giving access back when the super has ended without using a Var? I know for the helper I just use the "ishelper" trigger, but I cant remember how to do it for the Main character without it acting a little wonky.
triggerall = StateNo != [XXXX,XXXX]
?

That didn't work, for what I'm trying to do since after I do the time stop, the character goes into state 0 so I can move around and perform other moves. Think a Var might be the only way to go. Trying to make it similar to DIO, where he freezes time, move around and perform attacks, and then when times up he performs a little pose and time starts again.