Help - Search - Members - Calendar
Full Version: (VX) Something wrong with my Raw Materials system.
RPG RPG Revolution Forums > Scripting > Event Emporium
Quackadoos
Hi.

I recently started making a game called When Demons Run and I have been trying to make a sort of loot system similar to that in Final Fantasy XII. Basically, certain monsters drop Raw Materials and when the player has a certain number they are given the option to use the materials to create special armours and such.

Now I've tried to set up the system using the Fetch Quest tutorial found here, however I can't get the system to work. Using the tutorial mentioned above I hashed together the following event, but to be honest I'm still a novice at this and I've got no idea how to use the Variables so the problem could lie therein:

CODE
@>Loop
  @>Conditional Branch: [Bat Hide] in Inventory
   @>Control Variables: [0002:Bat Hides] = 1
   @>Change Items: [Bat Hide], -1
   @>
  : Else
   @>Conditional Branch: Variable [0002:Bat Hides] >= 2
   @>Text: -,-, Normal, Top
   :     : You now have enough raw materials to make a special armour
   :     : Would you like to use your Bat Hides to make a special
   :     : armour?
   @>Show Choices: Yes
   : When [Yes]
     @> Change Items: [Bat Hide], -2
     @> Change Armour: [Bat Robe], +1
     @>Text: -,-, Normal, Top
     :     : You sew the Bat Hides together and obtain a Bat Robe.
     @>Control Switches: [0011:Fashion 101] = OFF
     @>
   : Branch End
   @>
: Else
   @>Change Items: [Bat Hide], +1
   @>Control Variables: [0002:Bat Hides] = 1
   @>
: Branch End
@>
: Repeat Above
@>


This event is started by a battling event which works fine, but when the required number of Raw Materials is obtained nothing happens and the player is left with some essentially useless items.
If anyone has any ideas as to where I've gone wrong please let me know.
Thankyou happy.gif
TheBen
Your problem is that you set the variable "bat hides" instead of adding or subtracting it, as the case may be. At the first loop, you're setting "bat hides" to 1 when you want to add 1 to it...
CODE
@>Loop
  @>Conditional Branch: [Bat Hide] in Inventory
   @>Control Variables: [0002:Bat Hides] = 1 #You want to add 1 to "Bat Hides", not set it to 1
   @>Change Items: [Bat Hide], -1
   @>


And I think you might want to subtract 1 from "Bat Hides" near the end.
CODE
   @>
: Else
   @>Change Items: [Bat Hide], +1
   @>Control Variables: [0002:Bat Hides] = 1 #Maybe you meant "subtract 1"
   @>
: Branch End
@>


If this fix is implemented, then you'll want to set "Bat Hides" to 0 after the player makes his bat coat.

I hope this works. Don't worry about the errors - everyone makes these in their early years of game design. You'll get better at it.

PS Forgive me for any errors. This is largely untested work, and I'm still in my early years, too.
Alt_Jack
Dear god, what the ----- is that?! ohmy.gif
Let me first start off by saying this is an explanation of why this is wrong, rather than a verbal beat-down. So, let's walk you through this, based on my understanding of this mess:
QUOTE (Quackadoos @ Jun 28 2011, 11:53 AM) *
QUOTE
@>Loop (these are dangerous. Don't use them)
@>Conditional Branch: [Bat Hide] in Inventory (is there at least one bat hide in your inventory? Yes? Well.... )
@>Control Variables: [0002:Bat Hides] = 1 (set variable #002 to 1. Not add, subtract, or any other operation; just change it to 1 from any number you could possibly imagine. Now it's just 1. You'd typically use this to reset a value back to 0, rather than do any kind of math, which VX (as well as myself) is very bad at)
@>Change Items: [Bat Hide], -1 (then subtract one from your inventory for no reason)
@>
: Else
@>Conditional Branch: Variable [0002:Bat Hides] >= 2 (if there's more than 2, which isn't likely since, if I'm reading this right, the system will always loop subtracting a bat hide, if you have one. Actually, it doesn't even apply, since this is the value and doesn't really seem to effect anything. It just checks if the variable is >2, even though the system keeps setting it to 1, as per above )
@>Text: -,-, Normal, Top
: : You now have enough raw materials to make a special armour
: : Would you like to use your Bat Hides to make a special
: : armour? (well, duh)
@>Show Choices: Yes (I'm pretty sure that there's also a "No" option) : When [Yes]
@> Change Items: [Bat Hide], -2 ( you should also subtract it from the variable database, so that the numbers match up)
@> Change Armour: [Bat Robe], +1 (eewwwww! )
@>Text: -,-, Normal, Top
: : You sew the Bat Hides together and obtain a Bat Robe. (does it fit? Just how big are these bats?! )
@>Control Switches: [0011:Fashion 101] = OFF (where did this switch come from? It's not mentioned above, I don't think)
@>
: Branch End
@>
: Else
(this is getting random)
@>Change Items: [Bat Hide], +1
@>Control Variables: [0002:Bat Hides] = 1
@>
: Branch End
@>
: Repeat Above (hopefully not. What a mess... )@>

...and there you have it. I think my brain threw up trying to understand that. pinch.gif Try this instead:
http://www.rpgmakervx.net/index.php?showto...mp;#entry288794
you can also find scripts that call common events from menu commands. The engine I use has a bunch of scripts like this.
Quackadoos
Thanks guys, it's working now. Apologies for the messed up code, I had to start it again so that I could follow it sweat.gif
Turns out it was the variable thing that was messing it up, so thanks for clearing that up for me.
lilcooldude69
*cough cough*Control Variables: [002] = [Bat Hide] in Inventory*cough cough* scuse me xD... okay im sorry lemme elaborate, you can always set an item in your inventory to a variable then when that variable reaches a certain number like perhaps greater than 2 then you can trigger an event, also jack was right about loops, they are very dangerous, they can somtimes freeze your game if not done right, if you wanna loop, use jumpto labels, its safer S:
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.