News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Additional custom UI for character

Started by MrSaturn100, June 11, 2023, 12:03:17 PM

Previous topic - Next topic

MrSaturn100

So I'm working on a character that throws out a different pokemon type attack depending on which button is pressed (Standing A = Normal, Crouching Y= Ghost, Air X = Rock, etc.)
One thing I thought about doing is making an extra HUD/UI thing in the corner of the screen that says which move is either in progress or is on a cooldown, with the only problem being that I kinda have no idea how to even code that in and I can't seem to find exactly what I'm looking for online


Below are a couple mockup images I made in Photoshop on what it is I want the results to be by the time I learn how it works
Spoiler (click to show)


Odb718

You'll need to learn how to make a helper. They're not hard at all. They work just like any other state you'd put your character into. But imagine what it'd take to make P1 stay in the top left corner. Then what it'd take to make it display all the icons.
You'll want to read this, https://mugenguild.com/forum/topics/helper-sctrl-1-0-1-1b-169754.0.html
If you're completely new to this stuff, https://mugenguild.com/forum/topics/mugen-101-things-you-need-know-169758.0.html

But it seems like you're halfway there. One trick you could do to eliminate a bunch of variables is to use the sprites you make as the on/off value. If the image/animation is say, 10201, you can do the dragon type move. If the animation is 10251, you cant. So when the state activates for doing the dragon type, the helper will be able to check that and change the animation for 10201 to 10251. Anim 10251 will have it's animation and once it's done, it can switch back to anim 10201. And since it'll be 10201 again, that means you can do the move again.

Learn how to put the helper on screen inside of state 5900.
Once the first icon is on the screen in the correct position for P1, move to making a 2nd animation inside of your helper state show up. Then place P2's helper in it's correct position.

Once you get those 3 things worked out, you'll be ready to add a ton of other stuff you'll need inside the cmd and cns.
vVv Gouken718 vVv SabreTooth718 vVv


MrSaturn100

Quote from: Odb718 on June 11, 2023, 12:52:26 PM

But it seems like you're halfway there. One trick you could do to eliminate a bunch of variables is to use the sprites you make as the on/off value. If the image/animation is say, 10201, you can do the dragon type move. If the animation is 10251, you cant. So when the state activates for doing the dragon type, the helper will be able to check that and change the animation for 10201 to 10251. Anim 10251 will have it's animation and once it's done, it can switch back to anim 10201. And since it'll be 10201 again, that means you can do the move again.

Learn how to put the helper on screen inside of state 5900.
Once the first icon is on the screen in the correct position for P1, move to making a 2nd animation inside of your helper state show up. Then place P2's helper in it's correct position.

Not entirely sure how state 5900 works, but I at least have the helper attacks either done or being worked on more, I could at least show that code off for one of the moves:

Spoiler (click to show)

;---------------------------------------------------------------------------
;Normal Pokemon
[Statedef 1000]
type    = A
movetype= A
physics = N
ctrl = 0
velset = 0,0
anim = 1001+(random%39) ;This is for what pokemon comes out when the move is called


[State 1000, 1]
type = AfterImage
trigger1 = time = 0
time = 60
TimeGap  = 2
FrameGap = 1
length = 15
PalBright   = 0,0,0
PalContrast = 192,192,192
Trans = add

[State 1000, 2]
type = velset
trigger1 = time >= 0
x = 5
y = 0

[State 1000, 3]
type = HitDef
trigger1 = time = 0
attr = A, SP
damage   = 50, 8
animtype = Hard
numhits = 1
envshake.time = 7
guardflag = MA
hitflag   = MAF
pausetime = 0,4
sparkno = -1
sparkxy = 0,0
hitsound = S0,1
guardsound = 6,0
ground.type = High
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -5
air.velocity = -2.5,-5.5
palfx.time = 15
palfx.add = 32,0,0
palfx.mul = 300,192,192


[State 1000, 4]
type = ChangeState
;trigger1 = movecontact = 1
trigger1 = time = 120
value = 202
ctrl = 0



;---------------------------------------------------------------------------
;Normal Attack
[Statedef 1001]
type    = S
movetype= A
physics = S
poweradd= 105
anim = 0
ctrl = 0
velset = 0,0

[State 1001, 0]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0, 2
volume = 255

