Jump to content
Thordon123

Skill that adds user state BEFORE attack

Recommended Posts

Okay guys, so here's my issue, I'm trying to design a skill called Aimed Shot, which applies a state called Aim to the user that gives them +30% to hit and THEN attacks the enemy they've selected. I've already asked for help on the rpgmaker forums, and someone told me to use: 

 

a.add_state(26); a.atk * 4 - b.def *2

 

Except when I use that the game crashes and I get the error message

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

Script 'Game_Battler' Line 352: SyntaxError occured

Unexpected tSTAR, expecting $end
a.add_state(26); a.atk * 4 - b.def *2

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

I've tried putting the "end" everywhere but nothing works- not in the middle and not in the end. Does anybody know how to do this? I'm not much of a programmer so I'm pretty lost and the skill is essential for my combat system.

 

Thanks in advance!

Share this post


Link to post
Share on other sites

I got this from another post somewhere. put it in your script list.

In that case just use:
Code:
class Game_Battler < Game_BattlerBase

  def your_custom_skill(a, c)
    if $game_party.include?(c)
      a==c ? a.add_state(13) : (a.add_state(55); c.add_state(13))
    else
      a.add_state(54)
    end
  end

end
Call this method in your skill formula using
Code:
a.your_custom_skill(a, $game_actors[3])
It works even if you use
Code:
b.your_custom_skill(a, $game_actors[3])
because the method receives the caster as a parameter which is actually redundant.

 

Edited by roninator2

Share this post


Link to post
Share on other sites

Found the issue. Put a space in between the multiplying sign and the 2. I copy/pasted your formula and it gave me the same error. Here is how the formula should be:

a.add_state(26); a.atk * 4 - b.def * 2

 

Hope this helps! ^_^

Share this post


Link to post
Share on other sites

Hmm... I don't think that will work the way you want it to. I am pretty sure the default VX Ace scripts calculate the hit percentage before the damage. So no  matter what you do in the formula it won't effect if the skill hits.

 

Also here is a question: It appears to me like enemies may calculate the damage all of their possible actions can do before choosing one. Doesn't that mess up any skill that has some sort of side effect like a state change in the damage formula? True you could just have it so they are actor only skills, but I wonder if things like confusion/charm also do something like that?

Share this post


Link to post
Share on other sites
4 hours ago, Kayzee said:

Hmm... I don't think that will work the way you want it to. I am pretty sure the default VX Ace scripts calculate the hit percentage before the damage. So no  matter what you do in the formula it won't effect if the skill hits.

That is actually... correct. I didn't think of that. If you wanted to, for example, increase ATK by 50% before doing the damage, you could. But since it's hit rate, the skill needs to hit in order to put the state on you. Another option that will be useful is splitting the skill in two and using a follow-up script.

 

Follow-Up Script: https://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/follow-up-skills/

 

Let's say the skill is called Still Shot (ID is 86 and 87) (increases hit rate by 30% before shooting (State ID 45)).
Skill 1 (86): Still Shot: Hit Rate: Adds the state (use the effects section to add the state)
In notebox: <follow up 87: 100%>

Skill 2 (87): Still Shot: Attack: The actual damage (a.remove_state(45); [damage formula goes here])

Don't need parenthesis' on either.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×