======================== Battle Experience System ======================== System created by The Necromancer and SorrowEdge Brought together by Ribeiro Before we start, you must set the persistent variable index. In this explanation, I will use var(40) and above, so it leaves much room for your character to use any other variables. Add this in your character's [Data] section: IntPersistIndex = 40 Variables 40 and above will persist. You may freely copy all of the codes shown in this explanation. (Be sure that credit to SorrowEdge as well as myself is given.) =) ================== Part 1 ================== Displaying Numbers, by creating a Number System ========================================= Number System (for 6/27 version or newer) ========================================= ;--------------------------------------------------------------------------- This is for displaying numbers in mugen. Basically mathematical equations. ;--------------------------------------------------------------------------- 1.) First of all, we need the individual digits, lets say we have a Var(40) that has the value of 359. type = VarRangeSet trigger1 = Time = 0 value = 40 ; Reset the Vars that we need first = 41 last = 43 type = VarSet trigger1 = Time = 0 && Var(40) > 99 ; Make sure Var(40) has 3 digits Var(41) = Floor(Var(40) / 100) ; Take the integer part of the hundredth digit. Var(41) now contains the first digit of our number, 3. type = VarSet trigger1 = Time = 0 && Var(40) > 9 ; make sure Var(0) has 2 digits Var(42) = Floor(Var(40) / 10) - (Var(41) * 10) ; Take the first 2 digits and subtract the first. Var(42) now contains the 2nd, 5. type = VarSet trigger1 = Time = 0 Var(43) = Var(40) - (Var(41) * 100) - (Var(42) * 10) ; Subtract the first and 2nd digits. Var(43) now has the last digit, 9. 2.) Now that we have all 3 digits, we can display them. First, make sure you have the number sprites in the sff. Second, make sure the AIR group numbers are proportional to the numbers, ie. if the sprite "0" has AIR group number 6000 or 7000 or 8920, then the sprite "8" would be 6008 or 7008 or 8928, respectively. Now: type = Explod trigger1 = (whatever) anim = (AIR group number of sprite "0") + Var(41) postype = (whatever) pos = (x), (y) ; Make sure you remember this position type = Explod trigger1 = (whatever) anim = (AIR group number of sprite "0") + Var(42) postype = (whatever) pos = (x) + (width of sprite), (y) ; display after the 1st digit type = Explod trigger1 = (whatever) anim = (AIR group number of sprite "0") + Var(43) postype = (whatever) pos = (x) + (width of sprite) + (width of sprite), (y) ; last position 2.) Please note, this is to simply DISPLAY numbers. It is not to show your current experience. The counting variable, Var(40) is used to trigger character effects. You will use this counting variable for various purposes. 3.) Now, we must also use another variable, to detect if your character is facing to the left, or facing to the right. Put this in state 5900: ;Character Facing Check [State 5900: VarSet] type = VarSet trigger1 = Time = 0 var(14) = IfElse(Facing = 1, 1, -1) This is used to display the number under your character. (See Var(14) in the codes below.) ------------------------------------------------------------------------------------- For the Battle Experience System in DBZ characters, the digits can become very high. (If you want power levels close to the original.) Copy and paste the equations below. ------------------------------------------------------------------------------------- As taken from Piccolo's "Misc" file. (Created by The Necromancer) Variables: Var(40) - Counting Var Var(41) to Var(50) - Digits Var(14) - Character facing Var Animation: Use actions 8000 to 8009. 8000: Number 0 8001: Number 1 8002: Number 2 8003: Number 3 8004: Number 4 8005: Number 5 8006: Number 6 8007: Number 7 8008: Number 8 8009: Number 9 ;--------------------------------------------------------------------------- ;Battle Experience System - Equation ;1st Digit of Number System - Units [State -2: VarSet] type = VarSet trigger1 = TimeMod = 5,0 var(41) = floor(var(40)/1000000000) ;2nd Digit of Number System - Tens [State -2: VarSet] type = VarSet trigger1 = TimeMod = 5,0 var(42) = floor(var(40)/100000000 - var(41) * 10) ;3rd Digit of Number System - Hundreds [State -2: VarSet] type = VarSet trigger1 = TimeMod = 5,0 var(43) = floor(var(40)/10000000 - var(41) * 100 - var(42) * 10) ;4th Digit of Number System - Thousands [State -2: VarSet] type = VarSet trigger1 = TimeMod = 5,0 var(44) = floor(var(40)/1000000 - var(41) * 1000 - var(42) * 100 - var(43) * 10) ;5th Digit of Number System - Ten Thousands [State -2: VarSet] type = VarSet trigger1 = TimeMod = 5,0 var(45) = floor(var(40)/100000 - var(41) * 10000 - var(42) * 1000 - var(43) * 100 - var(44) * 10) ;6th Digit of Number System - Hundred Thousands [State -2: VarSet] type = VarSet trigger1 = TimeMod = 5,0 var(46) = floor(var(40)/10000 - var(41) * 100000 - var(42) * 10000 - var(43) * 1000 - var(44) * 100 - var(45) * 10) ;7th Digit of Number System - Millions [State -2: VarSet] type = VarSet trigger1 = TimeMod = 5,0 var(47) = floor(var(40)/1000 - var(41) * 1000000 - var(42) * 100000 - var(43) * 10000 - var(44) * 1000 - var(45) * 100 - var(46) * 10) ;8th Digit of Number System - Ten Millions [State -2: VarSet] type = VarSet trigger1 = TimeMod = 5,0 var(48) = floor(var(40)/100 - var(41) * 10000000 - var(42) * 1000000 - var(43) * 100000 - var(44) * 10000 - var(45) * 1000 - var(46) * 100 - var(47) * 10) ;9th Digit of Number System - Hundred Millions [State -2: VarSet] type = VarSet trigger1 = TimeMod = 5,0 var(49) = floor(var(40)/10 - var(41) * 100000000 - var(42) * 10000000 - var(43) * 1000000 - var(44) * 100000 - var(45) * 10000 - var(46) * 1000 - var(47) * 100 - var(48) * 10) ;10th Digit of Number System - Billions [State -2: VarSet] type = VarSet trigger1 = TimeMod = 5,0 var(50) = floor(var(40) - var(41) * 1000000000 - var(42) * 100000000 - var(43) * 10000000 - var(44) * 1000000 - var(45) * 100000 - var(46) * 10000 - var(47) * 1000 - var(48) * 100 - var(49) * 10) ;--------------------------------------------------------------------------- ;Battle Experience System - Animation ;1st Digit of Number System - Units [State -2: Explod] type = Explod trigger1 = 1 anim = 8000 + var(41) postype = left pos = ifelse(var(14) = 1, 10, 220),200 ignorehitpause = 1 sprpriority = 13 ownpal = 1 ;2nd Digit of Number System - Tens [State -2: Explod] type = Explod trigger1 = 1 anim = 8000 + var(42) postype = left pos = ifelse(var(14) = 1, 20, 230),200 ignorehitpause = 1 sprpriority = 13 ownpal = 1 ;3rd Digit of Number System - Hundreds [State -2: Explod] type = Explod trigger1 = 1 anim = 8000 + var(43) postype = left pos = ifelse(var(14) = 1, 30, 240),200 ignorehitpause = 1 sprpriority = 13 ownpal = 1 ;4th Digit of Number System - Thousands [State -2: Explod] type = Explod trigger1 = 1 anim = 8000 + var(44) postype = left pos = ifelse(var(14) = 1, 40, 250),200 ignorehitpause = 1 sprpriority = 13 ownpal = 1 ;5th Digit of Number System - Ten Thousands [State -2: Explod] type = Explod trigger1 = 1 anim = 8000 + var(45) postype = left pos = ifelse(var(14) = 1, 50, 260),200 ignorehitpause = 1 sprpriority = 13 ownpal = 1 ;6th Digit of Number System - Hundred Thousands [State -2: Explod] type = Explod trigger1 = 1 anim = 8000 + var(46) postype = left pos = ifelse(var(14) = 1, 60, 270),200 ignorehitpause = 1 sprpriority = 13 ownpal = 1 ;7th Digit of Number System - Millions [State -2: Explod] type = Explod trigger1 = 1 anim = 8000 + var(47) postype = left pos = ifelse(var(14) = 1, 70, 280),200 ignorehitpause = 1 sprpriority = 13 ownpal = 1 ;8th Digit of Number System - Ten Millions [State -2: Explod] type = Explod trigger1 = 1 anim = 8000 + var(48) postype = left pos = ifelse(var(14) = 1, 80, 290),200 ignorehitpause = 1 sprpriority = 13 ownpal = 1 ;9th Digit of Number System - Hundred Millions [State -2: Explod] type = Explod trigger1 = 1 anim = 8000 + var(49) postype = left pos = ifelse(var(14) = 1, 90, 300),200 ignorehitpause = 1 sprpriority = 13 ownpal = 1 ;10th Digit of Number System - Billions [State -2: Explod] type = Explod trigger1 = 1 anim = 8000 + var(50) postype = left pos = ifelse(var(14) = 1, 100, 310),200 ignorehitpause = 1 sprpriority = 13 ownpal = 1 ================== Part 2 ================== Stage and fight tracking 1.) Be sure that your character uses it's own "common1.cns" file. Edit state 5900, and remove the VarRangeSet parameters. Now, all persistent vars will not reset between fights with different opponents. Heh, you can also make intros for the 2nd and 3rd rounds. =D 2.) Now, use a persistent var, to keep track of how many fights you have. To do this, put in this code in state 5900: [State 5900, VarAdd] type = VarAdd trigger1 = 1 v = * ;Must be a persistent var. value = 1 This is so that you can prevent people from fighting way too much, (By pressing the space bar) and getting tons of experience in just one round. I'll explain afterwards. :) 3.) Use the Number System, so that your character will gain points for speed, life, combos, etc... (Exactly like getting a high score.) 4.) When your character reaches a certain score, (Example: 5000) he will be able to use the new techniques. This is where step 3 comes in. You should not only use the score var to gain the new ability, but the fight number var, to make sure that you must at least be a certain stage, (Example: 3) to gain this new ability. You now have a full story mode, when combined with an ending. Heck, you can now have multiple endings, depending on your experience. :) ================== Part 3 ================== Using gained experience to increase your character's status. When gaining experience, your character's attributes can increase. To implement this into parameters such as HitDef's, you'll need to put in some math. Example: [State 200, HitDef] type = HitDef damage = Ceil(20+Var(40)),(5+Var(40)/2) For calculating damage, and time values, you must use either the "Ceiling" function, to round up, or the "Floor" function, to round down, with the values in parenthesis. (In brackets) Put in the math trigger before the integer values. The rest is all basic math. :) As for calculating velocity values, the math trigger is not required. You may use an FVar to do this. ================== Part 4 ================== Now that you've implemented the all the required features in this system, you can add in the last little touches that makes a good storyline. Heh, an ending isn't the only thing that should make a story! You want to make special 1 time scenes, (eg. Piccolo fusing with Nail, during the Freeze Saga.) and gaining bonus points. 1.) First, you'll need a stage marker. This is used to count how many fights you've had. Put this code in state 5900: [State 5900, VarAdd] type = VarAdd trigger1 = RoundNo = 1 v = * ;Must be a persistent var. value = 1 One MAJOR bug in this feature is that if you press F4 in the first round, the marker will think you've progressed into the next fight. 2.) Special scenes: We'll use the scene when Piccolo fused with Nail. Now, this can be an intro, that happens in fight 3, for example. The stage marker will tell us when we are in the 3rd fight. When this happens, Piccolo can fuse with Nail. So, in this example, we'll need to use the trigger: triggerall = Var(*) = 3 ;Stage Marker variable. This is triggered when your character is in the 3rd stage. 3.) Gaining bonus points: Well, it's pretty self explanatory on how to get your basic experience. (Hit the opponent, gain ** points.) Example: [State 200: VarAdd] type = VarAdd trigger1 = MoveHit v = 40 ;Counting variable value = 20 ;Points persistent = 0 ignorehitpause = 1 But, there can be other ways of gaining experience. One way to do this is a Straight Wins Marker. This is used to count how many wins you've made in a row. -You can make a -2 state, to add in a var (VarAdd) whenever you win, and reset (VarSet) whenever you lose. Whenever you win a round, you can use this simple equation to gain experience, depending on the number of fights you've won and the stage you are in: -You can make a -2 state for adding up the points with this formula: triggerall = (Life/2) * ((Stage No.) + (No of Straight Wins)) Alternatively, you can change this formula around as you wish. (This formula does not give too many points, as we wouldn't want to gain experience so easily.)