YesNoOk
avatar

Questions about hypers (Read 523 times)

Started by Trinitronity, June 19, 2012, 12:25:54 pm
Share this topic:
Questions about hypers
#1  June 19, 2012, 12:25:54 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
Hello again,
I'm currently working on a Touhou char, and I already got 5 hypers. Now I need help to code the remaining 4 hypers.
Second Lvl1 Hyper: The third hyper is basically just a scatter shot, where my char scatters stars (I already got the requiered sprites). How can I make it like that, so a char can scatter projectiles or projectile-typed helpers at random directions for a set time? I know, it has something to do with random triggers, but I just can't put my fingers on it...
Third Lvl1/Lvl3 hyper: For these hypers, I want, that my char calls a striker. For the Lvl1 hyper, the striker shoots 2 blasts and after that one laser. For the Lvl3 hyper, the striker and my char shoot blasts at the opponent a few times.Then, the striker does an uppercut and after that, the char shoots a diagonal laser, while the opponent is in the air. While the Lvl3 hyper can be blocked, there's no escape, if you should not block this attack. Again, I could look into an other chars code for the Lvl1 hyper, but the Lvl3 hyper is quite unique.
Could someone help me with this? Thanks in advance!
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Re: Questions about hypers
#2  June 19, 2012, 03:05:19 pm
  • ****
  • Coder and Voice Actor
    • USA
    • Skype - byakuyaownsyou
    • www.youtube.com/vicmigderpaderp

  • Online
Okay question.

Do you want these blasts to be homing?


I have something in mind.. But I kinda need to have that at least  cleared up :P
Re: Questions about hypers
#3  June 19, 2012, 03:25:06 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
Okay question.

Do you want these blasts to be homing?


I have something in mind.. But I kinda need to have that at least  cleared up :P
No, that would be too cheap. I just need regular blasts.
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Re: Questions about hypers
#4  June 19, 2012, 06:13:14 pm
  • ****
  • Coder and Voice Actor
    • USA
    • Skype - byakuyaownsyou
    • www.youtube.com/vicmigderpaderp

  • Online
Alright well first things first. we are going to create a series of helpers.

Im assuming this is a dbz character?

C= Character H1=Helper 1  B1=Blast 1 B2=Blast 2



Now... you can basically use these 3 helpers over and over again.

so to start your coding should look like this.

Code:

[StateDef 710,Call Striker]
type                           = S
movetype                       = A
physics                        = S
juggle                         = 5
poweradd                       = 0
ctrl                           = 0
velset                         = 0,0
anim                           = 195 ; you can change this to any number you like, just make sure you change any other number with the same statedef
sprpriority                    = 0



[State 715, H1]
type                           = Helper
trigger1                       = time=50 ;<--this means that the helper will appear after the parent has been in anim 195 for 50 ticks
id=710
helpertype                     = normal
name                           = "H1"
stateno                        = 715 ; make sure the numbers here, matches the numbers on the helpers statedef
BINDTIME                       = 300
removeongethit                 = 1
pos                            = -10,0
postype                        = p1
sprpriority                    = -4



[State 710, 4]              ;<---This is where your character will go into another state to proceed with the attack
type                           = ChangeState
trigger1                       = animtime=0
value                          = 1232 ;<----Use any number you like here
ctrl                           = 0


;Now for the helper itself



;-------------------------------------------------------------------------------
; h1
[Statedef 715]
type                           = S
movetype                       = A
physics                        = N
juggle                         = 15
airjuggle                      = 15
poweradd                       = 0
velset                         = 0,0
anim                           = 2555 ; you can change this to any number you like, just make sure you change any other number with the same statedef
ctrl                           = 1
sprpriority                    = 4

;Helpers are basically characters themselves so add in explods, projectiles, and any other crap you can think of here.

[State 715, 4]   ;<---This part is optional.. This would be to make the helper go into another state
type                           = ChangeState
trigger1                       = animtime=0
value                          = 717
ctrl                           = 0


[State 718, Destroy]   ;<---Whenever your helper is done doing what it was supposed to do. Put this at the end of its last state
type                           = DestroySelf
trigger1                       = animtime = 0
Re: Questions about hypers
#5  June 19, 2012, 06:40:18 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
Alright well first things first. we are going to create a series of helpers.

Im assuming this is a dbz character?

C= Character H1=Helper 1  B1=Blast 1 B2=Blast 2



Now... you can basically use these 3 helpers over and over again.

so to start your coding should look like this.

Code:

[StateDef 710,Call Striker]
type                           = S
movetype                       = A
physics                        = S
juggle                         = 5
poweradd                       = 0
ctrl                           = 0
velset                         = 0,0
anim                           = 195 ; you can change this to any number you like, just make sure you change any other number with the same statedef
sprpriority                    = 0