[State 1001, Helper]
type = Helper
trigger1 = time = 0
helpertype = normal
name = "Normal"
id = 1000
postype = back
pos = 15,0
stateno = 1000
keyctrl = 0
ownpal = 0
supermovetime = 0
size.xscale = 0.2
size.yscale = 0.2

[State 1001, 3]
type = ChangeState
trigger1 = Time = 2
value = 0
ctrl = 1

In terms of actually getting the UI thing to work, I've got not idea how it's supposed to be done. If I can at least get more info on how state 5900 will help me it'd be much appreciated.

VictorCYBR

State 5900 is the first state a character goes to when they are loaded, and immediately changes. Usually it goes like this:

Initializer (5900) -> intro decider (usually 190) -> intro (usually 191~194) -> Stand (0)

Placing a helper in 5900 will make it spawn as soon as the match is loaded.

MrSaturn100

Interesting. Was working around with it for a bit but now Im lost in two ways:

1. Not sure how to get the sprite to be the type chart without the player turning into it for a second at the start of the match

2. Not sure how to make the type chart stay below the health bar and not be in floating in one place.

(Examples below, first image is for the first issue while the other two are for th second issue)
Spoiler (click to show)




I'll also post the code I have for it atm to see if anything needs fixing so far
Spoiler (click to show)
;------------------------------------------------
;Type Chart
; Initialize (at the start of the round)
[Statedef 5900]
type = S
anim = 98

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 5900, Helper]
type = Helper
trigger1 = !RoundsExisted
helpertype = normal
name = "Type Chart"
id = 5900
postype = left
pos = 45,-95
stateno = 5900
keyctrl = 0
ownpal = 0
supermovetime = 0
size.xscale = 0.2
size.yscale = 0.2

MrSaturn100

Okay, so in putting in that code I somehow managed to make it to where I can't even throw out attacks with it anymore?? Now I'm just even more confused...

Odb718

#6
Sounds like you're off to a good start actually. These are the normal hurdles everyone hits.
Remember if you spawn a helper, USUALLY, you only want 1 to spawn.
TriggerAll = !NumHelper(5900)
should do the trick. One probably spawns but it's good practice just in case. From what I'm reading the game doesn't seem like it's changing the char into the helper and back into the char. I think the helper is being spawned 1 tic ahead of the char. You can, and should, have the helper being a blank animation eventually.
But this is your main problem
stateno = 5900
The helper needs to be it's own state. Make up a number, make sure it's not being used. Then, personally, I'd probably copy State 0, or a super basic state and paste it, and renumber it to your helper's number and change it's animation. Remember to change numhelper(5900) and stateno = 5900 to the new number. Right now you're in a loop. 5900 is spawning 5900 which spawns 5900 which spawns 5900....

Also, I think you're probably going to want to set up some explodes or other helpers for the moves. I think a good Idea would be to clear out that white inside the icons, or make JUST the white. Then the helper's animation would have a darkened color/no color. When you can do the move the White color is active.

It's been a while since someone's set up a helper like this. I believe you'll be running into a 1 tic problem. Where, once you get your helper locked to the side of the screen, if a char moves in a certain way the helper will move a bit. But once you make your new state you're going to want to use PosSet https://mugenguild.com/forum/topics/posset-sctrl-170185.0.html

Use Ctrl+D to cycle through all the characters and helpers on screen. This will let you know if you're spawning more than 1 helper for each side. Unless you have some other hidden stuff, there should only be 4 things to cycle through.
vVv Gouken718 vVv SabreTooth718 vVv


MrSaturn100

Quote from: Odb718 on June 12, 2023, 03:50:09 PM
Sounds like you're off to a good start actually. These are the normal hurdles everyone hits.
Remember if you spawn a helper, USUALLY, you only want 1 to spawn.
TriggerAll = !NumHelper(5900)
should do the trick. One probably spawns but it's good practice just in case. From what I'm reading the game doesn't seem like it's changing the char into the helper and back into the char. I think the helper is being spawned 1 tic ahead of the char. You can, and should, have the helper being a blank animation eventually.
But this is your main problem
stateno = 5900
The helper needs to be it's own state. Make up a number, make sure it's not being used. Then, personally, I'd probably copy State 0, or a super basic state and paste it, and renumber it to your helper's number and change it's animation. Remember to change numhelper(5900) and stateno = 5900 to the new number. Right now you're in a loop. 5900 is spawning 5900 which spawns 5900 which spawns 5900....

