YesNoOk
avatar

Player Variables (CNS) (Read 22341 times)

Started by JustNoPoint, September 25, 2015, 08:42:08 pm
Share this topic:
Player Variables (CNS)
#1  September 25, 2015, 08:42:08 pm
  • ******
    • www.justnopoint.com/
No full documentation yet. See chars/kfm/kfm.cns for comments on each variable below.
Use Const (*) (Triggers) to read the default values.


Some important ones to note:
In [Size], you can use xscale and yscale to change the width and height of your character. This saves the trouble of scaling every single one of the sprites.
Set up the speeds of the player in [Velocity]
Set the player's downward acceleration -- yaccel in [Movement]

Example:
Code:
[Data]
life = 1000           ;Amount of life to start with
power = 3000          ;Maximum Ultra\Hyper level. Divided by 1000. Default is 3000. 
attack = 100          ;attack power (more is stronger)
defence = 100         ;defensive power (more is stronger)
fall.defence_up = 50  ;Percentage to increase defense everytime player is knocked down
liedown.time = 60     ;Time which player lies down for, before getting up
airjuggle = 15        ;Number of points for juggling
sparkno = 2           ;Default hit spark number for HitDefs
guard.sparkno = 40    ;Default guard spark number
KO.echo = 0           ;1 to enable echo on KO
volume = 0            ;Volume offset (negative for softer)
FloatPersistIndex = 40   ;;Variables with this index and above will not have their values
IntPersistIndex = 60     ;reset to 0 between rounds or matches. There are 60 int variables,
                         ;;indexed from 0 to 59, and 40 float variables, indexed from 0 to 39.
                         ;;If omitted, then it defaults to 60 and 40 for integer and float
                         ;;variables repectively, meaning that none are persistent, i.e. all
                         ;;are reset. If you want your variables to persist between matches,
                         ;;you need to override state 5900 from common1.cns.

[Size]
xscale = 1            ;Horizontal scaling factor.
yscale = 1            ;Vertical scaling factor.
ground.back = 15      ;Player width (back, ground)
ground.front = 16     ;Player width (front, ground)
air.back = 12         ;Player width (back, air)
air.front = 12        ;Player width (front, air)
height = 60           ;Height of player (for opponent to jump over)
attack.dist = 160     ;Default attack distance
proj.attack.dist = 90 ;Default attack distance for projectiles
proj.doscale = 0      ;Set to 1 to scale projectiles too
head.pos = -5, -90    ;Approximate position of head
mid.pos = -5, -60     ;Approximate position of midsection
shadowoffset = 0      ;Number of pixels to vertically offset the shadow
draw.offset = 0,0     ;Player drawing offset in pixels (x, y). Recommended 0,0

[Velocity]
walk.fwd  = 2.4      ;Walk forward
walk.back = -2.2     ;Walk backward
run.fwd  = 4.6, 0    ;Run forward (x, y)
run.back = -4.5,-3.8 ;Hop backward (x, y)
jump.neu = 0,-8.4    ;Neutral jumping velocity (x, y)
jump.back = -2.55    ;Jump back Speed (x, y)
jump.fwd = 2.5       ;Jump forward Speed (x, y)
runjump.back = -2.55,-8.1 ;Running jump speeds (opt)
runjump.fwd = 4,-8.1      ;.
airjump.neu = 0,-8.1      ;.
airjump.back = -2.55      ;Air jump speeds (opt)
airjump.fwd = 2.5         ;.
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       ;Number of air jumps allowed (opt)
airjump.height = 35   ;Minimum distance from ground before you can air jump (opt)
yaccel = .44          ;Vertical acceleration
stand.friction = .85  ;Friction coefficient when standing
crouch.friction = .82 ;Friction coefficient when crouching
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, 20            ;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**

