YesNoOk
avatar

Is Partner, or Check ID if Partner? (Read 1030 times)

Started by Sheng Long, November 17, 2014, 07:15:40 pm
Share this topic:
Is Partner, or Check ID if Partner?
#1  November 17, 2014, 07:15:40 pm
  • *****
  • Video Game Veteran
    • USA
    • gcnmario.free.fr
Is there an alternative to check if a character is a partner? I'm trying to make it so if a character is a partner, to not go to certain states, or trigger a random character variable. But if the character is not a partner, i do want them to go to those states.

"You must defeat my flaming
dragon punch to stand a chance."
Re: Is Partner, or Check ID if Partner?
#2  November 17, 2014, 07:42:11 pm
  • ***
  • Ha hA Haaaaaa.....
    • USA
    • electroslair.blogspot.com/
Here is the trigger I use to detect partners. Basically this will trigger if partner 1 ID is less than partner 2. Just change the < symbol to reverse that.

trigger1 = numpartner = 1 && id<partner,id 

Re: Is Partner, or Check ID if Partner?
#3  November 17, 2014, 11:05:37 pm
  • *****
  • Video Game Veteran
    • USA
    • gcnmario.free.fr
Alright thanks, I think that worked. :)

Also, can someone tell me why, when doing single mode, this code displays "has no 0-th partner"
Spoiler, click to toggle visibilty

But using these codes do NOT display the error?
Spoiler, click to toggle visibilty

They should be basically the same, except to check if there is a partner, or no partner. I wanted the first code, but it's giving me that 0th partner error.

"You must defeat my flaming
dragon punch to stand a chance."
Re: Is Partner, or Check ID if Partner?
#4  November 18, 2014, 12:26:10 am
  • ***
  • Ha hA Haaaaaa.....
    • USA
    • electroslair.blogspot.com/
Instead of writing NumPartner = 0 use TeamMode != Simul.
Re: Is Partner, or Check ID if Partner?
#5  November 18, 2014, 01:02:31 am
  • *****
  • Video Game Veteran
    • USA
    • gcnmario.free.fr
But what if I want the state # to happen if the player is in the front of its partner?

So like, in my previous reply above, the 2nd code I posted below the first one will work if the character is in front of its partner, but will not trigger the state if the character is behind the partner in front, which is what I want.  TeamMode != Simul won't work for this situation.

"You must defeat my flaming
dragon punch to stand a chance."
Re: Is Partner, or Check ID if Partner?
#6  November 18, 2014, 01:34:24 am
  • ***
  • Ha hA Haaaaaa.....
    • USA
    • electroslair.blogspot.com/
I was just saying that numpartner = 0 is the same as saying that your not in simul mode. You said you where getting an error with numpartner = 0.

Did you try, trigger1 = numpartner = 1 && id>partner,id  or  trigger1 = numpartner != 1 && id<partner,id

If that doesn't get you what you want then i'm afraid I've gone as far as I can go with my knowledge of partners.
Re: Is Partner, or Check ID if Partner?
#7  November 18, 2014, 03:13:47 am
  • *****
  • Video Game Veteran
    • USA
    • gcnmario.free.fr
Hmm.... I thought NumPartner = 0 was the same as !NumPartner, or NumPartner != 1. o_O

Okay so I did this:
Spoiler, click to toggle visibilty

I also tried
Code:
triggerall = TeamMode = Single || NumPartner > 0 && ID < Partner, ID

It STILL gives me the "no 0th partner" error on display.

I think the only thing that seems to work without giving the error is just separate the changestate controllers for whatever reason. :P

Well..... Thanks anyway. :)

"You must defeat my flaming
dragon punch to stand a chance."
Last Edit: November 18, 2014, 03:21:44 am by Sheng Long
Re: Is Partner, or Check ID if Partner?
#8  November 20, 2014, 02:44:55 pm
  • ****
  • Hey.
    • Ukraine
    • mugencoder.com

  • Online
Also, can someone tell me why, when doing single mode, this code displays "has no 0-th partner"

They should be basically the same, except to check if there is a partner, or no partner. I wanted the first code, but it's giving me that 0th partner error.
I just saw this now, but the reason is quite simple. Let's compare the two:

