News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Palette selection at the start of the round?

Started by PlayerOne, June 15, 2013, 09:09:27 AM

Previous topic - Next topic

PlayerOne

I am currently creating an HD PNG for a palette selector. Also an 8-bit version, I have been getting a lot of requests for that since people still use 1.0. Which I will make public since it's no big deal and I want to give back to the community.  ;D

All of my characters now have RemapPal.

Then later on hopefully I will sprite enough palette selector icons to make it have smooth animation.

Head over to the animation/sprite development page.
http://mugenguild.com/forum/topics/character-palette-selector-round-1-mugen-1-0-1-1-151367.0.html

Seravy

You need to assert the flag intro until a palette is selected.
You need to add or subtract from a variable when a directional key is pressed. You also need to make sure the value remains valid (stays in the 1-max palette number range)
You need to remap to the palette number in the variable.

All of the above need to be done in the minus states, any of them will work.

Something like this :

[State -2]
Type=Assertspecial
Trigger1=roundstate<2
flag=intro

[State -2]
Type=Varadd
Trigger1=command="fwd"
Trigger1=var(21)<yourlastpalette-1
var(21)=1

[State -2]
Type=Varadd
Trigger1=command="back"
Trigger1=var(21)>0
var(21)=-1

[State -2]
Type=Remappal
Trigger1=1
source=1,1
dest=1,var(21)+1


PlayerOne

#2
Spoiler (click to show)
Quote from: Seravy on June 15, 2013, 11:35:20 AM
You need to assert the flag intro until a palette is selected.
You need to add or subtract from a variable when a directional key is pressed. You also need to make sure the value remains valid (stays in the 1-max palette number range)
You need to remap to the palette number in the variable.

All of the above need to be done in the minus states, any of them will work.

Something like this :

[State -2]
Type=Assertspecial
Trigger1=roundstate<2
flag=intro

[State -2]
Type=Varadd
Trigger1=command="fwd"
Trigger1=var(21)<yourlastpalette-1
var(21)=1

[State -2]
Type=Varadd
Trigger1=command="back"
Trigger1=var(21)>0
var(21)=-1

[State -2]
Type=Remappal
Trigger1=1
source=1,1
dest=1,var(21)+1

I am a coding noob so expect a lot of questions here. I will put the code in once I finish the sprite, which should be soon.

Ok so I put the code in and it works, 3 issues though.

1. I can still change my palette even while i'm fighting. I only want it to be able to change at the intro of the first round.
2. How do I assign the sprite to this code so it pops up at my character's feet?
3. How do I assign the sound to go with it? I know how to add .wav sounds to the common.snd file but how would I link it in the code?

Odb718

#3
1. you could add a trigger, something like:
triggerall = anim = [190,allofyourintroanimations]
think there's a roundstate = 0 check too. dont know it off the top of my head.

2. you could place it using the root's position. I think
posset,
x = root, pos x
y = root, pos y + 30
Again, off the top of my head.

3. How ever you change the animations, just use the same triggers to PlaySnd.
vVv Gouken718 vVv SabreTooth718 vVv


PlayerOne

#4
Quote from: Odb718 on June 16, 2013, 07:35:47 AM
Spoiler (click to show)
1. you could add a trigger, something like:
triggerall = anim = [190,allofyourintroanimations]
think there's a roundstate = 0 check too. dont know it off the top of my head.

2. you could place it using the root's position. I think posset, x = root, pos x y = root, pos y + 30
Again, off the top of my head.

3. How ever you change the animations, just use the same triggers to PlaySnd.
You're gonna have to hold my hand on this one lol.

Lets say I want the left/right .snd to highlight a palette to be 300,0 in the common.snd file of mugen.
Then the .snd that I want when I select the palette to be 300,1 in the common.snd file of mugen.
And I want the 1 sprite I am adding to the character be Group,Index     400,0



I'm not gonna be using any animation, it is a static sprite.
I will adjust the position in fighter factory if necessary, I just need this to work properly.

Seravy

1. Add Trigger1=roundstate<2 to the varadds.
2. Use an explod controller, see sctrls.html
3. Use the Playsnd controller. Trigger it on the same triggers you have on the varadds.

A single sprite is still an animation, you have to define one for it, even if it's one frame. You can only use animations in coding, not sprites.

Currently there is no "select palette" button, the round starts when a button is pressed because it's hardcoded into the engine to happen. It's possible to add "start" as a select button but it's somewhat unnecessary when you can start the round by all the other buttons.

PlayerOne

#6
Quote from: Seravy on June 16, 2013, 08:59:31 AM
Spoiler (click to show)
1. Add Trigger1=roundstate<2 to the varadds.
2. Use an explod controller, see sctrls.html
3. Use the Playsnd controller. Trigger it on the same triggers you have on the varadds.

A single sprite is still an animation, you have to define one for it, even if it's one frame. You can only use animations in coding, not sprites.

Currently there is no "select palette" button, the round starts when a button is pressed because it's hardcoded into the engine to happen. It's possible to add "start" as a select button but it's somewhat unnecessary when you can start the round by all the other buttons.
Ok so I have 3 things left to do and here is my progress so far on both of those.

1. The Palette Highlight Sound is not working, I put the triggers from the "fwd" and "back" varadds. The .wav was also put in his .snd file and group/index   256,0

2. Let AI use the palette that was chosen from the fight.def RemapPal. If I choose 2 characters with the current coding I have now they will not fight because the AI palette is not set, it just chooses the default palette and sits there in intro mode forever.

3. Code the animation in the .air file, which should be easy but I want to do that last.

[State -2, Play Highlight Sound]
Type=playsnd
Trigger1=roundstate<2
Trigger1=command="fwd"
Trigger1=command="back"
Trigger1=var(21)>0
Trigger1=var(21)<12-1
Value= S256,0
Volumescale=100
Channel=20


2. Before I start the anim code, am I correct in saying I have to put the .png inside of the character's .air file? Because I don't see any way to activate animation from the .sff with the explod controller.

Seravy

Quote[State -2, Play Highlight Sound]
    Type=playsnd
    Trigger1=roundstate<2
    Trigger1=command="fwd"
    Trigger1=command="back"
    Trigger1=var(21)>0
    Trigger1=var(21)<12-1
    Value= S256,0
    Volumescale=100
    Channel=20
Back AND forward held at the same time is not going to work. You want back OR forward. Either separate it to 2 controllers, use triggerall/trigger1/trigger2, or you can just use the OR operator command="fwd" || command="back"
Also not sure if channel 20 will work if the default number of channels is less than that, and I think it's 8 or 16 something.

Quote
2. Before I start the anim code, am I correct in saying I have to put the .png inside of the character's .air file? Because I don't see any way to activate animation from the .sff with the explod controller.
You put the png into the SFF file. Then you add an animation to the .AIR file while contains one line, that references the group/index of the png in the SFF.

PlayerOne

#8
Quote from: Seravy on June 16, 2013, 10:26:49 PM
Quote
Spoiler (click to show)
[State -2, Play Highlight Sound]
    Type=playsnd
    Trigger1=roundstate<2
    Trigger1=command="fwd"
    Trigger1=command="back"
    Trigger1=var(21)>0
    Trigger1=var(21)<12-1
    Value= S256,0
    Volumescale=100
    Channel=20
Back AND forward held at the same time is not going to work. You want back OR forward. Either separate it to 2 controllers, use triggerall/trigger1/trigger2, or you can just use the OR operator command="fwd" || command="back"
Also not sure if channel 20 will work if the default number of channels is less than that, and I think it's 8 or 16 something.

Quote
2. Before I start the anim code, am I correct in saying I have to put the .png inside of the character's .air file? Because I don't see any way to activate animation from the .sff with the explod controller.
You put the png into the SFF file. Then you add an animation to the .AIR file while contains one line, that references the group/index of the png in the SFF.

[State -2, Play Highlight Sound Left]
Type=playsnd
Trigger1=roundstate<2
Trigger1=command="back"
Value= S256,0
Volumescale=100
Channel=6

[State -2, Play Highlight Sound Right]
Type=playsnd
Trigger1=roundstate<2
Trigger1=command="fwd"
Value= S256,0
Volumescale=100
Channel=6