[State 715, H1]
type                           = Helper
trigger1                       = time=50 ;<--this means that the helper will appear after the parent has been in anim 195 for 50 ticks
id=710
helpertype                     = normal
name                           = "H1"
stateno                        = 715 ; make sure the numbers here, matches the numbers on the helpers statedef
BINDTIME                       = 300
removeongethit                 = 1
pos                            = -10,0
postype                        = p1
sprpriority                    = -4



[State 710, 4]              ;<---This is where your character will go into another state to proceed with the attack
type                           = ChangeState
trigger1                       = animtime=0
value                          = 1232 ;<----Use any number you like here
ctrl                           = 0


;Now for the helper itself



;-------------------------------------------------------------------------------
; h1
[Statedef 715]
type                           = S
movetype                       = A
physics                        = N
juggle                         = 15
airjuggle                      = 15
poweradd                       = 0
velset                         = 0,0
anim                           = 2555 ; you can change this to any number you like, just make sure you change any other number with the same statedef
ctrl                           = 1
sprpriority                    = 4

;Helpers are basically characters themselves so add in explods, projectiles, and any other crap you can think of here.

[State 715, 4]   ;<---This part is optional.. This would be to make the helper go into another state
type                           = ChangeState
trigger1                       = animtime=0
value                          = 717
ctrl                           = 0


[State 718, Destroy]   ;<---Whenever your helper is done doing what it was supposed to do. Put this at the end of its last state
type                           = DestroySelf
trigger1                       = animtime = 0
Nope, it's NOT a DBZ char, why should I use a DBZ char as a striker for a Touhou char.
Also, it would be helpful, if you could make a comparison between the code and the correspondenting anims...
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Re: Questions about hypers
#6  June 19, 2012, 09:30:26 pm
  • ****
  • Coder and Voice Actor
    • USA
    • Skype - byakuyaownsyou
    • www.youtube.com/vicmigderpaderp

  • Online
Huh? I thought everything here was self exclamatory o_O Do you not understand the way the .air file works or something?
Re: Questions about hypers
#7  June 19, 2012, 10:05:19 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
Huh? I thought everything here was self exclamatory o_O Do you not understand the way the .air file works or something?
That's not it, I just remembered, how the anims of the striker, on what my striker is based of, looked like: jump, idle&shoot and idle&jump.
And don't worry, I know, how a AIR file works.
EDIT: Nevermind, I now could undetstand, the code, that I needed for the third Lvl1 hyper.
Now, there are still 2 problems left...
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Re: Questions about hypers
#8  June 20, 2012, 03:02:31 am
  • ****
  • Coder and Voice Actor
    • USA
    • Skype - byakuyaownsyou
    • www.youtube.com/vicmigderpaderp

  • Online