Code:
triggerall = NumPartner <= 0 || NumPartner > 0 && ID < Partner, ID
In this example, you have everything on one line. First, numpartner<=0 will be evaluated. This will be true in single player modes. Next, the other side of the OR operand is evaluated. numpartner and partner are evaluated one after the other. However, if you have no partners, "partner" redirection will result in the error you're seeing. Why is this? It's because you aren't stopping the evaluation after it's found that you have no partners via numpartner.

Code:
triggerall = NumPartner > 0
triggerall = ID < Partner, ID
In this example, you have numpartner being checked first. Then, if the first line is true, the next line will be evaluated. This is safe and won't cause the error.

Do you see the difference? As a closing note, I would like to add that you can surly fix the single line of code to work for you. Observe:
Code:
triggerall = cond(numpartner, partner,ID<ID, 0)
What does this do? I'm sure you've seen ifelse and have used it before. If not, it basically evaluates the first parameter and returns either the second or third expression's evaluation depending on the result of the first expression.
Code:
ifelse(1, 5, 10) ; will return 5
ifelse(0, 5, 10) ; will return 10
The drawback with this is that both "5" and "10" are evaluated by mugen. "cond" does exactly the same thing except that it doesn't evaluate both "5" and "10" for the sake of this example. Instead, it will ONLY evaluate the expression that will be returned. Going back to my example before of cond, you see numparter. This will be false in single player mode. Then, the next parameter is your partner expression, and the one after is simply 0. The result will be 0, because numpartner was false. If simul mode, numpartner will be true and then the "partner" expression will evaluated instead.

I apologize for the long-winded explanation, but I really wanted to show you how it works.

-[Все слова это только слова.]-
Re: Is Partner, or Check ID if Partner?
#9  November 20, 2014, 04:11:47 pm
  • **
    • USA
    • altoiddealer@gmail.com
Also, can someone tell me why, when doing single mode, this code displays "has no 0-th partner"

They should be basically the same, except to check if there is a partner, or no partner. I wanted the first code, but it's giving me that 0th partner error.
I just saw this now, but the reason is quite simple. Let's compare the two:

Code:
triggerall = NumPartner <= 0 || NumPartner > 0 && ID < Partner, ID
In this example, you have everything on one line. First, numpartner<=0 will be evaluated. This will be true in single player modes. Next, the other side of the OR operand is evaluated. numpartner and partner are evaluated one after the other. However, if you have no partners, "partner" redirection will result in the error you're seeing. Why is this? It's because you aren't stopping the evaluation after it's found that you have no partners via numpartner.

Code:
triggerall = NumPartner > 0
triggerall = ID < Partner, ID
In this example, you have numpartner being checked first. Then, if the first line is true, the next line will be evaluated. This is safe and won't cause the error.

Do you see the difference? As a closing note, I would like to add that you can surly fix the single line of code to work for you. Observe:
Code:
triggerall = cond(numpartner, partner,ID<ID, 0)
What does this do? I'm sure you've seen ifelse and have used it before. If not, it basically evaluates the first parameter and returns either the second or third expression's evaluation depending on the result of the first expression.
Code:
ifelse(1, 5, 10) ; will return 5
ifelse(0, 5, 10) ; will return 10
The drawback with this is that both "5" and "10" are evaluated by mugen. "cond" does exactly the same thing except that it doesn't evaluate both "5" and "10" for the sake of this example. Instead, it will ONLY evaluate the expression that will be returned. Going back to my example before of cond, you see numparter. This will be false in single player mode. Then, the next parameter is your partner expression, and the one after is simply 0. The result will be 0, because numpartner was false. If simul mode, numpartner will be true and then the "partner" expression will evaluated instead.

I apologize for the long-winded explanation, but I really wanted to show you how it works.


Алексей, every response you make in this subforum is pure gold.
Re: Is Partner, or Check ID if Partner?
#10  November 20, 2014, 04:15:32 pm
  • ****
  • Hey.
    • Ukraine
    • mugencoder.com

  • Online

-[Все слова это только слова.]-
Re: Is Partner, or Check ID if Partner?
#11  November 20, 2014, 04:21:56 pm
  • ****
  • #duckhuntkirby
    • USA
    • DJHANNIBALROYCE@gmail.com
    • Skype - DJHANNIBALROYCEUSA
    • sites.google.com/site/djhrmugen/
