Author Topic: Conditional Branch-Variable (or whatever) help  (Read 2940 times)

0 Members and 1 Guest are viewing this topic.

mepwnn

  • いつまでも
  • *
  • Tier 7
  • **
  • Posts: 10988
  • Gender: Male
  • profile picture courtesy of Silentgears
  • Current Mood: happy happy
Conditional Branch-Variable (or whatever) help
« on: June 16, 2010, 02:00:50 PM »
I'm trying to write a different EBS with a HUD I made. Basically, the character has a portrait, his HP and MP bars, and four skills (basic attack, heal, and two offensive spells. This was all done in Paint.NET). The HP bar and MP bar are separated into eight equal segments. Each segment represents 10 HP and 8 MP.
Each time there's a change in the HP or MP bar, there's a new picture with the necessary changes. The picture is 640x480 (since I'm just too lazy to position it myself)

So what I've done is write a long string of common events to empty a segment of color (green for HP, blue for MP) when some HP or MP has been lost. Say, if 20 HP and 16 MP has been lost, the events change the HUD from this picture to the next picture. So what's the problem?

The problem is is that the HUD, when 10 HP has been lost, but no MP has been lost, the HUD changes to 7 bars/8 bars. But past that, say 20 HP has been lost, the HUD does not change.

To sum it up, the HUD doesn't decrease past 10 HP, even though the menu says it has. This is where I need help on.

In the image I attached, there's the code in question. I'm thinking that this problem occurs when MP is also taken into account. I tried to put this into as much detail as I could, if there's anything you're still wondering about, then feel free to ask.
Portals... must capture... ALL the portals... (click image to enlarge)

Sarkilas

  • *
  • Tier 6
  • **
  • Posts: 429
  • Gender: Male
  • That guy
  • Current Mood: creative creative
Re: Conditional Branch-Variable (or whatever) help
« Reply #1 on: June 16, 2010, 02:19:27 PM »
It's pretty simple. Your issue is that the first case is when the HP is less than or equal to 70. So it never really enters the 60, 50 and so forth, because it always is less than or equal to 70. That condition is always met, and therefore doesn't ever run the else case unless the health is ABOVE 70. Change it to more than 60 (var > 60), and then do the same for all the other cases, except you reduce the value by 10. So where it now says 70, you make it 60, 60 to 50 and so on, with more than (not more than or equal to).

That should do it.
« Last Edit: June 16, 2010, 02:21:44 PM by Sarkilas »

Need scripting help? Toss me a PM and I'll see what I can do.
Also able to help with anything RMXP related. Please do not hesitate to ask.

mepwnn

  • いつまでも
  • *
  • Tier 7
  • **
  • Posts: 10988
  • Gender: Male
  • profile picture courtesy of Silentgears
  • Current Mood: happy happy
Re: Conditional Branch-Variable (or whatever) help
« Reply #2 on: June 16, 2010, 02:48:44 PM »
Thanks, now the HUD decreases as it should. But now the default HUD starts at 7/8 bars full, rather than 8/8.
Portals... must capture... ALL the portals... (click image to enlarge)

Sarkilas

  • *
  • Tier 6
  • **
  • Posts: 429
  • Gender: Male
  • That guy
  • Current Mood: creative creative
Re: Conditional Branch-Variable (or whatever) help
« Reply #3 on: June 16, 2010, 02:49:55 PM »
It's because you need a filler branch. Do something like:
Conditional Branch: Var > 70
   Show 8/8 HUD Pic
   Exit Event Processing
End

Should do it I guess. Use jump to label if you are doing later processing in the event.
Note that this has to be right above the first case that is > 60 (previously <= 70). Just as a check to prevent it from continuing if it's above 70.
« Last Edit: June 16, 2010, 03:18:28 PM by Sarkilas »

Need scripting help? Toss me a PM and I'll see what I can do.
Also able to help with anything RMXP related. Please do not hesitate to ask.

mepwnn

  • いつまでも
  • *
  • Tier 7
  • **
  • Posts: 10988
  • Gender: Male
  • profile picture courtesy of Silentgears
  • Current Mood: happy happy
Re: Conditional Branch-Variable (or whatever) help
« Reply #4 on: June 16, 2010, 03:19:06 PM »
Great! It works now :D

(Sorry for asking so much, it's because of the changes I made to it a few days ago >_<)

The MP stays at 8/8, rather than decreasing. The event code follows that of the HP, except it's something like
Conditional Branch: Player HP > 70
     Conditional Branch: Player MP > 48
          Show 7/8 MP picture
      Else
           etc...

So the conditional branch requirements follow that of the HP ones, but instead, nothing changes.
Portals... must capture... ALL the portals... (click image to enlarge)

Sarkilas

  • *
  • Tier 6
  • **
  • Posts: 429
  • Gender: Male
  • That guy
  • Current Mood: creative creative
Re: Conditional Branch-Variable (or whatever) help
« Reply #5 on: June 16, 2010, 03:23:21 PM »
But doesn't your code require the player to have more than 70 health for any MP bars to change at all?
Same for the HP, don't you need to have 57 MP to even get any HUD pictures to change? Looks weird to me.
Quote
Conditional Branch: Player HP > 70
     Conditional Branch: Player MP > 48
          Show 7/8 MP picture
      Else
           etc...
Why is the bold part there? Isn 't that unecessary?

I don't see what the issue is here unless this is the issue itself. Could you provide me with a full transcript of your common event if this isn't the problem? Or even better, upload your CommonEvents.rxdata file so I can have a personal look.

Need scripting help? Toss me a PM and I'll see what I can do.
Also able to help with anything RMXP related. Please do not hesitate to ask.

mepwnn

  • いつまでも
  • *
  • Tier 7
  • **
  • Posts: 10988
  • Gender: Male
  • profile picture courtesy of Silentgears
  • Current Mood: happy happy
Re: Conditional Branch-Variable (or whatever) help
« Reply #6 on: June 16, 2010, 03:47:19 PM »
the Player HP > 70 is when the Player HP is full, I thought it would be a needed precaution, since there are events that do have Player HP > 60, 50, etc.

Maybe the Player MP > 57 is unnecessary, though
Portals... must capture... ALL the portals... (click image to enlarge)

Sarkilas

  • *
  • Tier 6
  • **
  • Posts: 429
  • Gender: Male
  • That guy
  • Current Mood: creative creative
Re: Conditional Branch-Variable (or whatever) help
« Reply #7 on: June 16, 2010, 03:51:09 PM »
You forgot to change the <= to > on all the other common events according to what I can see. That seems to be an issue, as it does exactly what your previous issue was in all the -1, -2 etc events. Can you change that and see if that works?

Need scripting help? Toss me a PM and I'll see what I can do.
Also able to help with anything RMXP related. Please do not hesitate to ask.

mepwnn

  • いつまでも
  • *
  • Tier 7
  • **
  • Posts: 10988
  • Gender: Male
  • profile picture courtesy of Silentgears
  • Current Mood: happy happy
Re: Conditional Branch-Variable (or whatever) help
« Reply #8 on: June 16, 2010, 04:25:36 PM »
Do I need to change all the MP values, too? Like, from <= 56 to > 48?
Portals... must capture... ALL the portals... (click image to enlarge)

Sarkilas

  • *
  • Tier 6
  • **
  • Posts: 429
  • Gender: Male
  • That guy
  • Current Mood: creative creative
Re: Conditional Branch-Variable (or whatever) help
« Reply #9 on: June 16, 2010, 04:26:23 PM »
Yes, all of them, otherwise only the first condition will be checked, as I said earlier.

Need scripting help? Toss me a PM and I'll see what I can do.
Also able to help with anything RMXP related. Please do not hesitate to ask.

mepwnn

  • いつまでも
  • *
  • Tier 7
  • **
  • Posts: 10988
  • Gender: Male
  • profile picture courtesy of Silentgears
  • Current Mood: happy happy
Re: Conditional Branch-Variable (or whatever) help
« Reply #10 on: June 16, 2010, 05:21:41 PM »
Alright, so I've changed everything, but now on startup, the HP bar shows 3/8 while the MP bar shows 7/8. All the variables have been set to 8 below the original, and all the <= changed to > (exceptions exist)

I've left Mp <= 0 at the bottom as a semi-precaution (even though the MP can't go below 0)
« Last Edit: June 16, 2010, 05:23:38 PM by mepwnn »
Portals... must capture... ALL the portals... (click image to enlarge)

Sarkilas

  • *
  • Tier 6
  • **
  • Posts: 429
  • Gender: Male
  • That guy
  • Current Mood: creative creative
Re: Conditional Branch-Variable (or whatever) help
« Reply #11 on: June 16, 2010, 05:33:04 PM »
That's completely illogical:p not that I blame you, it just doesn't make sense by the small amount of detail I have been given. Is it possible to receive your project in some way? Just including all data files will be fine. I can't guarantee that I will have the time to look deeply into this if the amount of work is vast, but I shall take a look when I have the time to if this is given. As of now, though, I don't see how I can debug your problem any further without a proper look at why this is happening, mainly because of the fact I don't know in which occasions each common event is called, and for what purpose you are having so many.

If you wish to keep it confidential to the rest of the community if it's going to be a release or something, feel free to PM me the project if that's better.

I hope I can be of some assistance. It's rather late here, though, so it probably won't be tonight:p

Need scripting help? Toss me a PM and I'll see what I can do.
Also able to help with anything RMXP related. Please do not hesitate to ask.

mepwnn

  • いつまでも
  • *
  • Tier 7
  • **
  • Posts: 10988
  • Gender: Male
  • profile picture courtesy of Silentgears
  • Current Mood: happy happy
Re: Conditional Branch-Variable (or whatever) help
« Reply #12 on: June 16, 2010, 05:44:41 PM »
http://dl.dropbox.com/u/7230994/EBS%20Test%20%232.exe

If anyone else wants to help, then go ahead. Thanks to all who help (especially Sark :D)
Portals... must capture... ALL the portals... (click image to enlarge)

Sarkilas

  • *
  • Tier 6
  • **
  • Posts: 429
  • Gender: Male
  • That guy
  • Current Mood: creative creative
Re: Conditional Branch-Variable (or whatever) help
« Reply #13 on: June 16, 2010, 05:59:35 PM »
Just looked at it quickly, not going into detail, but I suggest that you split the HP and MP bars into two different HUD pictures. Each seperate. Keep the main HUD on picture 1, HP on picture 2, MP on picture 3, and only use two common events for HP and MP. Remove the HP and MP check at the top of them. Just as a draft. If you used layers, you can simply remove all other layers except the HP and MP bar and seperate the pictures so they will show seperately.

The way you have set up your common events now are really messy and I encourage changing that into what I proposed, one base HUD, one HP bar and one MP bar. I'm sure you get the point. It will not only make your life easier, it will also make your project less messy, especially if you intend to release it at one point, which, those notes at the bottom suggest:p

If you have issues with doing what I mentioned here, I'll check back tomorrow and help you out if needed.

Good night!

Need scripting help? Toss me a PM and I'll see what I can do.
Also able to help with anything RMXP related. Please do not hesitate to ask.

mepwnn

  • いつまでも
  • *
  • Tier 7
  • **
  • Posts: 10988
  • Gender: Male
  • profile picture courtesy of Silentgears
  • Current Mood: happy happy
Re: Conditional Branch-Variable (or whatever) help
« Reply #14 on: June 16, 2010, 06:09:42 PM »
Mm, I'll work on it soon. I'll definitely take your suggestions into account, though, so thanks a bunch!
Portals... must capture... ALL the portals... (click image to enlarge)