Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RPGMXP - Issue with variables (that most likely can be solved using scripts)
#1
First of all, I've been using RPMXP since July 2011 and I also own RPG Maker 1 and 2, so I do have experience using different RPG Makers (I'm just new to these forums). I also know next to nothing about scripting in RPMXP besides putting them into a game/editting some numbers/text where it says to edit it.

My issue is, I have 4 events that I want to display a different number (one to display the ones digit of a variable, one for the tens, hundreds and thousands digit). My only problem is I'm not quite sure how to go about doing that.

Variable #0 = 6532. Event 1 = page 6 (which has the graphic of a 6), 2 = page 5, 3 = page 3, 4 = page 2.

The simplest ways I can think to do what I want is make 4 variables, #1 = 6 (event 1 page 6: Condition = variable #1 is 6 or above, which in turn will make then event show a 6), #2 = 5, #3 = 3, #4 = 2.

>>So to sum all that up so it might possibly make sense: I need a script that makes 4 different variables equal the 4 digits (or 5+ digits/variables if needed) of variable #0 (and simple enough that I can easily change what each different variable is) AKA this: http://dl.dropbox.com/u/26636904/picture.png.

So hopefully this will makes sense to someone who can help me with my little problem

thanks, DPhoenix29
Reply }
#2
Read it. It's a bit RM2K / 2K3 old school. Not saying an event system doesn't come in handy, as I've seen a few good ones. But your request may be easier to solve as a script.

May I ask what's the purpose of the 4-digit display?

in any event, here's a cheap script I penned in 2 minutes. More time typing instructions.

cheapo window

You can use a simple script call in a map event window. The script call is 'set_digit' that contains either a digit value or nil. nil hides the window.

For example, using @>Script: set_digit(22) would turn the window on and display 22 in the window. And a later call of @>Script: set_digit(6352) would change it to exactly that. Entering this, @>Script: set_digit(nil) or just @>Script: set_digit erases the window

And there are two values (FOUR_DIGIT_X & FOUR_DIGIT_Y) that lets you adjust the location on the screen,
[/i]
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#3
(01-22-2012, 06:51 AM)DerVVulfman Wrote: Read it. It's a bit RM2K / 2K3 old school. Not saying an event system doesn't come in handy, as I've seen a few good ones. But your request may be easier to solve as a script.

May I ask what's the purpose of the 4-digit display?

Health/Magic (HP/MP) display, I'm pretty much making a battle system using events (something I've done using RPG Maker 1 and 2). The script you gave works but doesn't really do what I need it to do.


Here's some pics of what I'm trying to do with the whole thing (might make it easier to figure out what I want)

http://dl.dropbox.com/u/26636904/rpgmakerXp/rpgmxp0.png

http://dl.dropbox.com/u/26636904/rpgmakerXp/rpgmxp1.png

http://dl.dropbox.com/u/26636904/rpgmakerXp/rpgmxp2.png

http://dl.dropbox.com/u/26636904/rpgmakerXp/rpgmxp3.png


I don't know anything about scripting and I want my game to have my own personal battle system, so I'm building it in a way that I can figure out how to build it (so while scripting a battle system might work better, I'm unable to do that, so this will have to do).

All I need is a script that makes the following (which would probably achieve what I need so the event based health display to work)

var502 = thousands place of var501 (if var501 = 6532, var502 = 6, if var501 = 2109, var502 = 2,)
var503 = hundreds place of var501 (if var501 = 6532, var503 = 5, if var501 = 2109, var503 = 1,)
var504 = tens place of var501 (if var501 = 6532, var504 = 3, if var501 = 2109, var504 = 0,)
var505 = ones place of var501 (if var501 = 6532, var505 = 2, if var501 = 2109, var505 = 9,)

varTenThousands = Ten-thousands place of var501 (if I needed a 5 digit number)
varHundredThousands =
Hundred-thousands place of var501 (if I needed a 6 digit number)
varMillions = Millions place of var501 (if I needed a 7 digit number)
etc.
Reply }
#4
Okay...

Let's consider you have one event with 10 pages tied to a variable [0011: Var1],
another event with 10 pages tied to a variable [0012: Var2],
another event with 10 pages tied to a variable [0013: Var3],
and finally an event with 10 pages tied to a variable [0014: Var4].

Each event has a charset image from '0' to '9'...

And that you're using an event [0010: VarPrime] to hold the initial value of your HP or MP that you want sliced -n- diced for your four events.

Below is some classic event coding that can be used within an event (or more likely a common event) that will take the value stored in [0010: VarPrime] and divide it for use within the first 4 values/events earlier noted. There are two other variables in the below code that are used for storage and calculations.

I also included 'comments'... just in case.

Enjoy.

I normally don't event, but this is classic stuff

Oh, and RPGMaker XP doesn't have a 'call map event' feature like earlier versions, but then again, you can always use Call Map Event, a script that returns the feature.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#5
The code for the variables worked perfectly (I guess scripts aren't the answer in this case) and the call_map_event script works as well. Thank you very much for the help
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Battle Scripts shaje 2 6,983 09-14-2016, 06:08 PM
Last Post: Bounty Hunter Lani
  {RPGMXP} Create a state which protects you from a certain type of attack ThePrinceofMars 3 7,019 03-09-2015, 07:52 PM
Last Post: Steel Beast 6Beets
Heart [solved] Wierd XP error cosmickitty 0 3,339 03-09-2013, 12:26 AM
Last Post: cosmickitty
  Issue with RPG Maker XP and VX XP Kobold 4 8,370 05-29-2011, 08:22 PM
Last Post: XP Kobold
  multiplication with variables zubin73 2 4,492 02-16-2010, 07:12 AM
Last Post: zubin73



Users browsing this thread: