Help - Search - Members - Calendar
Full Version: Weapon Cast Spells
RPG RPG Revolution Forums > Game Engines > RPG Maker VX Discussion
Rastanatsta
Does anyone know how to make it so that a weapon for example has a 10% chance of casting Quake?

Thank you
Kread-EX
Do you want the weapon to cast the spell instead of performing the attack, or do both one after the other ?
redyugi
Either of what he might be asking would require a script. I suggest you go here, Here, and search for the script
Have a nice day
Kread-EX
Yes, he needs a script. But if I don't mind writing it, if he doesn't find one.
redyugi
I think one or two might have already been written, but hey, its your choice. But I think the OP should search for it first, see if he/she likes the ones available, and if he/she doesn't, then you could write it.
leongon
I see easy to do that with the Tankentai SBS action sequences, but on default Battle System I think you need an script specially for what you want.
Rastanatsta
I searched the scripts for the one I asked for, nothing on the two pages I defined the search for.

I'm using the "Tankentai SBS" so is it easy to do on that?

I want a sword that does a normal hit but may do a magical attack instead that is more powerful.

For me: I wanted a earth sword that has a 10% of doing quake instead of attacking. smile.gif

Thank you ever so much.
leongon
The Tankentai SBS can manage variables and switches into the action sequence of an attack. For example: at the beginning you can set a random number between 1 and 10 into a variable, then check that variable if it's =1 (1 of 10 is 10%) link to your quake, doing the normal attack followed by quake. I'm not sure if it's possible to set a random number from T-SBS actions, if not, I'm sure it still can handle scripts to run a simple one that adds a random number into a variable... also can be done as a common event in the skill I think.You'll need to set a switch or variable to be checked as "actor has the sword with the chance to proc quake" on the normal attack sequence, to limit to the correct actor with the correct weapon, the chance to launch that skill. Or use a state... I mean, when equip that weapon you can add an invisible state to that actor, that can be used to do the "actor has the sword with the chance to proc quake" check in the action sequence.



So, play around with variables, conditionals and link-skills action sequences into SBS configuration to match that kind of effects you want. Must be confusing for beginners, but nothing that can't be done on trial and error.


Hope that helps... If you can understand my english tongue.gif
Kread-EX
Okay, it took me some time to sudy a little the Tankentai SBS and I found a simple way.

Create a new script section under the SBS and paste this:

CODE
#The first number is the ID of the weapon. The second, the ID of the skill.
#The third is the probability (should be 0-100).
MAGIC_WEAPONS = {2 => [74, 50]}


class Scene_Battle < Scene_Base
  alias_method  :krx_mw_execute_action, :execute_action
  def execute_action
    if MAGIC_WEAPONS.keys.include?(@active_battler.weapon_id) &&
      @active_battler.action.attack? &&
      (rand(101) >= (100 - MAGIC_WEAPONS[@active_battler.weapon_id][1]))
      @active_battler.action.set_skill(MAGIC_WEAPONS[@active_battler.weapon_id][0])
    end
    krx_mw_execute_action
  end
end


I tested it and it works perfectly.
Rastanatsta
Thank you smile.gif I'm sure it works great... I'm no good at scripting so can you tell me where I went wrong please. smile.gif

QUOTE
#The first number is the ID of the weapon. The second, the ID of the skill.
#The third is the probability (should be 0-100).
MAGIC_WEAPONS = {8 => [74, 80]}


class Scene_Battle < Scene_Base
alias_method :krx_mw_execute_action, :execute_action
def execute_action
if MAGIC_WEAPONS.keys.include?(@active_battler.weapon_id) &&
@active_battler.action.attack? &&
(rand(101) >= (100 - MAGIC_WEAPONS[@active_battler.weapon_id][1]))
@active_battler.action.set_skill(MAGIC_WEAPONS[@active_battler.weapon_id][0])
end
krx_mw_execute_action
end
end


That's with my information in.

1) Weapon = 8 = Earth breaker
2) Skill = 74 = Quake
3) 80% chance.

However I get this message.


Thank you again for your time.
Kread-EX
Indeed, I forgot a little something.

CODE
#The first number is the ID of the weapon. The second, the ID of the skill.
#The third is the probability (should be 0-100).
MAGIC_WEAPONS = {8 => [74, 80]}


class Scene_Battle < Scene_Base
alias_method :krx_mw_execute_action, :execute_action
def execute_action
if @active_battler.is_a?(Game_Actor) && MAGIC_WEAPONS.keys.include?(@active_battler.weapon_id) &&
@active_battler.action.attack? &&
(rand(101) >= (100 - MAGIC_WEAPONS[@active_battler.weapon_id][1]))
@active_battler.action.set_skill(MAGIC_WEAPONS[@active_battler.weapon_id][0])
end
krx_mw_execute_action
end
end


I just forgot to differentiate the actors from the enemies. Sorry about that.

By the way... your configuration is good. Also, note that the skill will consume MP. So you need to set it to 0 consumption if you don't want this.
Rastanatsta
Thank you so much!!

I take it I can do more than 1 weapon by copying the script again underneath between the two "end's". smile.gif

EDIT: Sorry I worked it out! Thank you again.
leongon
Excelent

You can post this script as some "Attack Command Swap with Weapon" add on for T-SBS, lot of ppl would appreciate it.
Kread-EX
If you want. But it's more a "general" add-on, since it works without the Tankentai SBS...
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.