Dev - Gamemaker New equip-based magic system (Read 245 times)

  • Group: Member
  • Joined: Sep 10, 2003
  • Posts: 9
Hello everyone,

I'm working on a custom magic system for RPGmaker XP. The idea isn't completely unique but I'm building it from the ground up. What I'm looking for is input and advice on making it run smoothly.

The idea is this:

Player Bob has no magic spells. When Player Bob equips a Flame Orb, he learns the Fireball spell. When he unequips the Flame Orb he also loses his newly learned spell. Upon equipping a Frost Orb, he learns the appropriate ice-based spell and then loses it once he removes the orb. Party members can be customized by attaching different orbs according to the user's desire.

Another feature is that the orbs grow with the player. Once Player Bob reaches level 10, he not only gains the Fireball spell but also gains a Fireblast spell. Once unequipped, he loses both. If the Frost orb is equipped, he gets two spells at level 10 just like the Flame Orb. Each Orb grows differently, and new spells are gained for each level "milestone".

On to the code!

-------------

Since I have no experience with RGSS, I'm scripting this using a Common Event. My idea is to use a parallel process that checks if the player has any orbs equipped.

It would look like this:



The event checks if the Flame Orb is equipped, and grants the appropriate spells. The "else" case at the bottom removes the spells if the Flame Orb is not equipped.

Since I couldn't find a "If player's level = ?" conditional branch, I had to store the player's level into a variable and then check the variable for the proper spells to be learned. When I add more spells to the Orbs, it will check for levels 10, 20, 30 and so on. It's easily adjustable if needed.

If more orbs need to be added, it's a simple copy+paste as long as you change the Orb type and the spells learned/unlearned.

However, there are some flaws with my code that I need help with!

--------------

Upon entering the menu to equip/unequip spells, I noticed that the character will only learn/unlearn after you exit and re-enter the menu. It would be nice if it was instant, but the Common Event only checks the orbs if you're outside of the menu. Probably not a big deal, but it would be nice to find a way to make it instantly change.

If, for example, I was going to use 5 elements I would have to make the event check for 5 different orbs. If I had 4 party members, it would have to check for 5 orbs for 4 party members. This means it's checking for 20 orbs at all times. The only way I could think to make this work was with a parallel process, which could eat up CPU resources. If you're running a big map with a lot of moving parts, the Orb common event could cause problems (but I haven't tested it yet). Maybe there is a way to simplify the code?

I have a theory: A special shop/NPC could be used to control the use of the Orbs. If a player wanted to change their Orb, they would have to go to the special NPC to make the adjustment. This would make the Common Event be called on demand, without the need for it to run 24/7 as a parallel process. However, I can't work my head around that yet.
  • *untis* *untis* ^
  • PipPip
  • Group: Member
  • Joined: Feb 11, 2008
  • Posts: 247
Have you ever played final fantasy IX, by any chance?
How about no!? You are an idiotic version of a baboon.
  • Group: Member
  • Joined: Sep 10, 2003
  • Posts: 9
Yep, I've played Final Fantasy IX. It is very possible to create a Final Fantasy IX system where characters can learn abilities permanently. I thought it would offer more strategy by not making spells permanent. If every character knew every spell, it begins to make the game too easy.

You could compare my "orb system" to Final Fantasy VII and IX, I suppose. There is room for more depth if I decided to add character-based spells (Bob gets a Fireball from Fire Orb, but Joe gets a strength increase spell from Fire Orb). I can even add passive stat gains from just having the Orb equipped (ATK boost from fire, speed boost from Thunder, etc). The sky is the limit, heh.
  • Avatar of Ragnar
  • Worthless Protoplasm
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Premium Member
  • Joined: Jun 15, 2002
  • Posts: 6536
if that code is on all the time it'll freeze your game to hell. Either insert a 0.0 second wait command inbetween checks (at the absolute bottom of the event page) or make the fire ring/orb item not equipment but a common (?) item that triggers a switch when you use it in the menu instead. I forget if items in RPG Maker can directly call an event when you use them
http://djsaint-hubert.bandcamp.com/
 
  • Is this the face of a guy you can trust !?
  • PipPipPipPip
  • Group: Member
  • Joined: Dec 15, 2006
  • Posts: 405
I am not too sure with XP but in Rm2k/3 this has been done in Legion Saga II - III (I don't remember if the 1st one have this).

But yes, you have to exit and re-enter the menu again to have the spells appear in your skill menu. Frankly you can just put this note  (i.e. "due to Rm2k3 limitation etc etc") in the game and it still wouldn't be a big issue (pressing menu button twice?! I am too lazy for that!?).

Or you know, have the common event run before battle (to make sure they have the appropriate skill in battle). That's what I do anyway. (tough luck with healing spells).

Sprites and Stuff
  • Group: Member
  • Joined: Jun 14, 2005
  • Posts: 27
Does the common event menu give you access to Arrays?
Comrade!