Hello all, I recently have come up with a system that I think would be interesting in a game, but need a little help getting it to work right...
The concept: I want to have a character who has the ability to magically summon energy-based weapons. She will basically replace her current physical weapon with a magical one and do damage with the magical weapon based off her int at the time (so as she levels, the magical weapon becomes increasingly better). It should also cost MP to sustain that weapon, so every round she acts, she would lose some (whether she attacks that round or not)
My Approach: I figured in order to accomplish this, I would need to do two things... one I pegged as being simple and the other, I wasn't sure I could pull off. Let's start with the simple part.
1. I created a dummy weapon in weapon slot 2 called "Magic Weapon". It has no stats and is just a placeholder for the system.
2. I created a skill of the same name that also has no stats and consumes no SP. It is set to trigger Common Event 1.
3. I also named Common Event 1 the same as the weapon and skill and did two things in the code to start:
3a. I tried the following code to store her currently equipped physical weapon into a variable so that it would not be lost:
now I haven't actually tested to see if that actually works yet, it's just some BS I made up... but that's not important yet.
3b. After storing the weapon, I used the Change Equipment command to force the magical weapon as her equipped weapon.
4. Now here comes the tough part... I had to alter the script to make just that weapon work off int instead of atk...
Well, after I put it all together, I tested it through battle test. I had no other weapons yet, so I equipped her with nothing. Obviously an attack like does 0 damage, as expected. I then used the Magic Weapon skill and used the Attack command again. It still did 0 damage. My first thought was that my script was bad and did not tell the weapon how to calculate damage. So let's look back at my script for a second...
To make my script changes, I went to Game_Battler 3 and found something that looked like an area that calculated damage:
To do what I wanted, I BSed the following code in front of this:
my philosophy was to try to make a case searching for weapon #2 (which as I said is the Magic Weapon's dummy slot) and in that case change this portion of the algorithm to run on int. I then though in an else statement after it so that in all cases of actual physical weapons, it would run the default calculation.
Well, before saying for certain that I did this all wrong, I decided to test one more thing... I did a battle test and made her equipment the Magic Weapon to start (instead of relying on the skill to force it in). When I attacked this time, it did damage as expected. Amazingly, my scripting actually did what I wanted it to do, but the Common event was effectless? That just made me scratch my head...
I knew that I did stuff like this before in pre-XP RPG Makers... but then I realized something. Prior to this edition, if you wanted a skill to use a Common Event, you set the skill to turn on a switch. That switch could then be used to trigger the Common Event. Now that sounds like a more effective method of doing things all of a sudden... what's the secret with the change now? You would think that it's as simple as telling the skill to use that Common Event, but it doesn't look like it is. It just does nothing. Can anybody figure out what I'm doing wrong here?
Also, I didn't even begin to do the SP drain... I'm not sure how to approach that. Going back to Game_Battler 3, I can make it at least deduct upon attack... but that's not what I really want. I could probably make code in every single Troop instance that checks for the weapon being equipped and then deduct every round there... but that sounds painfully troublesome and ineffecient. Anyone have any suggestions on the easiest route to make SP deduct every battle round while the weapon is equipped?
The concept: I want to have a character who has the ability to magically summon energy-based weapons. She will basically replace her current physical weapon with a magical one and do damage with the magical weapon based off her int at the time (so as she levels, the magical weapon becomes increasingly better). It should also cost MP to sustain that weapon, so every round she acts, she would lose some (whether she attacks that round or not)
My Approach: I figured in order to accomplish this, I would need to do two things... one I pegged as being simple and the other, I wasn't sure I could pull off. Let's start with the simple part.
1. I created a dummy weapon in weapon slot 2 called "Magic Weapon". It has no stats and is just a placeholder for the system.
2. I created a skill of the same name that also has no stats and consumes no SP. It is set to trigger Common Event 1.
3. I also named Common Event 1 the same as the weapon and skill and did two things in the code to start:
3a. I tried the following code to store her currently equipped physical weapon into a variable so that it would not be lost:
Code:
$game_variables[1] = $game_actors[1].weapon_id
3b. After storing the weapon, I used the Change Equipment command to force the magical weapon as her equipped weapon.
4. Now here comes the tough part... I had to alter the script to make just that weapon work off int instead of atk...
Well, after I put it all together, I tested it through battle test. I had no other weapons yet, so I equipped her with nothing. Obviously an attack like does 0 damage, as expected. I then used the Magic Weapon skill and used the Attack command again. It still did 0 damage. My first thought was that my script was bad and did not tell the weapon how to calculate damage. So let's look back at my script for a second...
To make my script changes, I went to Game_Battler 3 and found something that looked like an area that calculated damage:
Code:
atk = [attacker.atk - self.pdef / 2, 0].max
self.damage = atk * (20 + attacker.str) / 20
To do what I wanted, I BSed the following code in front of this:
Code:
if $game_actors[1].weapon_id == 2
atk = [attacker.int - self.mdef / 2, 0].max
my philosophy was to try to make a case searching for weapon #2 (which as I said is the Magic Weapon's dummy slot) and in that case change this portion of the algorithm to run on int. I then though in an else statement after it so that in all cases of actual physical weapons, it would run the default calculation.
Well, before saying for certain that I did this all wrong, I decided to test one more thing... I did a battle test and made her equipment the Magic Weapon to start (instead of relying on the skill to force it in). When I attacked this time, it did damage as expected. Amazingly, my scripting actually did what I wanted it to do, but the Common event was effectless? That just made me scratch my head...
I knew that I did stuff like this before in pre-XP RPG Makers... but then I realized something. Prior to this edition, if you wanted a skill to use a Common Event, you set the skill to turn on a switch. That switch could then be used to trigger the Common Event. Now that sounds like a more effective method of doing things all of a sudden... what's the secret with the change now? You would think that it's as simple as telling the skill to use that Common Event, but it doesn't look like it is. It just does nothing. Can anybody figure out what I'm doing wrong here?
Also, I didn't even begin to do the SP drain... I'm not sure how to approach that. Going back to Game_Battler 3, I can make it at least deduct upon attack... but that's not what I really want. I could probably make code in every single Troop instance that checks for the weapon being equipped and then deduct every round there... but that sounds painfully troublesome and ineffecient. Anyone have any suggestions on the easiest route to make SP deduct every battle round while the weapon is equipped?