Also, can someone tell me why, when doing single mode, this code displays "has no 0-th partner"

They should be basically the same, except to check if there is a partner, or no partner. I wanted the first code, but it's giving me that 0th partner error.
I just saw this now, but the reason is quite simple. Let's compare the two:

Code:
triggerall = NumPartner <= 0 || NumPartner > 0 && ID < Partner, ID
In this example, you have everything on one line. First, numpartner<=0 will be evaluated. This will be true in single player modes. Next, the other side of the OR operand is evaluated. numpartner and partner are evaluated one after the other. However, if you have no partners, "partner" redirection will result in the error you're seeing. Why is this? It's because you aren't stopping the evaluation after it's found that you have no partners via numpartner.

Code:
triggerall = NumPartner > 0
triggerall = ID < Partner, ID
In this example, you have numpartner being checked first. Then, if the first line is true, the next line will be evaluated. This is safe and won't cause the error.

Do you see the difference? As a closing note, I would like to add that you can surly fix the single line of code to work for you. Observe:
Code:
triggerall = cond(numpartner, partner,ID<ID, 0)
What does this do? I'm sure you've seen ifelse and have used it before. If not, it basically evaluates the first parameter and returns either the second or third expression's evaluation depending on the result of the first expression.
Code:
ifelse(1, 5, 10) ; will return 5
ifelse(0, 5, 10) ; will return 10
The drawback with this is that both "5" and "10" are evaluated by mugen. "cond" does exactly the same thing except that it doesn't evaluate both "5" and "10" for the sake of this example. Instead, it will ONLY evaluate the expression that will be returned. Going back to my example before of cond, you see numparter. This will be false in single player mode. Then, the next parameter is your partner expression, and the one after is simply 0. The result will be 0, because numpartner was false. If simul mode, numpartner will be true and then the "partner" expression will evaluated instead.

I apologize for the long-winded explanation, but I really wanted to show you how it works.


Алексей, every response you make in this subforum is pure gold.

damn. ur like a mugen textbook. LOL. i aint mad at it though....this is the stuff i need to learn
SKYPE: DJHANNIBALROYCEUSA
TWITTER: https://twitter.com/DJHANNIBALROYCE
SOUNDCLOUD:https://soundcloud.com/djhannibalroyce
Re: Is Partner, or Check ID if Partner?
#12  November 20, 2014, 07:45:54 pm
  • *****
  • Video Game Veteran
    • USA
    • gcnmario.free.fr
Do you see the difference? As a closing note, I would like to add that you can surly fix the single line of code to work for you. Observe:
Code:
triggerall = cond(numpartner, partner,ID<ID, 0)
What does this do? I'm sure you've seen ifelse and have used it before. If not, it basically evaluates the first parameter and returns either the second or third expression's evaluation depending on the result of the first expression.

Is cond a new feature in Mugen 1.0? I checked the winmugen version of the docs, and I don't see this. Is it fair that I may want to have the option to convert a character back down to winmugen after all the coding has finished in mugen 1.0? In which case, I suppose I'm left with using two controllers to fix the problem even in winmugen.

"You must defeat my flaming
dragon punch to stand a chance."
Re: Is Partner, or Check ID if Partner?
#13  November 20, 2014, 08:15:50 pm
  • ****
  • Hey.
    • Ukraine
    • mugencoder.com

  • Online
Yes, I believe that cond is a trigger in mugen 1.0 only.

Lol, 1.0 for life! But seriously, yes you can do that. You just have to be aware of what works in each. It's easier to code for WinMUGEN from the start I think. WinMUGEN characters will work on mugen 1.0, but not the other way around.

-[Все слова это только слова.]-
Re: Is Partner, or Check ID if Partner?
#14  November 20, 2014, 10:17:23 pm
  • *****
  • Video Game Veteran
    • USA
    • gcnmario.free.fr
Yea, I also prefer Mugen 1.0. I don't like WinMugen cause it lacks features Mugen 1.0 has. Although the only reason I don't like Mugen 1.0 is it's lacking the freqmul option on playsnd controllers.

I only downgrade characters to winmugen if it's really necessary, or if there's a request for it to be done. Otherwise yea, I like to work with Mugen 1.0. :)

Well, thanks for the help anyway guys. :)

"You must defeat my flaming
dragon punch to stand a chance."