YesNoOk
avatar

How to make Pikachu actually go faster? (Read 24362 times)

Started by DNZRX768, May 16, 2023, 02:17:46 pm
Share this topic:
How to make Pikachu actually go faster?
#1  May 16, 2023, 02:17:46 pm
  • *****
  • Hug Pikachus!
    • USA
Looking through New Pikachu's coding. Ran into this piece here:

Code:
[State -2, 4]
type = veladd
triggerall = var(1) > 0
triggerall = vel X > 0
trigger1 = stateno = 20 ; walk
trigger2 = stateno = 50 ; jump
trigger2 = time = 1
trigger3 = stateno = 100 ; run
x = 1

[State -2, 4]
type = veladd
triggerall = var(1) > 0
triggerall = vel X < 0
trigger1 = stateno = 20 ;walk
trigger2 = stateno = 50 ; jump
trigger2 = time = 1
trigger3 = stateno = 105 ; run
trigger3 = time = 1
x = -1

This piece of coding is set to activate when Pikachu is using the Lighting Shield attack. I assume the code is supposed to make Pikachu move faster, but while the code works for jumping forward and backward, and well as the jumping backward motion that happens if you tap the back arrow key twice, the walking and running speeds are the same. So, what I should be doing to actually make Pikachu go faster in all forms of movement?
Hug the Pikachus!

Hug A Pikachu Today!
Re: How to make Pikachu actually go faster?
#2  May 16, 2023, 02:58:34 pm
  • *****
  • Resident Tosspot
  • Pftheh
    • UK
    • plasmoidthunder.neocities.org
It would be easier to implement velocity increases in the states themselves.

Oh, I want a diagram. I fucking love diagrams.
Re: How to make Pikachu actually go faster?
#3  May 17, 2023, 01:19:55 pm
  • *****
  • Shame on you!
    • USA
Do you mean the
[Velocity]
walk.fwd  = 3   
walk.back = -2   
Section??? A lot of chars will use walk or run speed as their base for a multiplier. But like PlasmoidThunder mentioned, it might just be a state by state thing. Depends on how the char is coded.
vVv Gouken718 vVv
Re: How to make Pikachu actually go faster?
#4  May 17, 2023, 01:32:32 pm
  • *****
  • Hug Pikachus!
    • USA
Depends on how the char is coded.

Here is the rest of the -2 state code for context:

Code:
;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------
;Changed Win = 0 to Lose
;Note: Realized that was so friggen' stoopidz x)

[Statedef -2]

;Used as a counter
[State -2, 1]
type = varadd
trigger1 = var(1) > 0
v = 1
value = 1

;Activated the shield explode effect every 8 ticks
[State -2, 2]
type = varadd
trigger1 = var(1) = 8
v = 2
value = 1

;read above
[State -2, 4]
type = varset
trigger1 = var(1) > 8
v = 2
value = 0

;Counter 'til shield expires
[State -2, 4]
type = varadd
trigger1 = var(1) > 8
v = 3
value = 1

;resets var(1)
[State -2, 3]
type = varset
trigger1 = var(1) > 8
v = 1
value = 1

;---------------
[State -2, 5]
type = null;explod
trigger1 = var(2) = 1
anim = 6900
pos = 0,-70
postype = p1
sprpriority = -1
bindtime = 13
ignorehitpause = 1
ownpal = 1
;---------------

[State -2, 4]
type = palfx
trigger1 = var(1) = 1
add = 100,100,100
blink = 1
time = 3

[State -2, 4]
type = veladd
triggerall = var(1) > 0
triggerall = vel X > 0
trigger1 = stateno = 20 ; walk
trigger2 = stateno = 50 ; jump
trigger2 = time = 1
trigger3 = stateno = 100 ; run
x = 1

[State -2, 4]
type = veladd
triggerall = var(1) > 0
triggerall = vel X < 0
trigger1 = stateno = 20 ;walk
trigger2 = stateno = 50 ; jump
trigger2 = time = 1
trigger3 = stateno = 105 ; run
trigger3 = time = 1
x = -1

[State -2, 4]
type = PowerSet
trigger1 = var(1) > 0
trigger1 = Power > 0
value = 0

[State -2, 4]
type = varset
trigger1 = var(3) > 80
trigger1 = Win = 0
v = 1
value = 0

[State -2, 4]
type = varset
trigger1 = var(3) > 80
trigger1 = Win = 0
v = 2
value = 0

[State -2, 4]
type = veladd
trigger1 = var(3) > 80
trigger1 = stateno != 5050
trigger1 = Win = 0
x = -3
y = -3

[State -2, 4]
type = ChangeState
trigger1 = var(3) > 80
trigger1 = stateno != 5050
trigger1 = stateno != 905
trigger1 = Win = 0
value = 5050

[State -2, 4]
type = varset
trigger1 = var(3) > 80
trigger1 = Win = 0
v = 3
value = 1

[State -2, 4]
type = ChangeState
triggerall = var(3) = 1
triggerall = var(1) = 0
triggerall = ctrl = 1
trigger1 = statetype = S
trigger2 = statetype = C
value = 7000
Hug the Pikachus!

