YesNoOk
avatar

Palette selection at the start of the round? (Read 1507 times)

Started by PlayerOne, June 15, 2013, 09:09:27 am
Share this topic:
Palette selection at the start of the round?
New #1  June 15, 2013, 09:09:27 am
  • **
  • PlayerOneShow
    • USA
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
Last Edit: June 21, 2013, 09:41:34 pm by Flawless
Re: Palette selection at the start of the round?
#2  June 15, 2013, 11:35:20 am
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
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

Re: Palette selection at the start of the round?
#3  June 16, 2013, 02:30:37 am
  • **
  • PlayerOneShow
    • USA
Spoiler, click to toggle visibilty

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?
Last Edit: June 16, 2013, 02:54:41 pm by Flawless
Re: Palette selection at the start of the round?
#4  June 16, 2013, 07:35:47 am
  • ***
    • USA
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.
           
Last Edit: June 16, 2013, 08:00:19 am by Odb718
Re: Palette selection at the start of the round?
#5  June 16, 2013, 08:02:28 am
  • **
  • PlayerOneShow
    • USA
Spoiler, click to toggle visibilty
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.
Last Edit: June 16, 2013, 08:20:22 am by Flawless
Re: Palette selection at the start of the round?
#6  June 16, 2013, 08:59:31 am
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
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.
Re: Palette selection at the start of the round?
#7  June 16, 2013, 09:46:41 pm
  • **
  • PlayerOneShow
    • USA
Spoiler, click to toggle visibilty
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.

Code:
[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.
Last Edit: June 17, 2013, 06:00:16 am by Flawless
Re: Palette selection at the start of the round?
#8  June 16, 2013, 10:26:49 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
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.
Re: Palette selection at the start of the round?
#9  June 17, 2013, 05:08:46 am
  • **
  • PlayerOneShow
    • USA
Quote
Spoiler, click to toggle visibilty
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.

Code:
[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 toggle visibilty
Last Edit: June 17, 2013, 08:28:22 am by Flawless
Re: Palette selection at the start of the round?
#10  June 17, 2013, 06:30:38 am
  • ***
    • USA
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.
           
Re: Palette selection at the start of the round?
#11  June 17, 2013, 07:33:23 am
  • **
  • PlayerOneShow
    • USA
Spoiler, click to toggle visibilty

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.

Code:
[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 toggle visibilty
Last Edit: June 17, 2013, 05:53:40 pm by Flawless
Re: Palette selection at the start of the round?
#12  June 17, 2013, 03:04:10 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
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.

Re: Palette selection at the start of the round?
#13  June 17, 2013, 05:58:17 pm
  • **
  • PlayerOneShow
    • USA
Spoiler, click to toggle visibilty

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 toggle visibilty
Last Edit: June 17, 2013, 06:06:38 pm by Flawless
Re: Palette selection at the start of the round?
#14  June 17, 2013, 06:25:55 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
"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

Quote
But 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.

Re: Palette selection at the start of the round?
#15  June 17, 2013, 06:28:30 pm
  • **
  • PlayerOneShow
    • USA

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.

"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?
Last Edit: June 17, 2013, 06:51:25 pm by Flawless
Re: Palette selection at the start of the round?
#16  June 17, 2013, 07:29:00 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
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.
Re: Palette selection at the start of the round?
#17  June 17, 2013, 07:52:05 pm
  • **
  • PlayerOneShow
    • USA
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.
Re: Palette selection at the start of the round?
#18  June 17, 2013, 08:51:03 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Quote
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.
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)

Quote
As 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.
Re: Palette selection at the start of the round?
#19  June 18, 2013, 02:41:49 am
  • **
  • PlayerOneShow
    • USA
Quote
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.
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)

Quote
As 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 toggle visibilty
3b. No
Spoiler, click to toggle visibilty

Ok so here is my code so far.
Spoiler, click to toggle visibilty
Last Edit: June 18, 2013, 08:40:39 am by Flawless
Re: Palette selection at the start of the round?
#20  June 19, 2013, 01:44:14 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
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

Re: Palette selection at the start of the round?
#21  June 19, 2013, 08:17:12 pm
  • **
  • PlayerOneShow
    • USA
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

I figured it out, I was on the computer for 21 hours straight learning about variables and state controllers.
I got lucky and found a brief tutorial on how to make a selector by "20S"
Good thing you helped me out though or I would never have been able to decode. I also took some coding from yours to edit with this one. Here are the codes.

Animation coding.
Spoiler, click to toggle visibilty

Palette State -2 Coding
Spoiler, click to toggle visibilty

But I am getting this wierd error.
Spoiler, click to toggle visibilty


Last Edit: June 19, 2013, 08:37:21 pm by Flawless
Re: Palette selection at the start of the round?
#22  June 19, 2013, 08:37:05 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
Do you have "s" defined as a command? We have been using "start" before.
Re: Palette selection at the start of the round?
#23  June 19, 2013, 08:39:15 pm
  • **
  • PlayerOneShow
    • USA
Do you have "s" defined as a command? We have been using "start" before.
yea "s" is defined, if you scroll to the right of that long piece of code you will see it, should I change it to start? This code should work in theory. Just found out that POTS uses "start" instead of "s", so I replaced it in the state 256 def.

The thing is I have no idea what root means. I've looked online and I can't find the subtext for it.
Found out.

Also how would I use angledraw coding to resize the animation. The sprite is too big for the screen and I need to scale it down to .5,.5

Here is my code regarding the animation

Code:
[Statedef 256]
physics = N
anim = 256
velset=0,0
sprpriority=99999
 
[State 256, PosSet]
type = PosSet
trigger1 =!time
x = root,facing*-90
y = 25
ignorehitpause = 1
Last Edit: June 19, 2013, 09:28:04 pm by Flawless
Re: Palette selection at the start of the round?
#24  June 19, 2013, 09:42:38 pm
  • ****
    • Hungary
    • seravy.x10.mx/Wordpress
That's all, nothing special :

[State 256]
Type=angledraw
Trigger1=1
scale=0.5,0.5

(1 is the number for the logical value "true", so writing 1 as the trigger means it's always going to get activated)
Re: Palette selection at the start of the round?
#25  June 21, 2013, 01:54:27 am
  • **
  • PlayerOneShow
    • USA
That's all, nothing special :

[State 256]
Type=angledraw
Trigger1=1
scale=0.5,0.5

(1 is the number for the logical value "true", so writing 1 as the trigger means it's always going to get activated)
Ok I finished editing Typhoon's coding with your teachings and my finishing touch, I've decided to do a full animation since it's easier than I thought it would be, expect a PM when I release. :)