KH2 Style Panel System- Anyone know how to code something like this?

Started by Girku, December 19, 2009, 10:25:50 PM

Previous topic - Next topic

Girku

Anyone have any idea how I could code something like this
Spoiler (click to show)


The command panel in particular...I already have the sprites I want to use for it as well...just dont know how to code it... Heres the sprites for the panel system
Spoiler (click to show)


all help is greatly appreciated those who help out will be credited in the read me

Byakko

? What's hard about that ?
Create a helper to display the panel, and then... well how do you move around and how do you pick up which command to do ? Have the panel detect the parent's commands to... I don't know, what does the panel do, move around, highlight the various commands ? Then have the parent react to the action determined by his helper (the panel).

First figure out EXACTLY the DETAILS of WHAT you want to do, and then translate that to code. You can't do much if you don't know exactly WHAT you want to do. You can't just say "I want the same thing as in this game" if you don't know everything about how that game works. What does your panel do ? How does it react to your key inputs ? How does your character react to your key inputs ? How do the actions of the character relate to the panel's situation ? Make sure yo know all that.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

Girku

Quote from: Byakko on December 19, 2009, 10:46:13 PM
? What's hard about that ?
Create a helper to display the panel, and then... well how do you move around and how do you pick up which command to do ? Have the panel detect the parent's commands to... I don't know, what does the panel do, move around, highlight the various commands ? Then have the parent react to the action determined by his helper (the panel).

First figure out EXACTLY the DETAILS of WHAT you want to do, and then translate that to code. You can't do much if you don't know exactly WHAT you want to do. You can't just say "I want the same thing as in this game" if you don't know everything about how that game works. What does your panel do ? How does it react to your key inputs ? How does your character react to your key inputs ? How do the actions of the character relate to the panel's situation ? Make sure yo know all that.

Okay well Ill try some random things and post it later okay  :P

Girku

Sorry for double posting but this is kind of a bump/ update

Heres my first attempt to make a panel system similar to KH2

http://www.youtube.com/watch?v=hWDDCjn1uZQ

Now...Seems to be working perfectly in the vid...But Attacking isnt triggered off of where the cursor is placed..Anyone know how to make it so that it is?

Cyanide

Explain more. You want him to attack AFTER you select it, or no matter which panel you select you attack?

I mean, you have attack selected in the vid, and afterwards you attack. If you wanted us to see a problem you should have shown something that LOOKED like a problem. All i see there is something that's apparently working.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Girku

Quote from: Cyanide on December 20, 2009, 08:16:36 AM
Explain more. You want him to attack AFTER you select it, or no matter which panel you select you attack?

I mean, you have attack selected in the vid, and afterwards you attack. If you wanted us to see a problem you should have shown something that LOOKED like a problem. All i see there is something that's apparently working.

QuoteNow...Seems to be working perfectly in the vid...But Attacking isnt triggered off of where the cursor is placed..Anyone know how to make it so that it is?

I already established that it is not triggered off of Attack being highlighted...I was wondering how to make it so that it is

Byakko

Read my previous post, I explained how to use a changestate triggered by the position of the helper. You can't do that ? Well that's too fucking bad because you're not telling us ANYTHING that would let us help you. You're not posting your code, you are NOT giving us enough details on how it should work, you are not telling us anything. You want help ? Talk. Nobody is going to magically guess your solution.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

Cyanide

Actually, you didn't make the function you desired plain. As i said, attack is selected, and you're attacking.

do you

A: Want him to attack while it's selected with no input from you
or
B: Want to be able to use the keys and do physical attacks when it's selected and changing to magic would give you magic ones?

EXplain


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Girku

QuoteNow...Seems to be working perfectly in the vid...But Attacking isnt triggered off of where the cursor is placed..Anyone know how to make it so that it is?
That would be the 3rd time ive explained what I wanted...

Heres the coding that I have

I more than likely will have to change the explod to a helper though

Spoiler (click to show)

; Select Panel
; CNS difficulty: easy
[Statedef 1500]
type    = S                      ;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= I                      ;Move-type: A-attack, I-idle, H-gethit
physics = S                      ;Physics: S-stand, C-crouch, A-air
juggle  = 0                      ;Number of air juggle points move takes
;Commonly-used controllers:
velset = 0,0                     ;Set velocity (x,y) (Def: no change)
ctrl = 0                         ;Set ctrl (Def: no change)
anim = 0                    ;Change animation (Def: no change)
sprpriority = 2                  ;Set layering priority to 2 (in front)

[State 1500, BeginSound]
type = PlaySnd
trigger1 = Time = 0
value = 1500,0

[State 1500, ChooseSound]
type = PlaySnd
trigger1 = Command = "U"
trigger2 = Command = "D"
value = 1500,1

[State 1500, Exit]
type = PlaySnd
trigger1 = Command != "holdy"
value = 1500,2

[State 1500, DisplayPanel]
type = Explod
trigger1 = 1
anim = 30000+var(0)
pos = 0,-50
postype = p1
bindtime = -1
removetime = 1
ontop = 1
ownpal = 1
facing = ifelse(facing = 1,1,-1)