Which are?
Re: Questions about hypers
#9  June 20, 2012, 07:43:04 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
For example, the scatter shot (second Lvl1 hyper).
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Last Edit: June 20, 2012, 08:33:02 pm by Trinitronity
Re: Questions about hypers
#10  June 21, 2012, 02:07:03 am
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Scatter shot :
1.create as many helpers as you want to fire. You can create them all at once or during a time interval one at a time, spread out by persistent=x, whichever you prefer.
2.generate a random number in the helper's code, store it in a variable
3. set X velocity to cos(your random number*pi/180) and Y to -sin(same). This spreads them to all 360 degrees, if you want only a certain range of angles, limit the random number into that range.
4. If the stuff you shot has a front side (usually it will unless it's just a simple ball shaped thing), you should turn it towards the direction it is moving, using angledraw. The angle is already in the variable you generated, or you can copy the code that turns it to the correct direction matching the velocities from my characters. The latter will work even if it changes directions later.
Example code : My Cirno's 99 Needles spellcard (all directions) or Patchouli's Watergun (forward only), and lots of others.

Striker :
1. Create a helper, it will be the striker
2. Make sure it cannot be hit, or define what should happen to it using a hitoverride if you prefer it to get hit.
3. Make the helper do the stuff you listed as though you were coding a normal character to do the same. It's not any different. A helper is essentially an extra copy of your character with its own state/animation/etc.
4. Use destroyself to remove the helper when done.
...But if you are making a Touhou character, you should have used lots of helpers for your projectiles and know all of this already.
Re: Questions about hypers
#11  June 21, 2012, 10:27:48 am
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
Scatter shot :
1.create as many helpers as you want to fire. You can create them all at once or during a time interval one at a time, spread out by persistent=x, whichever you prefer.
2.generate a random number in the helper's code, store it in a variable
3. set X velocity to cos(your random number*pi/180) and Y to -sin(same). This spreads them to all 360 degrees, if you want only a certain range of angles, limit the random number into that range.
4. If the stuff you shot has a front side (usually it will unless it's just a simple ball shaped thing), you should turn it towards the direction it is moving, using angledraw. The angle is already in the variable you generated, or you can copy the code that turns it to the correct direction matching the velocities from my characters. The latter will work even if it changes directions later.
Example code : My Cirno's 99 Needles spellcard (all directions) or Patchouli's Watergun (forward only), and lots of others.

Striker :
1. Create a helper, it will be the striker
2. Make sure it cannot be hit, or define what should happen to it using a hitoverride if you prefer it to get hit.
3. Make the helper do the stuff you listed as though you were coding a normal character to do the same. It's not any different. A helper is essentially an extra copy of your character with its own state/animation/etc.
4. Use destroyself to remove the helper when done.
...But if you are making a Touhou character, you should have used lots of helpers for your projectiles and know all of this already.
Actually, the other attacks were very basic, even for Touhou char: two laser hyper, one uppercut hyper, one "flying hyper", etc., and they were all using helpers.
There weren't such complicated like projectile scattering or even strikers. Especially the strikers give me the most problems.
I really remember, how I tried to code the third Lvl1 hyper (the first one with the striker). I actually had to figure out the correct positions of everxthing, so it displays correctly.
As a bonus, that striker attack, together with the scatter shot, the team-up hyper and yet another hyper, are the first hypers COMPLETELY coded by MYSELF. Other hypers and 2 of the four specials originally came from another version of the same char (I only used it as a reference, though), which I have turned into the correct standard of RP's Touhou chars, since this char was suposed to be a template char.
Also, your idea of the scatter shot reminds me of the code for the SFX of most of the specials. I'm talking about this:
Code: (mugen)
[State 1100]
type = Explod
trigger1 = AnimElemTime(5) >= 0
trigger1 = Random%2 = 0
anim = 1105 ;+ Random%4
ID = 1105
pos = -6+Random%25,-48+Random%25
postype = p1
bindtime = 1
removetime = -2
ownpal = 1
sprpriority = 5
facing = IfElse(Random%2 = 0, 1,-1)
vfacing = IfElse(Random%2 = 0, 1,-1)
scale = fvar(3), fvar(3)
vel = 0.1*var(1), 0.1*var(2)
accel = 0.01*var(1), 0.01*var(2)
ignorehitpause = 1
trans = add
I hope, that can be edited, so helper going into random directions appear instead of explods affected by gravity.
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Re: Questions about hypers
#12  June 21, 2012, 04:09:01 pm
  • *****
  • Mega Klinklang confirmed
    • USA
    • ricepigeon.webs.com
I hope, that can be edited, so helper going into random directions appear instead of explods affected by gravity.

Since when were explods affected by gravity?

Anyways, yes it can be accomplished with helpers, but you have to replicate the behavior with statecontrollers instead of defining the velocities as parameters to the intial controller that creates the helper, as you would normally use for Explods. What you're looking for is the VelSet controller. When applying acceleration you'll need to apply it in the form of a velocity. Some knowledge of calculus is needed to convert acceleration into velocity but for those that aren't calculus-literate:

Acceleration = 0.001
Velocity = 0.001*time + constant

in other words, the accel parameters of the explod:

[mcode]vel = 0.1*var(1), 0.1*var(2)
accel = 0.01*var(1), 0.01*var(2)[/mcode]

.. need to be rewritten as:

[mcode][State XXX, VS]
type = velset
trigger1 = 1
x = 0.1*var(1)+0.01*var(1)*time
y = 0.1*var(2)+0.01*var(2)*time[/mcode]

Of course if you store time as a separate variable then that can be used as well. Also keep in mind that this uses the var(1) and var(2) values of the helper rather than the player creating the helper.

<<-- Updated 09/14/14

You limit yourself so badly when you try to avoid variables. When you get over your fear of the "complexity" of variables, you will find yourself in a better place: A beautiful world where coding is actually fun.
Last Edit: June 21, 2012, 04:12:27 pm by RicePigeon
Re: Questions about hypers
#13  June 21, 2012, 05:02:40 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
Anyways, yes it can be accomplished with helpers, but you have to replicate the behavior with statecontrollers instead of defining the velocities as parameters to the intial controller that creates the helper, as you would normally use for Explods. What you're looking for is the VelSet controller. When applying acceleration you'll need to apply it in the form of a velocity. Some knowledge of calculus is needed to convert acceleration into velocity but for those that aren't calculus-literate:

Acceleration = 0.001
Velocity = 0.001*time + constant

in other words, the accel parameters of the explod:

[mcode]vel = 0.1*var(1), 0.1*var(2)
accel = 0.01*var(1), 0.01*var(2)[/mcode]

.. need to be rewritten as:

[mcode][State XXX, VS]
type = velset
trigger1 = 1
x = 0.1*var(1)+0.01*var(1)*time
y = 0.1*var(2)+0.01*var(2)*time[/mcode]

Of course if you store time as a separate variable then that can be used as well. Also keep in mind that this uses the var(1) and var(2) values of the helper rather than the player creating the helper.
Tested it out now. The good thing: No error messages.
The bad thing: The stars doesn't move for some reasons...as a bonus, they graphically don't disappear (they stop doing damage by contact, though). Here is the code for the projectile:
Code: (mugen)
[Statedef 2105]
Type = A
Movetype= A
Physics = N
Ctrl = 0
Sprpriority = 5
anim = 2105

[State 2105]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 2105]
type = AngleDraw
trigger1 = 1
scale = 1.5,1.5
ignorehitpause = 1

[State 2105]
type = Trans
trigger1 = 1
trans = addalpha
alpha = 256, 256
ignorehitpause = 1

[State 2105, HitOverride]
type = hitoverride
trigger1 = 1
attr = SCA,AA,AP,AT
time = -1
stateno = 1002
ignorehitpause = 1

[State 2105, hitby]
type = hitby
trigger1 = 1
value = SCA,AP
time = -1

[State 2105]
type = velset
trigger1 = 1
x = 0.1*var(1)+0.01*var(1)*time
y = 0.1*var(2)+0.01*var(2)*time

[State 2105]
type= HitDef
trigger1 = !Movecontact
attr = A, SP
hitflag = MAF
guardflag = MA
damage = ceil(57*(root,fvar(14))), 7
animtype = Medium
air.animtype = Back
ground.type = High
priority = 6, Hit
pausetime = 0, 1
sparkno = S8050*10**(random%4)
guard.sparkno = S9000
sparkxy = -30+random%10,-28+random%10
hitsound   = s1,10
guardsound = s2,0
ground.slidetime = 23
ground.hittime = 23
guard.hittime = 21
air.hittime = 23
guard.ctrltime = 21
airguard.ctrltime = 21
ground.velocity = -8, 0
guard.velocity = -8
air.velocity = -4,-5
airguard.velocity= -4,-5
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
fall = 0
fall.recover = 1
fall.recovertime = 39
air.fall = 1
yaccel = 0.4
envshake.time = 10
envshake.freq = 90
envshake.ampl = 5

[State 2105, ChangeState]
type = changestate
trigger1 = var(0)
value = 1203

[State 2105]
type = DestroySelf
trigger1 = FrontEdgeBodyDist <= -42
When I added a veladd to the velset, they started moving, but not only very slow, but also in both directions... :S
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Re: Questions about hypers
#14  June 21, 2012, 05:36:57 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
You didn't set var(1) and var(2) so you are setting your velocity to 0. Obviously it won't move.
Same goes for your var(0) at your changestate, it's 0 so it never triggers.
Helpers have their own variables, that start as 0 when the helper is created, and you never set them to any other value.
And if you want gravity, use Type=Gravity. And make sure to destroy your projectile when it hits the ground.
Re: Questions about hypers
#15  June 21, 2012, 06:32:12 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
You didn't set var(1) and var(2) so you are setting your velocity to 0. Obviously it won't move.
Same goes for your var(0) at your changestate, it's 0 so it never triggers.
Helpers have their own variables, that start as 0 when the helper is created, and you never set them to any other value.
And if you want gravity, use Type=Gravity. And make sure to destroy your projectile when it hits the ground.
That's odd. The other projectiles have var(0) as well, and the changestate works...
...also, var(1) and var(2) has been used already as well, without set these vars...
Here's an example:
Code: (mugen)
[Statedef 1100]
Type = U
Movetype= A
Physics = N
Anim = 1100
Velset = 0, 0
Ctrl = 0
sprpriority = 1

[State 1001, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 2
value = S100,21

[State 210, PSND]
type = playsnd
trigger1 = time = 0
value = 220,0 ;1100,1
channel = 0

[State 1100, PA]
type = poweradd
trigger1 = time = 0
trigger1 = var(10) = 3
value = -500

[State 1100, ChargeSound]
type = PlaySnd
trigger1 = time = 0
trigger1 = var(10) = 3
value = 3,0

[State 1100, PP]
type = playerpush
trigger1 = time >= 13
value = 0
ignorehitpause = 1

[State 1100]
type = velset
trigger1 = AnimElem = 5
X = 4
Y = -5.7

[State 1100]
type = varrandom
trigger1 = AnimElemTime(5) >= 0
v = 1
range = -30, 15

[State 1100]
type = varrandom
trigger1 = AnimElemTime(5) >= 0
v = 2
range = 70, 110

[State 1100]
type = varset
trigger1 = AnimElemTime(5) >= 0
fvar(3) = 0.6 + 0.01*ceil(Random%21)

[State 1100]
type = Explod
trigger1 = AnimElemTime(5) >= 0
trigger1 = Random%2 = 0
anim = 1105 + Random%4
ID = 1105
pos = -6+Random%25,-48+Random%25
postype = p1
bindtime = 1
removetime = -2
ownpal = 1
sprpriority = 5
facing = IfElse(Random%2 = 0, 1,-1)
vfacing = IfElse(Random%2 = 0, 1,-1)
scale = fvar(3), fvar(3)
vel = 0.1*var(1), 0.1*var(2)
accel = 0.01*var(1), 0.01*var(2)
ignorehitpause = 1
trans = add

[State 210, 2]
type = HitDef
trigger1 = var(6) > 0 || var(3) > 0
trigger1 = var(3)<4+var(4);4
attr = A, SA
animtype  = Hard
priority = 7,hit
damage    = 17+7*(var(10)>1)-4*(var(10)=3), 3;26-8*(var(10)=3), 3
Hitflag = MAF
guardflag = MA
pausetime = 10,12
sparkno = S8015+(random%2)
guard.sparkno = S8030
sparkxy = -30,-50
hitsound   = s1,3
guardsound = s2,0
ground.type = High
ground.slidetime = 25
ground.hittime  = 25
air.hittime = 25
ground.velocity = -1.5-1.0*(var(10)=3),-5-1.0*(var(10)=3)
air.velocity = -1-1.0*(var(10)=3),-5-1.0*(var(10)=3)
fall = 1
fall.recover = 1
getpower = 34*(var(10)!=3),17*(var(10)!=3)
givepower = 17,17
nochainid = 3002
p2facing = 1

[State -2, ComboLimit Add]
type = varadd
trigger1 = movehit = 1
persistent = 0
v = 6
value = -4;-1
ignorehitpause = 1

[State 2502, Hitcount]
type = VarAdd
trigger1 = movecontact = 1
v = 3
value = 1
ignorehitpause = 1

[State 2502, Hitcount]
type = VarAdd
triggerall = movecontact = [1,5]
trigger1 = command = "x" || command = "y" || command = "z"
v = 4
value = 1
;ignorehitpause = 1

[State 2502, reset]
type = Movehitreset
trigger1 = movecontact = 1
ignorehitpause = 1

[State 2502, Hitcount]
type = VarSet
trigger1 = Var(3) >= 6
v = 3
value = 6
ignorehitpause = 1

[State 2502, Hitcount]
type = VarSet
trigger1 = Var(4) >= 3
v = 4
value = 3
ignorehitpause = 1

[State 1100, ChangeState]
type = ChangeState
;trigger1 = AnimTime = 0
trigger1 = time >= 30;45;+10*(var(10)=3)
value = 1101
ctrl = 0
And, in case, if it should help, here's the first part of the var list:
Code: (mugen)
; var(1)  - Used in kfm.cmd for combo condition (updated every tick)
; var(2)  - Used in state 800 (also works elsewhere).
; var(3)  - Miasma Sweep Hit Counter
; var(4)  - Miasma Sweep Max Hit Counter (BUGGED)
; var(5)  - Custom Juggle Points
; var(6)  - Custom Juggle Points
; var(7)  - AI Jump Flag
; var(8)  - Air Dash Identifier

; var(10) - Variation Identifier (for moves with multiple versions)
; var(11) - Recovery "Roll" (Teleport?)
Also, the projectiles don't need to be affected by gravity.
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Re: Questions about hypers
#16  June 21, 2012, 07:20:54 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Quote
Helpers have their own variables, that start as 0 when the helper is created
Each helper has its own. If you create 7 fireball helpers, all 7 has its own var(0), with 7 different values (and all start at 0 first).
If you want to access the player's variables from a helper, you need to use the root redirection for that. Otherwise you are accessing the helper's variable.
Re: Questions about hypers
#17  June 21, 2012, 07:23:15 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
Quote
Helpers have their own variables, that start as 0 when the helper is created
Each helper has its own. If you create 7 fireball helpers, all 7 has its own var(0), with 7 different values (and all start at 0 first).
If you want to access the player's variables from a helper, you need to use the root redirection for that. Otherwise you are accessing the helper's variable.
Okay, now, I think, I understood.
I'll let you know about the results.
EDIT; I have found out, that var(1) and var (2) actually has been set already in the intro states. It looks something like this:
Code: (mugen)
[State 193001]
type = varrandom
trigger1 = 1
v = 1
range = -30, 15

[State 193001]
type = varrandom
trigger1 = 1
v = 2
range = 70, 110
I hope, that varrandom helps as well. Alternatively, I found this in an explod:
Code: (mugen)
vel=-vel x*(.25+random*.001),-vel y*(.25+random*.001)
accel=-vel x*.001,-vel y*.001
If I'm not wrong, then this can be turned for an helper into this:
Code: (mugen)
[State XXX, VS]
type = velset
trigger1 = 1
x = -vel x*(.25+random*.001)+-vel x*.001
y = -vel y*(.25+random*.001)+-vel y*.001
Am I right, or did I forgot something?
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Last Edit: June 21, 2012, 11:05:42 pm by Trinitronity
Re: Questions about hypers
#18  June 23, 2012, 06:06:24 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
Sorry to double-post, but I got a problem with changing the velocity. I tried to change the velocity, so it does NOT use any vars, and it STILL doesn't work. What do I wrong this time?
Code: (mugen)
[Statedef 2105]
Type = A
Movetype= A
Physics = N
Ctrl = 0
Sprpriority = 5
anim = 2105

[State 2105]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 2105]
type = AngleDraw
trigger1 = 1
scale = 1.5,1.5
ignorehitpause = 1

[State 2105]
type = Trans
trigger1 = 1
trans = addalpha
alpha = 256, 256
ignorehitpause = 1

[State 2105, HitOverride]
type = hitoverride
trigger1 = 1
attr = SCA,AA,AP,AT
time = -1
stateno = 1002
ignorehitpause = 1

[State 2105, hitby]
type = hitby
trigger1 = 1
value = SCA,AP
time = -1

[State 2105]
type = velset
trigger1 = 1
x = -vel x*(.25+random*.001)+-vel x*.001
y = -vel y*(.25+random*.001)+-vel y*.001

[State 1201]
type = veladd
trigger1 = 1
X = 0.2 * cos(var(0)*Pi/180)
Y = -0.1 * sin(var(0)*Pi/180)

[State 2105]
type= HitDef
trigger1 = !Movecontact
attr = A, SP
hitflag = MAF
guardflag = MA
damage = ceil(57*(root,fvar(14))), 7
animtype = Medium
air.animtype = Back
ground.type = High
priority = 6, Hit
pausetime = 0, 1
sparkno = S8050*10**(random%4)
guard.sparkno = S9000
sparkxy = -30+random%10,-28+random%10
hitsound   = s1,10
guardsound = s2,0
ground.slidetime = 23
ground.hittime = 23
guard.hittime = 21
air.hittime = 23
guard.ctrltime = 21
airguard.ctrltime = 21
ground.velocity = -8, 0
guard.velocity = -8
air.velocity = -4,-5
airguard.velocity= -4,-5
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
fall = 0
fall.recover = 1
fall.recovertime = 39
air.fall = 1
yaccel = 0.4
envshake.time = 10
envshake.freq = 90
envshake.ampl = 5

[State 2105, ChangeState]
type = changestate
trigger1 = var(0) ;IGNORE THIS. It has got nothing to do with the velocity
value = 1203

[State 2105]
type = DestroySelf
trigger1 = FrontEdgeBodyDist <= -42
NOTE: When I added the veladd, it started moving, but very slowly and in both directions.
Since I took out the vars from the previous version, I doubt, it has something to do with missing variables...
...so, could someone point me to the right direction?
EDIT: Found out, how to change the speed. Now, I just need to solve the problem with the stars going to both directions.
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Last Edit: June 23, 2012, 09:34:14 pm by Trinitronity
Re: Questions about hypers
#19  June 25, 2012, 06:15:42 pm
  • *****
  • Mega Klinklang confirmed
    • USA
    • ricepigeon.webs.com
NOTE: When I added the veladd, it started moving, but very slowly and in both directions.
Since I took out the vars from the previous version, I doubt, it has something to do with missing variables...

It does. I can already see a few errors:

[mcode]
[State 2105]
type = velset
trigger1 = 1
x = -vel x*(.25+random*.001)+-vel x*.001
y = -vel y*(.25+random*.001)+-vel y*.001
[/mcode]

What this code is doing is resetting the velocity every tick. The value of random is different each time, so you're basically applying a random velocity each tick. In order to preserve the value of random for each tick, you need to use a variable

[mcode]
[State 1201]
type = veladd
trigger1 = 1
X = 0.2 * cos(var(0)*Pi/180)
Y = -0.1 * sin(var(0)*Pi/180)
[/mcode]

This code applies acceleration based on what looks like the value of an angle, which is stored in var(0). However, you have nothing inside the state that sets var(0). Plus you have this in conjunction with the velset above, which conflict with each other.

Alternatively, I found this in an explod:
Code: (mugen)
vel=-vel x*(.25+random*.001),-vel y*(.25+random*.001)
accel=-vel x*.001,-vel y*.001
If I'm not wrong, then this can be turned for an helper into this:
Code: (mugen)
[State XXX, VS]
type = velset
trigger1 = 1
x = -vel x*(.25+random*.001)+-vel x*.001
y = -vel y*(.25+random*.001)+-vel y*.001
Am I right, or did I forgot something?

The code for the explod applies a random velocity once and then applies an acceleration. The velset code you posted applies a random velocity every single tick, meaning you'll cause the helper to spontaneously change velocities. Check the trigger for that so that it only applies on the first tick and code the acceleration as a veladd or velmul. In other words:

[mcode][State XXX, VS]
type = velset
t1 = !time
x = -vel x*(.25+random*.001)
y = -vel y*(.25+random*.001)

[State XXX, Accel]
type = veladd
t1 = time
x = -vel x*.001
y = -vel y*.001
[/mcode]

Alternatively, save random into variables and use those variables instead of random




Also, +- should simply be the same as - in those cases.

EDIT: the case of the explod using vel x and vel y is using the velocities of the player than created it. If you want to replicate this in a helper you need to use trigger redirection on the velocities

<<-- Updated 09/14/14

You limit yourself so badly when you try to avoid variables. When you get over your fear of the "complexity" of variables, you will find yourself in a better place: A beautiful world where coding is actually fun.
Last Edit: June 25, 2012, 06:30:30 pm by RicePigeon
Re: Questions about hypers
#20  June 25, 2012, 06:27:52 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
NOTE: When I added the veladd, it started moving, but very slowly and in both directions.
Since I took out the vars from the previous version, I doubt, it has something to do with missing variables...

It does. I can already see a few errors:

[mcode]
[State 2105]
type = velset
trigger1 = 1
x = -vel x*(.25+random*.001)+-vel x*.001
y = -vel y*(.25+random*.001)+-vel y*.001
[/mcode]

What this code is doing is resetting the velocity every tick. The value of random is different each time, so you're basically applying a random velocity each tick. In order to preserve the value of random for each tick, you need to use a variable

[mcode]
[State 1201]
type = veladd
trigger1 = 1
X = 0.2 * cos(var(0)*Pi/180)
Y = -0.1 * sin(var(0)*Pi/180)
[/mcode]

This code applies acceleration based on what looks like the value of an angle, which is stored in var(0). However, you have nothing inside the state that sets var(0). Plus you have this in conjunction with the velset above, which conflict with each other.
Wow, I didn't though about that. Thanks. However, I have now new questions:
Code: (mugen)
[State 193001]
type = varrandom
trigger1 = 1
v = 19
range = 0, (((random)^2)^0.5)
If I want to set the variable into a random positive number, does the above code work?
Thanks in advance!
EDIT: Okay, made a new start, and the stars are still going into both directions...
Code: (mugen)
[Statedef 2105]
Type = A
Movetype= A
Physics = N
Ctrl = 0
Sprpriority = 5
anim = 2105

[State 2105]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 2105]
type = AngleDraw
trigger1 = 1
scale = 1.5,1.5
ignorehitpause = 1

[State 2105]
type = Trans
trigger1 = 1
trans = addalpha
alpha = 256, 256
ignorehitpause = 1

[State 2105, HitOverride]
type = hitoverride
trigger1 = 1
attr = SCA,AA,AP,AT
time = -1
stateno = 1002
ignorehitpause = 1

[State 2105, hitby]
type = hitby
trigger1 = 1
value = SCA,AP
time = -1

[State 2105]
type = varrandom
trigger1 = 1
v = 19
range = 0, 1000

[State 2105]
type = velset
trigger1 = 1
x = 0.1*var(19)+0.01*var(19)
y = 0.2 * cos((.25+random*.005)*Pi/180)+-vel y*.005;-vel y*(.25+random*.005)+-vel y*.005

;[State 2105]
;type = veladd
;trigger1 = 1
;X = 0.2 * cos((.25+random*.005)*Pi/180)
;Y = -0.1 * sin(var(19)*Pi/180)

[State 2105]
type= HitDef
trigger1 = !Movecontact
attr = A, SP
hitflag = MAF
guardflag = MA
damage = 10, 5
animtype = Medium
air.animtype = Back
ground.type = High
priority = 6, Hit
pausetime = 0, 1
sparkno = S8050*10**(random%4)
guard.sparkno = S9000
sparkxy = -30+random%10,-28+random%10
hitsound   = s1,10
guardsound = s2,0
ground.slidetime = 23
ground.hittime = 23
guard.hittime = 21
air.hittime = 23
guard.ctrltime = 21
airguard.ctrltime = 21
ground.velocity = -8, 0
guard.velocity = -8
air.velocity = -4,-5
airguard.velocity= -4,-5
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
fall = 0
fall.recover = 1
fall.recovertime = 39
air.fall = 1
yaccel = 0.4
envshake.time = 10
envshake.freq = 90
envshake.ampl = 5

