Programming the remappal

View previous topic View next topic Go down

Programming the remappal

Post by Orion on Mon Nov 20, 2017 9:24 am

Hello again, finally your friend Orion understood the functionality of the main codes, to do so as planned. so let's go to the most anticipated tutorial.

The Remappal code can only be used in versions 1.0 and 1.1 of mugen. it allows the character's palette to be exchanged in full battle (Of course, before the characters fight.)

before you start spending your time doing this, be sure that the char in question is pixilated appropriately.

Let's start with the def file.



Notice that in the def file there should be a line called mugenversion. It is obligatory. It can come in the following ways.

mugenversion = 1.0 (char scheduled for mugen 1.0)
mugenversion = 1.1 (char scheduled for mugen 1.1)

Choose which mode you want to program the char. I usually put 1.1, so I can apply all the source codes you want in the char, and you can save the sff on one  format lighter.

That said let's now go to the cns or st file, where the basic char commands are encoded.



So for you do not get lost, write the 12345 group that we are going to work directly above the state -2 group. if your char does not have this group, you will have to create it. Transcribe the entire group below in file cns ou st of your char. Notice the parts in red that I will comment shortly.

-------------------------------------------------------------------------------------------
;---------------------------------------------------------------------------
;pal select
;---------------------------------------------------------------------------
[Statedef 12345]
physics = N
anim = 12345
velset=0,0
postype = p1
sprpriority=99999

[State 12345, PosSet]
type = PosSet
trigger1 =!time
x = root,facing*-75
y = 0
ignorehitpause = 1

[State 12345, AS]
type=assertspecial
trigger1=1
flag=intro
flag2=noshadow

[State 12345, Reset]
type=varset
trigger1=!time
fvar(38)=200

[State 12345, Pal]
type=varset
trigger1=!time
fvar(36)=root,palno

[State 12345, Varset]
type=varset
trigger1=fvar(36)<1||fvar(36)>12 ; last palette
fvar(36)=1+(fvar(36)<1)*11; subtract -1 from your last palette

[State 12345, PlaySnd]
type = PlaySnd
trigger1 =fvar(39)=2
value = S12345,0
volumescale = 100
channel = 20

[State 12345, PlaySnd]
type = PlaySnd
triggerall=ishelper(12345)
trigger1=root,command="a"||root,command="b"||root,command="c"||root,command="x"||root,command="y"
||root,command="z"||root,command="start"||roundstate=2
value = S12345,1
volumescale = 100
channel = 20
persistent =0

[State 12345, Countdown]
type = VarAdd
trigger1 =1
fvar(38)=-1

[State 12345, Countdown]
type = VarAdd
trigger1=!fvar(39)&&fvar(38)<150
trigger1=root,command="holdup"||root,command="holddown"||root,command="holdback"
||root,command="holdfwd"
fvar(38)=25

[State 12345, Varadd]
type=varadd
trigger1=!fvar(39)
trigger1=root,command="holdup"||root,command="holddown"||root,command="holdback"
||root,command="holdfwd"
fvar(36)=1-(root,command="holddown"||root,command="holdback"&&facing=1
||root,command="holdfwd"&&facing=-1)*2

[State 12345, Varadd]
type=varadd
trigger1=(root,command="holdup"||root,command="holddown"||root,command="holdback"
||root,command="holdfwd")&&!fvar(39)||fvar(39)
fvar(39)=1

[State 12345, Varset]
type=varset
trigger1=!time||fvar(39)>=12
fvar(39)=0

[State 12345, End]
type=destroyself
triggerall=ishelper(12345)
trigger1 = time >= 1000
trigger2=root,command="a"||root,command="b"||root,command="c"||root,command="x"||root,command="y"
||root,command="z"||root,command="start"||roundstate=2
trigger3=root,AILevel
-------------------------------------------------------------------------------------------

x = root,facing*-75

In this line you establish the distance of the sprite assistant of the exchange of pallets. in chars coded with the localcoord = 320,240, as is ours the distance of -75 is ideal. However if you encode it to localcoord = 640,480, you can double the distance, this is -150. Thus, the sprite assistant of player 1 will not touch player 2.



trigger1=fvar(36)<1||fvar(36)>12 ; last palette

In the red part you define the number of palettes the char has. I usually work with 12, but it is possible to work with more. however, the Remappal code only holds the beginning of the round for a maximum of 30 seconds, after the char completes its intros. It is therefore not feasible to make more than 30 palettes.

fvar(36)=1+(fvar(36)<1)*11; subtract -1 from your last palette

In the red part, enter the result of the subtraction of the number of palettes -1. Thus, you prevent the mugen from reading the first palettes 2 times. If the char has 12 palettes, put 11. If you have 30, 29. And so on.

You noticed that the code references a bunch of codes. Leave them for now, let's talk about them when we approach the CMD part. For the hour, type below of the last line of group 12345, the group written below.

;---------------------------------

[Statedef -2]

;------------------------------------
;State -2/remappal
;------------------------------------
[state -2, No Clones]
type = remappal
triggerall=numenemy && (fvar(36)=[1,30]);fvar(36)=the number of pals available
trigger1=fvar(37)&&!numhelper(12345)&&matchno=1&&roundno=1
trigger1=enemy,authorname="??"&&enemy,name="??"&&enemy,fvar(36)=fvar(36)
source = 1, 5
dest = 1, Ifelse(teamside!=1 && enemynear,Numhelper(12345)=0,enemy,fvar(36)+teamside,fvar(36))
ignorehitpause = 1