[State 1500, SelectionUp]
type = VarSet
trigger1 = Command = "D"
v = 0
value = ifelse(var(0)>=7,0,var(0)+1)

[State 1500, SelectionDown]
type = VarSet
trigger1 = Command = "U"
v = 0
value = ifelse(var(0)<=0,7,var(0)-1)

[State 1500, 2]
type = ChangeState
trigger1 = Command != "holdy"
value = 0
ctrl = 1

Cyanide

And this will be the 3rd time i've told you that's not an explanation.

More than 2 sentences thanks. WHAT DO YOU WANT TO HAPPEN?

I'm sure that code works. It looks clean. I see nothing in there that does more than set a variable though.

Do you want

A: If attack is selected your character attacks based on buttons you press
OR
B: If attack is selected your character will proceed to do attacks because attack is selected with no input from you


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Girku

Option A...I thought that was already established.... I said that already... I want attack to be triggered off of when attack is highlighted and only work when it is highlighted...and same for everything else on that list...

Heres an example from the actual game....

http://www.youtube.com/watch?v=p4ki7CCg1BI

Byakko

QuoteI thought that was already established.... I said that already...
And I said already what you needed to do for that. And yet you keep saying the same thing. So what, did you not read what I was telling you to do ? You rather keep telling us the same thing and act like we weren't reading you the first time around ? If you didn't understand, why don't you say it ?
The helper checks the parent's commands and selects the right action according to your direction inputs.
When you press a button, in your cmd file, you check what the helper is currently selecting, and then you make a changestate depending on that. What else do you want ? This is as clear as it can be. What do you not understand in that ? If you don't know how to do it, can't you say it instead of acting like that ?
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

Girku

Quote from: Byakko on December 20, 2009, 10:04:35 PM
QuoteI thought that was already established.... I said that already...
And I said already what you needed to do for that. And yet you keep saying the same thing. So what, did you not read what I was telling you to do ? You rather keep telling us the same thing and act like we weren't reading you the first time around ? If you didn't understand, why don't you say it ?
The helper checks the parent's commands and selects the right action according to your direction inputs.
When you press a button, in your cmd file, you check what the helper is currently selecting, and then you make a changestate depending on that. What else do you want ? This is as clear as it can be. What do you not understand in that ? If you don't know how to do it, can't you say it instead of acting like that ?

Well Im sorry ...Excuse me for not knowing how to do things and coming to you guys for help....Now..I dont have a helper set..I'm using an explod..so...could you please provide an example..in code that uses the method your talking about explaining what each part does and means so that I can learn

Byakko

type = HelperCreate a helper, create a statedef to start the helper at. In that statedef, you display the panel's animations.
In the helper's state, you dedicate a variable to the current position of the arrow. Helpers have their own sets of variables separated from the character's, so you don't worry about that.
Still in the helper's state, you constantly check for the parent's command (with trigger redirection). If the parent (your character, i.e. yourself) presses up or down, you change the helper's variable accordingly.
When you press a button and you have control and everything, you also add a trigger that looks for the current value of the helper's variable (trigger redirection again). And so you can make the changestate to whatever action you want. If the helper's variable says the panel is pointing at "attack", then you have the changestate send you to the attack state, and so on.