I believe that is supposed to be correct but I still don't hear the sound.



Current tasks:
Spoiler (click to show)
1. The Palette Highlight Sound is not working, I put the triggers from the "fwd" and "back" varadds. The .wav was also put in his .snd file and group/index   256,0

2. Let AI use the palette that was chosen from the fight.def RemapPal. If I choose 2 characters with the current coding I have now they will not fight because the AI palette is not set, it just chooses the default palette and sits there in intro mode forever.

3. Code the animation in the .air file, which should be easy but I want to do that last.

Odb718

Are you coding everything in state -2 or just have those values there "on accident"?
I'd think doing everything in state 190 would be best. It might be causing some problems.
I should think making the animation would be the easiest thing to do. Even if it's a place holder.
You should also try to post the variables to debug so you can see if your code is working.

Use

[State -2, Clipboard]
type = DisplayToClipboard
trigger1 = 1
text = "Var 21 = %d"
params = var(21)

In Mugen, if you dont see the debug info, press Ctrl+D.
vVv Gouken718 vVv SabreTooth718 vVv


PlayerOne

#10
Quote from: Odb718 on June 17, 2013, 06:30:38 AM
Spoiler (click to show)
Are you coding everything in state -2 or just have those values there "on accident"?
I'd think doing everything in state 190 would be best. It might be causing some problems.
I should think making the animation would be the easiest thing to do. Even if it's a place holder.
You should also try to post the variables to debug so you can see if your code is working.

Use

[State -2, Clipboard]
type = DisplayToClipboard
trigger1 = 1
text = "Var 21 = %d"
params = var(21)

In Mugen, if you dont see the debug info, press Ctrl+D.

I'm putting everything in [state-2].

I'm not experienced with coding in mugen whatsoever, this is my first project. I wish I knew more so I could get the coding done quicker.
But I have to do this step by step.

Update, I got the .snd to play when I used the code like this.

[State -2, Play Highlight Sound Left]
Type=playsnd
Triggerall=roundstate<2
Trigger1=command="back"
Value= S256,0
Volumescale=100
Channel=6

[State -2, Play Highlight Sound Right]
Type=playsnd
Triggerall=roundstate<2
Trigger1=command="fwd"
Value= S256,0
Volumescale=100
Channel=6

[State -2, Play Palette Select Sound]
Type=playsnd
Triggerall=roundstate<2
Trigger1=command="x" || command="y" || command="z" || command="a" || command="b" || command="c"
Value= S256,1
Volumescale=100
Channel=6




Seravy is a little advanced for me in terms of codespeak but when I study it in detail he does know his stuff.  :2thumbsup:

Current tasks:
Spoiler (click to show)
1. The Palette Highlight Sound is not working, I put the triggers from the "fwd" and "back" varadds. The .wav was also put in his .snd file and group/index   256,0

2. Let AI use the palette that was chosen from the fight.def RemapPal. If I choose 2 characters with the current coding I have now they will not fight because the AI palette is not set, it just chooses the default palette and sits there in intro mode forever. Also RemapPal from the button selection doesn't work for me, but it works for Human's Deadpool. I can't decypher how he coded it to do that properly because of all of the variables he has in his coding. So I need a new way.

3. Code the animation in the .air file, which should be easy but I want to do that last.

Seravy

You need to keep the default remappal in state 5900 to set the palette chosen by the AI.
Add Triggerall=AIlevel=0 to the Remappal in -2, so it won't get activated if the AI is playing. (1.0 is required for this)

Pressing any button other than start immediately ends the intro and starts the round as a hardcoded engine feature, so don't use those buttons. The code might not work and even if it does, you wouldn't want to prevent the opponent to select their stuff by starting the round early. Trigger selection on the "start" button only.


PlayerOne

#12
Quote from: Seravy on June 17, 2013, 03:04:10 PM
Spoiler (click to show)
You need to keep the default remappal in state 5900 to set the palette chosen by the AI.
Add Triggerall=AIlevel=0 to the Remappal in -2, so it won't get activated if the AI is playing. (1.0 is required for this)

Pressing any button other than start immediately ends the intro and starts the round as a hardcoded engine feature, so don't use those buttons. The code might not work and even if it does, you wouldn't want to prevent the opponent to select their stuff by starting the round early. Trigger selection on the "start" button only.

Ok so the AI is now allowed to use RemapPal but I am still not, which isn't a problem since I can select it inside the intro. But I would like to have the option available also so it doesn't feel like I half-ass the coding.

As far as the selection to begin the round, the only way to continue is to press a button which is fine with me.
But there are still 2 problems, when 2 AI with this coding are set to fight each other they do not press any buttons during the intro so they do not fight, they just sit in their intro.

So I need a timer that only activates after I stop scrolling through my palettes, this way I can let P2 select his/her palette and let the timer start the round which will kill 2 with birds with 1 stone. Of course I want to be able to edit my timer with "ticks".


Current tasks:
Spoiler (click to show)
1. The Palette Highlight Sound is not working, I put the triggers from the "fwd" and "back" varadds. The .wav was also put in his .snd file and group/index   256,0

2. Let AI use the palette that was chosen from the fight.def RemapPal. If I choose 2 characters with the current coding I have now they will not fight because the AI palette is not set, it just chooses the default palette and sits there in intro mode forever. Also RemapPal from the button selection doesn't work for me, but it works for Human's Deadpool. I can't decypher how he coded it to do that properly because of all of the variables he has in his coding. So I need a new way.

3. Code the animation in the .air file, which should be easy but I want to do that last.

Seravy

"Timer" What you'll need is a variable but yes, you are correct.

You need to set a variable when start is pressed.

[State -2]
Type=varset
Trigger1=command="start"
var(22)=1

You only need to assert the intro flag when this variable is not set and the AI is not playing.

[State -2]
Type=assertspecial
Trigger1=roundstate<2
Trigger1=var(22)=0
Trigger1=Ailevel=0
flag=intro

QuoteBut I would like to have the option available also so it doesn't feel like I half-ass the coding.
In other words, you want to disable the intro palette selection if a button other than the first palette was used to select the character?
In that case, add triggerall=palno=1 to all of the code so it won't work if any other button was used.


PlayerOne

#14
Quote from: Seravy on June 17, 2013, 06:25:55 PM

In other words, you want to disable the intro palette selection if a button other than the first palette was used to select the character?
In that case, add triggerall=palno=1 to all of the code so it won't work if any other button was used.
I meant that I want both to work.
The x,y,z,a,b,c, x2,y2,z2,a2,b2,c2 At the character select screen.
Also the Palette selector at the intro.

I already have RemapPal set in state 5900 but this coding seems to nullify that and always pick the default pal. Which I can then change with.

On second thought there is a more legit feeling when you pick the default palette first no matter what button you press, then you change your pal.

Quote from: Seravy on June 17, 2013, 06:25:55 PM
"Timer" What you'll need is a variable but yes, you are correct.

You need to set a variable when start is pressed.

[State -2]
Type=varset
Trigger1=command="start"
var(22)=1

You only need to assert the intro flag when this variable is not set and the AI is not playing.

[State -2]
Type=assertspecial
Trigger1=roundstate<2
Trigger1=var(22)=0
Trigger1=Ailevel=0
flag=intro

Ok will do, but I don't understand where you want me to put "start" at. Because In order to start the round I have to use the mugen default commands = a,b,c,x,y,z
the "s" or "start" doesn't not work to start the round. Unless you mean that pressing start with the variable "start" will activate the timer in the intro screen?

Seravy

This is how it works :

Round immediately starts when
-a,b,c,x,y or z is pressed for any player
-both players completed their intros (a certain amount of time passed and the intro flag is not asserted)

You don't want the round to start when a palette is selected. Than would mean the other player can't finish selecting their palette.
So you use the start button to set a variable. This variable means that you selected your palette already.
Your character stops asserting the intro flag when the variable is set, meaning that he is ready for the round.
This doesn't immediately start the round, only if the opponent is also not asserting the intro flag. If they are asserting it, that means they are still selecting their palettes or doing their intro, which means they don't want the round to start yet.
If you used buttons a-z, the round would start before the opponent is ready, which is not good in a 2 player game. It doesn't matter against AI, of course.