[State 2105, ChangeState]
type = changestate
trigger1 = var(0)
value = 1203

[State 2105]
type = DestroySelf
trigger1 = FrontEdgeBodyDist <= -42
Is it, because the X position is something different then I thought?
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Last Edit: June 25, 2012, 06:46:27 pm by Trinitronity
Re: Questions about hypers
#21  June 25, 2012, 07:44:09 pm
  • *****
  • Mega Klinklang confirmed
    • USA
    • ricepigeon.webs.com
Wow, I didn't though about that. Thanks. However, I have now new questions:
Code: (mugen)
[State 193001]
type = varrandom
trigger1 = 1
v = 19
range = 0, (((random)^2)^0.5)
If I want to set the variable into a random positive number, does the above code work?
Thanks in advance!

I'm not sure what you're trying to accomplish here. You're using a random within a varrandom range. I'm even sure if Mugen accepts that. But basically the way it works is like this: You specify the range of values you want the var to take and it will randomly choose an interger value within that range. For example:

[mcode]
[State 193001]
type = varrandom
trigger1 = 1
v = 19
range = 100, 200[/mcode]

The above will randomly set var(19) to any value between 100 and 200, inclusively.

Quote
EDIT: Okay, made a new start, and the stars are still going into both directions...
Code: (mugen)
[State 2105]
type = varrandom
trigger1 = 1
v = 19
range = 0, 1000

[State 2105]
type = velset
trigger1 = 1
x = 0.1*var(19)+0.01*var(19)
y = 0.2 * cos((.25+random*.005)*Pi/180)+-vel y*.005;-vel y*(.25+random*.005)+-vel y*.005
Is it, because the X position is something different then I thought?

X pos has nothing to do with it. Rather, it has to do with the way you set up your triggers for your varrandom. You're basically applying a new velocity every tick instead of setting it once and applying acceleration. Also, I take it that the vel x and vel y were copied from the explod's code? Use trigger redirection on those for the parent.

In order to better illustrate what I'm talking about, consider the following:

[mcode]
[State XXX VS]
type = varrandom
trigger1 = 1
v = 10
range = 0,10

[State XXX, VS]
type = velset
trigger1 = 1
x = var(10)
[/mcode]

Mugen goes through each controller in order from top to bottom. Trigger1 = 1 means that it will execute on every tick (time). First it will set the variable to a random value and then apply that value as its x velocity. On the second tick, it'll see that the trigger equates to true, and then will apply a completely new random value to the variable, and apply that as the velocity. This will keep going over and over.

<<-- Updated 09/14/14

You limit yourself so badly when you try to avoid variables. When you get over your fear of the "complexity" of variables, you will find yourself in a better place: A beautiful world where coding is actually fun.
Last Edit: June 25, 2012, 07:58:29 pm by RicePigeon
Re: Questions about hypers
#22  June 25, 2012, 08:54:44 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
In order to better illustrate what I'm talking about, consider the following:

[mcode]
[State XXX VS]
type = varrandom
trigger1 = 1
v = 10
range = 0,10

[State XXX, VS]
type = velset
trigger1 = 1
x = var(10)
[/mcode]

Mugen goes through each controller in order from top to bottom. Trigger1 = 1 means that it will execute on every tick (time). First it will set the variable to a random value and then apply that value as its x velocity. On the second tick, it'll see that the trigger equates to true, and then will apply a completely new random value to the variable, and apply that as the velocity. This will keep going over and over.
Thanks, I only have one question: If the Y value in velset has NOT been set, will MUGEn just use a random Y value, or do I have to put y=random manually?
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns
Re: Questions about hypers
#23  June 26, 2012, 12:01:50 am
  • ******
  • I hang out tough. I'm a real boss.
    • USA
    • litotichues.com/
The omission of any of the two parameters of a velset state controller has no effect on whatsoever parameter is omitted. You can test something as simple as that on your own.

Also, it wouldn't hurt to just indagate random stuff in the docs folder of Mugen. =p
Re: Questions about hypers
#24  June 26, 2012, 09:11:10 pm
  • *****
  • Back to the Beginnings
    • Skype - trinitro.man

  • Online
Thanks for all the help.
Also, in order to NOT ask stupid quetions anymore, I'll look more into the code of example works.
I just did it not enough, because of me fearing, that it would have only "stolen stuff".
This thread is now solved at the moment.
I make characters RP-styled (Current WIP: Marisa):
http://mugenguild.com/forum/topics/marisarp-150600.0.html
Touhou database (by Ryouchi):
http://mugenfreeforall.com/index.php?/topic/8257-touhou-project/
you are all small and can't grow manly sideburns