If there is anything (something specific) in this that you don't understand in this or don't know how to do, you should say it (and have a look at the docs if you don't find something about it if you look for the right keywords, I believe what I say up here should give you enough of these keywords to find info about it in the docs).
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

Girku

Quote from: Byakko on December 20, 2009, 10:40:30 PM
type = HelperCreate a helper, create a statedef to start the helper at. In that statedef, you display the panel's animations.
In the helper's state, you dedicate a variable to the current position of the arrow. Helpers have their own sets of variables separated from the character's, so you don't worry about that.
Still in the helper's state, you constantly check for the parent's command (with trigger redirection). If the parent (your character, i.e. yourself) presses up or down, you change the helper's variable accordingly.
When you press a button and you have control and everything, you also add a trigger that looks for the current value of the helper's variable (trigger redirection again). And so you can make the changestate to whatever action you want. If the helper's variable says the panel is pointing at "attack", then you have the changestate send you to the attack state, and so on.

If there is anything (something specific) in this that you don't understand in this or don't know how to do, you should say it (and have a look at the docs if you don't find something about it if you look for the right keywords, I believe what I say up here should give you enough of these keywords to find info about it in the docs).

Okay that all seems to be working so far...but how do I make it so that it checks where The parent is...?
Like how do I make it so that attacks cannot be initiated unless attack his highlighted? I have no idea how to work with helpers  :P

Byakko

Helpers work exactly the same way as the character, they go through statedefs the same way as the character.
The variable for the helper is used to know what the cursor is currently highlighting. Say, if var(1) = 1, you declare that "attack" is highlighted. If var(1) = 2, it's "magic".
In your cmd, you make the changestate triggered by the key press - adding the trigger "helper([the ID of your helper]),var(1) = 1" because you know that "attack" is highlighted if the helper's var(1) is 1.
Quotebut how do I make it so that it checks where The parent is...?
What do you mean by "where the parent is" ? Your character creates a helper. So the helper is the panel, and the panel's parent is the character - that is, you. So you have two "objects", the character and the helper. The panel is the one that knows what is currently highlighted.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

Girku

Quote from: Byakko on December 21, 2009, 12:03:40 AM
Helpers work exactly the same way as the character, they go through statedefs the same way as the character.
The variable for the helper is used to know what the cursor is currently highlighting. Say, if var(1) = 1, you declare that "attack" is highlighted. If var(1) = 2, it's "magic".
In your cmd, you make the changestate triggered by the key press - adding the trigger "helper([the ID of your helper]),var(1) = 1" because you know that "attack" is highlighted if the helper's var(1) is 1.
Quotebut how do I make it so that it checks where The parent is...?
What do you mean by "where the parent is" ? Your character creates a helper. So the helper is the panel, and the panel's parent is the character - that is, you. So you have two "objects", the character and the helper. The panel is the one that knows what is currently highlighted.

So where in particular would the vars go?
Spoiler (click to show)


; Select Panel
; CNS difficulty: easy
[Statedef 1500]
type    = S                      ;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= I                      ;Move-type: A-attack, I-idle, H-gethit
physics = S                      ;Physics: S-stand, C-crouch, A-air
juggle  = 0                      ;Number of air juggle points move takes
;Commonly-used controllers:
velset = 0,0                     ;Set velocity (x,y) (Def: no change)
ctrl = 0                         ;Set ctrl (Def: no change)
anim = 0                    ;Change animation (Def: no change)
sprpriority = 2                  ;Set layering priority to 2 (in front)

[State 1500, BeginSound]
type = PlaySnd
trigger1 = Time = 0
value = 1500,0

[State 1500, ChooseSound]
type = PlaySnd
trigger1 = Command = "U"
trigger2 = Command = "D"
value = 1500,1

[State 1500, Exit]
type = PlaySnd
trigger1 = Command != "holdy"
value = 1500,2


[State 0, Helper]
type = Helper
trigger1 =1
helpertype = normal ;player
name ="Panel"
ID =30000+var(0)
stateno =1500
pos = 0,-50
postype = p1    ;p2,front,back,left,right
facing = ifelse(facing = 1,1,-1)
keyctrl = 1
ownpal = 1
value=var(1) = 1 <----is that right?

[State 1500, ChangeState]
type = ChangeState
trigger1 =1
value =0
ctrl = 1
;anim =
;ignorehitpause =
;persistent =


[State 0, DestroySelf]
type = DestroySelf
trigger1 =1





[State 1500, SelectionUp]
type = VarSet
trigger1 = Command = "D"
v = 0
value = ifelse(var(0)>=7,0,var(0)+1)

[State 1500, SelectionDown]
type = VarSet
trigger1 = Command = "U"
v = 0
value = ifelse(var(0)<=0,7,var(0)-1)

[State 1500, 2]
type = ChangeState
trigger1 = Command != "holdy"
value = 0
ctrl = 1


Sorry if i am becoming irritating its jus ha I have no clue how to use helpers in his fashion  :P

Cyanide

Nope, that's bad.

With your current state, (entered with Y) create a helper. Changestate out when it's released, as you had previously. Create a SECOND state for the helper.

Enter all your previous code there.

Also add the following to make things simple

[state parentvarset]
type = parentvarset
trigger1 = 1
v = 0
value = var(0)

We don't need to fuck round with redirects that way. Once you have THAT.

Lets invent some values. Attack is highlighted. Your var(0) = 0. All attacks that  are allowed when attack is highlighted are triggered normally but you add

triggerall = var(0) = 0 to them as well, this is in your .cmd file.

I preferred your previous one due to simplicity. But as we're onto helpers now we may as well stick with them.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Girku

Quote from: Cyanide on December 21, 2009, 12:33:50 AM
Nope, that's bad.

With your current state, (entered with Y) create a helper. Changestate out when it's released, as you had previously. Create a SECOND state for the helper.

Enter all your previous code there.

Also add the following to make things simple

[state parentvarset]
type = parentvarset
trigger1 = 1
v = 0
value = var(0)

We don't need to fuck round with redirects that way. Once you have THAT.

Lets invent some values. Attack is highlighted. Your var(0) = 0. All attacks that  are allowed when attack is highlighted are triggered normally but you add

triggerall = var(0) = 0 to them as well, this is in your .cmd file.

I preferred your previous one due to simplicity. But as we're onto helpers now we may as well stick with them.
Okay thank you that worked  :sugoi:

Now...for magic attacks  would I just add triggerall = var(0) = 2  for all magic attacks?

Cyanide

Is var(0) = 2 when you have magic selected? As you're making use of var(0) = 0, you're probably using var(0) = 1 for magic.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.