In all honesty, the moves themselves I originally took from Omega Tom Hanks, but it was moreso as a starting point when it comes to the attacks, since I want to try and differentiate from eachother as I work on it more.
As for all the stuff with 5900, I'm not entire sure what to do with just that information alone. If you could, I'm usually able to do stuff better with some kind of example to go off of, though. Like, how is it supposed to be done? Cause at the moment I'm just lost at where to excatly start with it and what exactly I'm doing wrong, cause whatever I tried to do kept crashing the game when I tried to add an extra helper statedef to go along with that one

Odb718

So no matter where/when you spawn a helper, a second "character" on your team pops out. So P1 is in state 5900. Then you spawn a 2nd YOU into 5900. That 2nd 5900 runs. Which is exactly the same so it runs the helper code a 2nd time, creating a 3rd character... in "move" 5900.

;------------------------------------------------
;Type Chart
; Initialize (at the start of the round)
[Statedef 5900]
type = S
anim = 98

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 5900, Helper]
type = Helper
triggerall = numhelper(15900) = 0
trigger1 = !RoundsExisted
helpertype = normal
name = "Type Chart"
id = 15900                  ;This could be 5900 with no real issue
postype = left
pos = 45,-95
stateno = 15900          ;this is the move your new helper spawns into
keyctrl = 0
ownpal = 0
supermovetime = 0
size.xscale = 0.2
size.yscale = 0.2

Then you need the state 15900

;---------------------------------------------------------------------------
; Crouching
;[Statedef 11]
[Statedef 15900]
type    = C
physics = N
anim = 15900  ;<<<<Use what ever anim you've made
sprpriority = 0

[State 11, 1] ;Change from turning animation
type = ChangeAnim
trigger1 = Anim = 6 && AnimTime = 0
value = 11

;figure this out if you ever want the helper to stop working.
;[State 15900, DestroySelf]
;type = DestroySelf
;triggerall= IsHelper
;trigger1 =
;ignorehitpause = 1
;persistent =

You can see I just copy pasta'd the normal crouching state. Delete the changeanim and add your explods. Decide if you need the destroy self or not but make sure you replace/edit the helper in 5900.
vVv Gouken718 vVv SabreTooth718 vVv


XGargoyle

Any helper created during state 5900 or during the intros will be automatically removed/killed if the intro is interrupted/skipped


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!

MrSaturn100

Quote from: Odb718 on June 13, 2023, 04:52:59 AM
So no matter where/when you spawn a helper, a second "character" on your team pops out. So P1 is in state 5900. Then you spawn a 2nd YOU into 5900. That 2nd 5900 runs. Which is exactly the same so it runs the helper code a 2nd time, creating a 3rd character... in "move" 5900.

;------------------------------------------------
;Type Chart
; Initialize (at the start of the round)
[Statedef 5900]
type = S
anim = 98

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 5900, Helper]
type = Helper
triggerall = numhelper(15900) = 0
trigger1 = !RoundsExisted
helpertype = normal
name = "Type Chart"
id = 15900                  ;This could be 5900 with no real issue
postype = left
pos = 45,-95
stateno = 15900          ;this is the move your new helper spawns into
keyctrl = 0
ownpal = 0
supermovetime = 0
size.xscale = 0.2
size.yscale = 0.2

Then you need the state 15900

;---------------------------------------------------------------------------
; Crouching
;[Statedef 11]
[Statedef 15900]
type    = C
physics = N
anim = 15900  ;<<<<Use what ever anim you've made
sprpriority = 0

[State 11, 1] ;Change from turning animation
type = ChangeAnim
trigger1 = Anim = 6 && AnimTime = 0
value = 11

;figure this out if you ever want the helper to stop working.
;[State 15900, DestroySelf]
;type = DestroySelf
;triggerall= IsHelper
;trigger1 =
;ignorehitpause = 1
;persistent =

You can see I just copy pasta'd the normal crouching state. Delete the changeanim and add your explods. Decide if you need the destroy self or not but make sure you replace/edit the helper in 5900.

I tried it out and figured out how to get it to work...
Except now I'm left with two problems again:

1. Same issue as before where I have no idea how to keep it under the Health bars at all times
2. As XGargoyle states above me, it removes itself either when the round ends or if the intro is skipped, but when I go to change the code from being a 5900 state, it doesn't work and the icons refuse to show up

I'm also trying to get the P2 side working as well, but also got no idea how to get that to work either

SteelHammers

For problem 1, you'd want to spawn your UI as an explod(s) with screen positioning so it doesn't move with the camera.
For problem 2. You could spawn your UI in one of the negative states if you don't want it to disappear.

MrSaturn100

Quote from: SteelHammers on June 15, 2023, 05:30:31 AM
For problem 1, you'd want to spawn your UI as an explod(s) with screen positioning so it doesn't move with the camera.
For problem 2. You could spawn your UI in one of the negative states if you don't want it to disappear.

for 1, Ialready have them as explods but don't know what to do about the screen positioning stuff
as for 2, I'm not sure how to set them up as negative states, cause when I tried it just did the same thing as it did before...

VictorCYBR

1. Use postype = left in your explods.
2. Just go to [Statedef -3] and place your explod/helper there. Use "trigger1 = !NumExplod(ID)" or "trigger1 = !NumHelper(ID)", replace ID with the id of your explod/helper.

MrSaturn100

Quote from: DeathScythe on June 20, 2023, 04:45:11 PM
1. Use postype = left in your explods.
2. Just go to [Statedef -3] and place your explod/helper there. Use "trigger1 = !NumExplod(ID)" or "trigger1 = !NumHelper(ID)", replace ID with the id of your explod/helper.

1. if I put left on the explods themselves, they straight up dissapear
2. when I make it in State -3, they stay stuck on the player

I don't understand how to do it with just that alone

VictorCYBR

They are off screen, since you changed the postype, you need to also adjust the pos. Pos = 0, 0 will make it appear in the top left.

Change any bind to 0 so they don't bind with the character.

MrSaturn100

Quote from: DeathScythe on June 20, 2023, 07:32:23 PM
They are off screen, since you changed the postype, you need to also adjust the pos. Pos = 0, 0 will make it appear in the top left.

Change any bind to 0 so they don't bind with the character.

even if I make the pos (0,0) they dont show up
Below is the code I'm using for the main Helper, as well as the first bit of the explod code with the 0,0 pos and left postype
Spoiler (click to show)

;;------------------------------------------------
;Type Chart
; Initialize (at the start of the round)
[Statedef 5900]
type = S
anim = 0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 5900, Helper]
type = Helper
triggerall = numhelper(15900) = 0
trigger1 = !RoundsExisted
helpertype = normal
name = "Type Chart"
id = 15900                  ;This could be 5900 with no real issue
postype = left
pos = 45,-90
stateno = 15900          ;this is the move your new helper spawns into
keyctrl = 0
ownpal = 0
supermovetime = 0
size.xscale = 0.2
size.yscale = 0.2

;---------------------------------------------------------------------------
; Type Chart C
;[Statedef 11]
[Statedef 15900]
type    = C
physics = N
anim = 99  ;<<<<Use what ever anim you've made
sprpriority = 0

[State 0, (P1) Normal Explod]
type = Explod
triggerall = teamside = 1
trigger1 = NumHelper(1000) = 0
anim = 19001
ID = 5900
pos = 0,0
postype = left  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 0
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 0.2,0.2
sprpriority = 1
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 0

MrSaturn100

Wait hold up, I think I actually understand how it all works now! The main helper was the issue the whole time, so I'm now just putting all the explods under State -2 instead of what I had before. I also figured out how to keep the explods in one spot thanks to some digging around, cause now I know about (gameheight) being a thing.

MrSaturn100

So after about a week of having the (gameheight) solution, there's now a new problem with it and it's that it copies itself while being moved around in a stage that zooms out more than normal stages do.
I'd like to at least figure this out at some point cause this method is so far the only way that I was even able to get the UI stuff to actually work...

Here's the code for one of the spots just in case:
Spoiler (click to show)

[State 0, (P1) Normal Explod]
type = Explod
triggerall = teamside = 1
trigger1 = NumHelper(1000) = 0
anim = 19001
ID = 19001
pos = 10,(gameheight) - 120
postype = left  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 0.2,0.2
sprpriority = 50
ontop = 1
shadow = 0,0,0
ownpal = 1
removeongethit = 0

PlasmoidThunder

It's spawning a new Explod every frame because there's nothing telling it to only spawn one.

Quote from: Iced on July 24, 2013, 01:25:14 AM
Oh, I want a diagram. I fucking love diagrams.