Hug A Pikachu Today!
Re: How to make Pikachu actually go faster?
#5  May 17, 2023, 04:34:53 pm
  • ****
  • Formerly DeathScythe
    • Brazil
    • lyricasky.neocities.org
It would be better if you post the states 20 and 100 (walk and run respectively).
Last Edit: May 18, 2023, 02:13:04 pm by DeathScythe
Re: How to make Pikachu actually go faster?
#6  May 18, 2023, 01:56:13 pm
  • *****
  • Hug Pikachus!
    • USA
Code:
;---------------------------------------------------------------------------
;=| Basic Information |=======================================================
;---------------------------------------------------------------------------
;OverRide of Statedef 100
; RUN_FWD
[Statedef 100]
type    = S
physics = S
anim = 100
sprpriority = 1

[State 100, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

;[State 100, 1]
;type = ChangeAnim
;trigger1 = Time = 0
;value = 100

[State 100, 2]
type = AfterImage
trigger1 = Time = 1
time = 2
PalContrast = 220, 220, 120
PalAdd = 100, 100, -64
PalMul = .75, .75, .45

[State 100, 2]
type = AfterImageTime
trigger1 = Time = [2,10000]
time = 2

[State 100, 3]
type = ChangeState
trigger1 = command != "holdfwd"
value = 0

;---------------------------------------------------------------------------
;Override of Statedef 105
; RUN_BACK
[Statedef 105]
type    = A
physics = A
ctrl = 0
anim = 105
sprpriority = 1

[State 105, 1]
type = VelSet
trigger1 = Time = 0
x = const(velocity.run.back.x)
y = const(velocity.run.back.y)

;[State 105, 1]
;type = CtrlSet
;trigger1 = Time = 0
;value = 0

[State 105, 2]
type = AfterImage
trigger1 = Time = 1
time = 2
PalContrast = 220, 220, 120
PalAdd = 100, 100, -64
PalMul = .75, .75, .45

[State 105, 2]
type = AfterImageTime
trigger1 = Time = [2,10000]
time = 2

[State 105, 3]
type = CtrlSet
trigger1 = Time = 2
value = 1

[State 105, 4]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 0

This is what is in New Pikachu's main .cns file

Code:
;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type    = S
physics = S
sprpriority = 0

[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

;---------------------------------------------------------------------------
; RUN_FWD
[Statedef 100]
type    = S
physics = S
anim = 100
sprpriority = 1

[State 100, 1]
type = VelSet
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, 4]
type = ChangeState
trigger1 = command != "holdfwd"
value = 0

;---------------------------------------------------------------------------
; RUN_BACK
[Statedef 105]
type    = A
physics = A
ctrl = 0
anim = 105
sprpriority = 1

[State 105, 1]
type = VelSet
trigger1 = Time = 0
x = const(velocity.run.back.x)
y = const(velocity.run.back.y)

[State 105, 2]
type = CtrlSet
trigger1 = Time = 2
value = 1

[State 105, 3]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 106

;---------------------------------------------------------------------------
; RUN_BACK2 (land)
[Statedef 106]
type    = S
physics = S
ctrl = 0
anim = 47

[State 106, 1]
type = VelSet
trigger1 = Time = 0
y = 0

[State 106, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 106, 3]
type = MakeDust
trigger1 = Time = 2
pos = -5,-2
spacing = 1

[State 106, 4]
type = ChangeState
trigger1 = Time = 7
value = 0
ctrl = 1

This is what is in the common1.cns

Not exactly sure what you are looking for.

Hug the Pikachus!

Hug A Pikachu Today!
Re: How to make Pikachu actually go faster?
#7  May 19, 2023, 12:28:39 pm
  • *****
  • Shame on you!
    • USA
const(velocity   <<<--- these guys.
Look at the top of the cns files.
vVv Gouken718 vVv
Re: How to make Pikachu actually go faster?
#8  May 19, 2023, 02:17:04 pm
  • *****
  • Hug Pikachus!
    • USA
Code:
[Velocity]
walk.fwd  = 6.3
walk.back = -6.2
run.fwd  = 9.6, 0
run.back = -7.5,-3.8
jump.neu = 0,-10.5
jump.back = -5
jump.fwd = 5
runjump.back = -2.55,-8.1
runjump.fwd = 4,-8.1
airjump.neu = 0,-8.1
airjump.back = -2.55,-8.1
airjump.fwd = 2.5,-8.1
air.gethit.groundrecover = -.15,-3.5  ;Velocity for ground recovery state (x, y) **MUGEN 1.0**
air.gethit.airrecover.mul = .5,.2     ;Multiplier for air recovery velocity (x, y) **MUGEN 1.0**
air.gethit.airrecover.add = 0,-4.5    ;Velocity offset for air recovery (x, y) **MUGEN 1.0**
air.gethit.airrecover.back = -1       ;Extra x-velocity for holding back during air recovery **MUGEN 1.0**
air.gethit.airrecover.fwd = 0         ;Extra x-velocity for holding forward during air recovery **MUGEN 1.0**
air.gethit.airrecover.up = -2         ;Extra y-velocity for holding up during air recovery **MUGEN 1.0**
air.gethit.airrecover.down = 1.5      ;Extra y-velocity for holding down during air recovery **MUGEN 1.0**

[Movement]
airjump.num = 1
airjump.height = 35
yaccel = .55
stand.friction = .5
crouch.friction = .5

stand.friction.threshold = 2          ;If player's speed drops below this threshold while standing, stop his movement **MUGEN 1.0**
crouch.friction.threshold = .05       ;If player's speed drops below this threshold while crouching, stop his movement **MUGEN 1.0**
air.gethit.groundlevel = 25           ;Y-position at which a falling player is considered to hit the ground **MUGEN 1.0**
air.gethit.groundrecover.ground.threshold = -20 ;Y-position below which falling player can use the recovery command **MUGEN 1.0**
air.gethit.groundrecover.groundlevel = 10   ;Y-position at which player in the ground recovery state touches the ground **MUGEN 1.0**
air.gethit.airrecover.threshold = -1  ;Y-velocity above which player may use the air recovery command **MUGEN 1.0**
air.gethit.airrecover.yaccel = .35    ;Vertical acceleration for player in the air recovery state **MUGEN 1.0**
air.gethit.trip.groundlevel = 15      ;Y-position at which player in the tripped state touches the ground **MUGEN 1.0**
down.bounce.offset = 0,0            ;Offset for player bouncing off the ground (x, y) **MUGEN 1.0**
down.bounce.yaccel = .4               ;Vertical acceleration for player bouncing off the ground **MUGEN 1.0**
down.bounce.groundlevel = 12          ;Y-position at which player bouncing off the ground touches the ground again **MUGEN 1.0**
down.friction.threshold = .05         ;If the player's speed drops below this threshold while lying down, stop his movement **MUGEN 1.0**

Saw the variables, although I am not sure if changing the numbers here fulfill the intent of the code in the original post.

The intent of the code is to Have Pikachu go faster while the lighting shields are activated (var(1) > 0), not all of the time. Messing with the numbers here probably does not fulfill the intent of the code.
Hug the Pikachus!

Hug A Pikachu Today!
Re: How to make Pikachu actually go faster?
#9  May 19, 2023, 02:28:34 pm
  • *****
  • Resident Tosspot
  • Pftheh
    • UK
    • plasmoidthunder.neocities.org
He wants the velocities to be increased under a specific circumstance, not to modify the base velocities.

As demonstrated in the code you've provided, the base velocities are applied via VelSets; barring the backhop and jumps, which set the velocity once, this occurs every frame and thus overwrites the VelAdds in -2.

Oh, I want a diagram. I fucking love diagrams.
Re: How to make Pikachu actually go faster?
#10  May 19, 2023, 03:00:56 pm
  • *****
  • Shame on you!
    • USA
So, what I should be doing to actually make Pikachu go faster in all forms of movement?
Sorry, this was the original question I was trying to answer. I guess I got confused. I think, now, you mean that while the Lighting Shield attack is active you want him to move faster all the time; No matter what state he's in??
You could probably reduce these two

Code:
    [State -2, 4]
    type = veladd
    triggerall = var(1) > 0
    triggerall = vel X > 0
    trigger1 = stateno = 20 ; walk
    trigger2 = stateno = 50 ; jump
    trigger2 = time = 1
    trigger3 = stateno = 100 ; run
    x = 1
     
    [State -2, 4]
    type = veladd
    triggerall = var(1) > 0
    triggerall = vel X < 0
    trigger1 = stateno = 20 ;walk
    trigger2 = stateno = 50 ; jump
    trigger2 = time = 1
    trigger3 = stateno = 105 ; run
    trigger3 = time = 1
    x = -1
Down to something like this
Code:
    [State -2, 4]
    type = veladd
    triggerall = var(1) > 0
    trigger1 =  time = 1
    x = ifelse (vel x > 0, 1, -1)
This is going to affect EVERY state though. Throws, hitstates, all of it. So you might want to make some triggeralls for the states you don't want to exclude them. Depends on what you're really trying to do. I'm still not 100% certain.

You might want to do
Code:
[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)+var(1)

and make it easy on yourself?? Set var 1 to 0 and to 1 and you should get the same affect. Do the +var(1) to all the VelSets you want to change.
 
vVv Gouken718 vVv
Re: How to make Pikachu actually go faster?
#11  May 20, 2023, 03:18:55 pm
  • *****
  • Hug Pikachus!
    • USA
Just an FYI:

I've managed to get this whole problem solved and will include the fixes in the next update to be released very soon

 I do sincerely think that there was something funky with regards to how the old veladd coding interreacted with the friction coding that MUGEN/IKEMEN uses, seeing on how the problem does not effect any of the states whose type/physics are not set to standing nor crouching.

So, I've bypassed the problem entirely by taking Odb718's suggestion, extrapolate it as necessary, wrote out the needed coding, and ran through it all with testing. The problem is solved and it turns out Odb718's coding suggestions at the end of his previous post proved to be the key to solving this puzzle. So, I do thank him for all of his help, and the help from all of you all.
Hug the Pikachus!

Hug A Pikachu Today!