;Default language victory quotes (optional).  **MUGEN 1.0**
;If this section is included, the default language victory quotes must be in English.
[Quotes]
; Up to 100 victory quotes can be specified per language (victory0 - victory99)
victory1 = "You must defeat Tu Shou to stand a chance."
victory2 = "You need a lot of training. Come back in ten years."
victory3 = "You look familiar. Did I see you on TV?"
victory4 = "Your moves are too predictable. You want to learn Kung Fu Palm? It's not for novices."
victory5 = "That was a good workout."
victory6 = "I want to challenge more skilled fighters."
victory7 = "What do you mean my girlfriend is in another temple?"

;Alternate language victory quotes (optional).
;0 or more alternate language sections may be added, preceded by the
;ISO 639-1 code followed by a ".", e.g. "[ja.Quotes]".
;See language setting in mugen.cfg.
[ja.Quotes]
victory1 = "カンフー突き手を破らぬ限り、お前に勝ち目はない!"
victory2 = "十年早いんだぞ"
victory3 = "お前は見覚えがあるな。テレビにでも…?"
victory4 = "お前の動きは見破りやすすぎる。 なに、カンフー突き手が覚えたいんだと? 素人には無理だぞ"
victory5 = "ふー。 いい汗だった"
victory6 = "もっと強い相手に挑戦したい"
victory7 = "なんだと!彼女はここにもいないと?"
 
Last Edit: October 13, 2015, 06:21:19 pm by Odb718
Re: Player Variables
#2  September 25, 2015, 09:32:54 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
It should be noted that defining xscale and yscale will only affect the character's sprites, but not placement of helpers & explods. You can easily circumvent this by using the Ceil & Floor functions while scaling the coordinates by the xscale & yscale values (WinMUGEN & MUGEN 1.0 only, as 1.1 allows float values for Helper/Explod positioning)
Re: Player Variables
#3  September 26, 2015, 03:55:47 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Something else to point out with 1.0 and above is that localcoord and scale will work in tandem.

If you have a character and you set the local coord to 640,480 it will half in size, if you then set the Xscale and Y scale to 0.5 it will become a quarter the size.

This also allows for a trick around hires sparks and FX.

Take your standard res character at 320x240. Use 640,480 as the local coord. This will force scale all the hitsparks sparks (no code required). You then use Xscale and Yscale = 2 to bring the character back up to normal appearance.

Ie you half it, then double it. But the sparks are only affected by the doubling.


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.
Re: Player Variables
#4  September 26, 2015, 05:43:12 pm
  • *****
  • Shame on you!
    • USA
If you do the localcoord trick Cyanide mentioned, you'll have to adjust a few other things. Width [Velocity] [Movement] will all be off a little.
Upgrading a character will take some work, but this is very useful if you're starting fresh.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Player Variables (CNS)
#5  October 13, 2015, 05:03:20 pm
  • *****
  • Shame on you!
    • USA
I have a couple questions that arent really answered anywhere I've seen.

Can you set these during a round? I'm pretty positive the answer's no.

But the real question is, with characters that are scalable, if the end user adjusts the xscale and yscale, how can the rest match the new value?
All of the Movement, Size, and Velocities wont scale.
Trying something like
ground.back = floor(80*const(size.xscale))      ;Player width (back, ground)
Wont work. How can something like this be possible?
 

This is a list of how/what sets the values or affects them.
 I'll try to show what can affect it, what it affects and how to read it, or what it is exactly.
 I dont know all of the ways to change or read the values. Any and all help on this list is appreciated.
[Data]
life = damage, HitFallDamage, Life, Lifeadd, Lifeset, TargetLifeAdd 
power = PowerAdd, PowerSet, TargetPowerAdd, getpower, givepower, poweradd
attack = AttackMulSet
defence =  DefenceMulSet, HitCount
fall.defence_up =
liedown.time = SelfState, TargetState
airjuggle = Juggle air.juggle
sparkno = sparkno
guard.sparkno = guard.sparkno
KO.echo =
volume = StopSnd, volumescale
FloatPersistIndex = 
IntPersistIndex = 

[Size]
xscale = AngleDraw
yscale =  AngleDraw
ground.back =  Width
ground.front = Width
air.back =  Width
air.front = Width
height =
attack.dist = AttackDist, guard.dist
proj.attack.dist =
proj.doscale =
head.pos =
mid.pos =
shadowoffset =
draw.offset = Offset

[Velocity]
walk.fwd  = VelAdd, VelMul, VelSet, velset
walk.back = VelAdd, VelMul, VelSet
run.fwd  = VelAdd, VelMul, VelSet
run.back = VelAdd, VelMul, VelSet
jump.neu = Gravity, HitVelSet, TargetVelAdd, TargetVelSet, VelAdd, VelMul, VelSet
jump.back =
jump.fwd =
runjump.back =
runjump.fwd = 
airjump.neu =
airjump.back =
airjump.fwd =
air.gethit.groundrecover =
air.gethit.airrecover.mul =
air.gethit.airrecover.add =
air.gethit.airrecover.back =
air.gethit.airrecover.fwd =
air.gethit.airrecover.up =
air.gethit.airrecover.down = 

[Movement]
airjump.num =
airjump.height = Gravity, HitVelSet, VelSet
yaccel = Gravity, HitVelSet
stand.friction =
crouch.friction =
stand.friction.threshold =
crouch.friction.threshold =
air.gethit.groundlevel =
air.gethit.groundrecover.ground.threshold =
air.gethit.groundrecover.groundlevel =
air.gethit.airrecover.threshold =
air.gethit.airrecover.yaccel =
air.gethit.trip.groundlevel =
down.bounce.offset =
down.bounce.yaccel =
down.bounce.groundlevel =
down.friction.threshold =
 
[Quotes]
 
[ja.Quotes]
vVv Ryuko718 Updated 10/31/22 vVv
Last Edit: October 13, 2015, 07:56:11 pm by Odb718
Re: Player Variables (CNS)
#6  October 15, 2015, 06:33:46 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
.... They're called constants for a reason. They're constant. They never change.
Re: Player Variables (CNS)
#7  April 21, 2016, 08:27:23 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
It should probably be pointed out that for whatever reason, attack and defence (and possibly others as well) allow for floating point values, not just integers. You should probably never use floating point values for the attack and defence constants, though, despite what this guy's characters might suggest.
Re: Player Variables (CNS)
#8  July 20, 2020, 08:14:29 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
Be informed that Kung Fu Man, who is supposed to use the default values for every constant, is the first one to not achieve this properly.

In Mugen 1.0, there are lots of new constants that have been added to the characters., which are listed in KFM.cns for reference (as posted as example in the first thread)

However, this is not true.
KFM has this value in his constant:
air.gethit.groundlevel = 25           ;Y-position at which a falling player is considered to hit the ground **MUGEN 1.0**

So, any character that has this parameter copied into their CNS without changing it would return this value: Const(movement.air.gethit.groundlevel)=25

Unfortunately, for characters that don't have this parameter added into their CNS, as what will happen in the majority of characters that were ported from Winmugen or that they used a CNS template without this constant, will actually have a different value, because KFM does not use elecbyte's default value.

For any character missing the constant definition in the CNS, they would get this value instead: Const(movement.air.gethit.groundlevel)=10

10 is the true default value for air.gethit.groundlevel unless you have added the specific constant in the CNS, either copied from KFM or modifed by the character creator.

And yes, this constant is used in statedef 5050, which affects the Y position where a character hits ground from fall

Also, Winmugen used the threshold of 25 for the same state 5050, meaning that while KFM 1.0 uses the same value as KFM Winmugen, the engine itself uses a totally different value per default (10).

Thanks Elecbyte!!!
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Last Edit: July 20, 2020, 08:38:42 pm by XGargoyle
Re: Player Variables (CNS)
#9  July 21, 2020, 01:18:36 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Iirc thats because elecbyte messed with alignment on kfm both sprites and air. The 25 adjusts it to work with kfms sprites. It will still cause you grief if you're not aware of it.


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.