PlayerOne

Quote from: Seravy on June 17, 2013, 07:29:00 PM
This is how it works :

Round immediately starts when
-a,b,c,x,y or z is pressed for any player
-both players completed their intros (a certain amount of time passed and the intro flag is not asserted)

You don't want the round to start when a palette is selected. Than would mean the other player can't finish selecting their palette.
So you use the start button to set a variable. This variable means that you selected your palette already.
Your character stops asserting the intro flag when the variable is set, meaning that he is ready for the round.
This doesn't immediately start the round, only if the opponent is also not asserting the intro flag. If they are asserting it, that means they are still selecting their palettes or doing their intro, which means they don't want the round to start yet.
If you used buttons a-z, the round would start before the opponent is ready, which is not good in a 2 player game. It doesn't matter against AI, of course.
Ahh ok I see. I changed it to the way you said to but when I press start on a palette it doesn't select the palette, I am still able to cycle through palettes.

As for the the AI it still isn't running on a timer so they both just sit in their infinite palette selecting intros.

Seravy

QuoteAhh ok I see. I changed it to the way you said to but when I press start on a palette it doesn't select the palette, I am still able to cycle through palettes.
You haven't added a check for the variable on the palette selection. You need to make it unavailable if you want it to be so. (triggerall=var(22)!=1)

QuoteAs for the the AI it still isn't running on a timer so they both just sit in their infinite palette selecting intros.
You haven't added triggerall=AIlevel=0 on the assertspecial.

PlayerOne

#18
Quote from: Seravy on June 17, 2013, 08:51:03 PM
QuoteAhh ok I see. I changed it to the way you said to but when I press start on a palette it doesn't select the palette, I am still able to cycle through palettes.
You haven't added a check for the variable on the palette selection. You need to make it unavailable if you want it to be so. (triggerall=var(22)!=1)

QuoteAs for the the AI it still isn't running on a timer so they both just sit in their infinite palette selecting intros.
You haven't added triggerall=AIlevel=0 on the assertspecial.





AI are now able to fight on their own.
the "start" command now functions as an "OK" button to select a palette and wait for opponent, but I can still change palettes until the other player presses "start".

1. How do I make it so I can't use the RemapPal after I press "start" ? I don't understand the "check" variable, never seen that anywhere before.
2. How do I prevent being able to switch palettes after round 1, it seems I can still switch palettes in the intros of round 1-2-3 etc.
3. I am able to switch palettes during the continue screen. I'm guessing when I fix problem 2 this problem should be fixed also? (See below)

3a. Yes
Spoiler (click to show)
3b. No
Spoiler (click to show)

Ok so here is my code so far.
Spoiler (click to show)
[Statedef -2]

[State -2]
Type=varset
Triggerall=var(22)!=1
Trigger1=command="start"
var(22)=1

[State -2, Palette Change For Intro Only]
Type=Assertspecial
Trigger1=roundstate<2
Trigger1=var(22)=0
Trigger1=Ailevel=0
flag=intro

[State -2, Next Palette]
Type=Varadd
Trigger1=roundstate<2
Trigger1=command="fwd"
Trigger1=var(21)<12-1
var(21)=1

[State -2, Previous Palette]
Type=Varadd
Trigger1=roundstate<2
Trigger1=command="back"
Trigger1=var(21)>0
var(21)=-1

[State -2, Palette Selection Enabled]
Type=Remappal
Triggerall=AIlevel=0
Trigger1=roundstate<2
Trigger1=1
source=1,1
dest=1,var(21)+1

[State -2, Play Palette Highlight Sound ]
Type=playsnd
Triggerall=roundstate<2
Trigger1=command="back" || command="fwd"
Value= S700,0
Volumescale=100
Channel=6

[State -2, Play Palette Select Sound]
Type=playsnd
Triggerall=roundstate<2
Trigger1=command="a" || command="b" || command="c" || command="x" || command="y" || command="z" || command="start"
Value= S700,1
Volumescale=100
Channel=6


Seravy

1. Triggerall=Var(22)=0 on the forward/back button check
2. Triggerall=Roundno=1 on the forward/back button check
3. I thought roundstate<2 prevents this, no idea