[state -2, Palette]
type = varset
trigger1 = numhelper(12345)
trigger1=helper(12345),fvar(36)=[1,30]
fvar(36)= helper(12345),fvar(36)
ignorehitpause = 1

[state -2, Palette Selection]
type = remappal
trigger1 = numhelper(12345)
trigger1=helper(12345),fvar(36)=[1,30]
source = 1, 1
dest = 1, floor(fvar(36))
ignorehitpause = 1

[state -2, Continue Palette]
type = remappal
trigger1=fvar(37)&&!AILevel&&matchno>1
source = 1, 5
dest = 1, floor(fvar(36))
ignorehitpause = 1


[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "var(10) = %d damage dampen = %f"
params = var(4),fvar(11)
;ignorehitpause =
;persistent =  
;----------------------------------------------

Ready! We've finished the main part of the programming. Let's go to the common states. Go to group 5900, delete everything and transcribe the codes below.
;--------------------------------------------

;---------------------------------------------------------------------------
; Initialize (at the start of the round)
;---------------------------------------------------------------------------
[statedef 5900]
type = S

[state 5900, Reset Variables]
type = varrangeset
trigger1 = !roundsexisted && matchno = 1
value = 0

[state 5900, Reset Variables]
type = varrangeset
trigger1 = !roundsexisted && matchno = 1
fvalue = 0

; Palette Selector
[State 5900, Palette Selector]
type = VarSet
trigger1 = 1
fv = 37
value = 1

; If value = 1 Palette Selector is ON
; If value = 0 Palette Selector is OFF


[State 5900, Pal Selector on]
type=helper
triggerall = roundsexisted = 0
triggerall=fvar(37)&&!numhelper(12345)&&!AILevel&&numenemy
trigger1= roundno = 1 && matchno=1 && !(teammode = simul) && !(enemy, teammode = simul)
trigger2= !fvar(36)
trigger3=(teammode = turns)
trigger3=!roundsexisted && (enemy,roundsexisted)
id=12345
stateno=12345
facing=facing
ownpal=1
size.xscale = .5
size.yscale = .5

[state 5900, 0]
type = Remappal
trigger1 = !fvar(37)||AILevel
source = 1, 1
dest = 1, palno
ignorehitpause = 1

[State 5900, Intro]
type = ChangeState
trigger1 = roundno = 1
value = 190+random%2

[State 5900, Turns Intro]
type = ChangeState
trigger1 = !RoundsExisted
trigger1 = teammode = Turns
value = 190+random%2

[State 5900, Start round timer if No Intro Available]
type = ChangeState
trigger1 = 1
value = 194
;-----------------------------------

stateno=12345

reference to the animation number of the palette exchange assistant sprite.

value =  194

This number is relative to the char's Intro in the second round. Note which group was in the previous programming and write the number correctly. If the character does not use Intro in the 2 round, enter the number 0.
;--------------------------------

Let's go to the cmd check if some mandatory commands exist in the char. The first group is relative to the attack keys.



Now we are going to the compulsory buttons of the directional keys.



With that we complete the whole programming part. Let's now go to the sff file.



Download: mediafire.com file/wweiqqystewmo09/0.png

List the name of the group as in the above transcript, as well as the position of the X and Y axes.

Let's for the animations.



Create a new frame with the specifications shown in the image. That is, animation number 12345, group name 12345, among other things.

Go back to the settings. If your sff from your char is still in the winmugen format, now is the time to write all the palettes correctly.

Look at the image below.



Save your progress and close the char in the fighter factory. Then open it again and below the palette lines write the following codes.
;-------------------------------------------------------------

;--------------------------------------------------------------------------------------
;Maps character selection buttons to palette numbers.
[Palette Keymap]
a = 1
b = 2
c = 3
x = 4
y = 5
z = 6
a2 = 7
b2 = 8
c2 = 9
x2 = 10
y2 = 11
z2 = 12
;--------------------------------------------------------------------------------------

Save the progress again, and then save the sff format to the version type of mugen you specified in the file def, ie 1.0 or 1.1



Now we go to the sounds file of the char, the snd.





Add two slots
12345,0 - sound of pallet exchange
12345,1 - confirmation of the chosen palette.

Download: mediafire.com file/tc0qgb1r76dvhqe/12345+%280+And1%29.rar

Save your progress and that's it! The remappal was programmed correctly. However, if you did some undue things in the char during programming, your mugen may close when selecting the character.



Relax, it's just a syntax error. It is usually related to adding an extra number that can not be read by a particular code. Go to the specified file line and delete the number that is not part of the programming.



Repeat the process, as often as your mugen ordered. Normally the syntax errors are related to the third zero in the velset code. But in rare cases not. So, delete only what ordered by mugen, as not all black codes are errors. Attention.

After all this process, your char will be correctly encoded for he version 1.0 or 1.1 of mugen.

I hope your friend Orion has helped.

Greetings.
avatar
Orion
5 ESTRELLAS
5 ESTRELLAS

Country : BRASIL

Zodiaco : Capricornio
Mensajes/ Messages : 602
Fecha de inscripción/Registration date : 2015-01-29

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum