Help with script

● ARCHIVED · READ-ONLY
Started by Saltylanguage 10 posts View original ↗
  1. Is there a way I can make an attack apply a status ailment to the player who is attacking?  

    I want to add a "bloody" status ailment to a character when he uses a basic attack.  This may also be used later for a berserk type state.
  2. yes, this can be done by using commands in the damage formula.

    There is a topic "how to get most of the custom damage formula" where a lot of possible effects are discussed, search for it for details.

    But basically you add another command to the damage formula line, add a semicolon and then add the regular damage formula for the skill:

    Code:
    a.add_state(stateid); regular damage
    I haven't checked for syntax - for details look for that topic.
  3. So I tried to do this and it works but the only problem is that all characters use the attack skill.  I want this to only apply to the main character.  Is there a way to make it so that only 1 character will receive the status effect when using this skill, while others can attack freely with no restrictions?
  4. I've moved this thread to VX Ace Support. Please be sure to post your threads in the correct forum next time. Thank you.

    a.add_state(stateid) if a.actor? and a.id == actorid; regular damage
    where stateid is the ide of the state, and actorid is the id of the actor you want to receive the state when he attacks. Avoid leading zeros.


    I've also added a.actor? to ensure it only happens to actors, not enemies, as they probably also use the attack skill (I don't have Ace in front of me to verify that).
  5. they usually do, but only if they are set to.
  6. Ok thank you guys very much!  There is two last things that would make this absolutely perfect.  I'll start with what I think is easier.   So the two things are:

    1)  I want this status ailment to only be applied AFTER a skill has been learned.  I am assuming this will work in a similar fashion to the applying it to a specific actor in that I specify that the status is only applied if actor A has skill_id X?

    2)  Is there anyway to make a status ailment have multiple stacks.  (I want him to be able to stack charges of "bloodied" and use them for blood magic)

    Other than that this is working perfectly.  He attacks and it applies the ailment, which allows me to use a certain skill the next turn which in turn removes the ailment disabling the move until my next successful attack goes through.  It is a lovely thing when things work!  Thanks guys!
  7. For the first one:

    a.add_state(stateid) if a.actor? && a.id == actorid && a.skill_learn?(skillid); regular damageDon't use leading zeros for stateid, actorid or skillid.
    Don't know anything about stacking.
  8. Thank you so much!  That sovles my immediate problem.  Now I just have to figure out how to stack a status ailment multiple times. lol
  9. You can simulate a status ailment being "stacked" multiple times by creating multiple states (for example "Bloodied 1", "Bloodied 2", etc.) and using conditional branches when you're about to apply the Bloodied state to check whether the character already has one applied, and if so, apply the next most-severe state.  In practice, doing so will require some basic to intermediate scripting.

    For example, this is the normal "Make damage value" method:

    #-------------------------------------------------------------------------- # * Calculate Damage #-------------------------------------------------------------------------- def make_damage_value(user, item) value = item.damage.eval(user, self, $game_variables) value *= item_element_rate(user, item) value *= pdr if item.physical? value *= mdr if item.magical? value *= rec if item.damage.recover? value = apply_critical(value) if @result.critical value = apply_variance(value, item.damage.variance) value = apply_guard(value) @result.make_damage(value.to_i, item) endUsing Shaz's logic above, you could make it into:

    #-------------------------------------------------------------------------- # * Calculate Damage #-------------------------------------------------------------------------- def make_damage_value(user, item) if (item.id == 1 && user.actor? && user.id == actorid && user.skill_learn?(skillid)) if user.state?(28) if user.state?(29) user.add_state(30) else user.add_state(29) end else user.add_state(28) end end value = item.damage.eval(user, self, $game_variables) value *= item_element_rate(user, item) value *= pdr if item.physical? value *= mdr if item.magical? value *= rec if item.damage.recover? value = apply_critical(value) if @result.critical value = apply_variance(value, item.damage.variance) value = apply_guard(value) @result.make_damage(value.to_i, item) endHere, State 28 is "Bloodied", State 29 is "Bloodied 2 Stacks", and State 30 is "Bloodied 3 Stacks".  You could, in theory, chain it for as long as you want to.  What this new code is doing is checking to see whether the actor is Bloodied - if not, it applies State 28 Bloodied.  But if they already are, it checks whether they have Bloodied 2.  If not, it applies Bloodied 2.  If so, it applies Bloodied 3.

    I had to add one new condition since this is now being defined in a script rather than a skill formula box: if item.id == 1 .  I haven't tested this code, so if it blows up in your face, I probably used an incorrect term right here.  What this is doing is checking to see whether it's a Normal Attack (defined automatically in the database as Skill #1).  Note that this does NOT discriminate between skills and items, so that Item #1 would, in theory, also applied Bloodied to the user.  There are ways around this, but I don't want to complicate things further, so if you use this bit of code as is, be sure you don't use Item #1 (Potion, by default) in your game.  Just copy it to a different database entry besides #1.

    Finally, if you want to "spend" Bloodied stacks on skills using this system, that can also be done, but the scripting is even more complicated than the above.  If you want to start doing stuff like this, develop some proficiency at scripting, and you'll be able to create these cool effects wherever you please.
  10. I am so sorry for not replying to this.  This is a wonderfully creative idea and I think it will serve my purposes.  I got distracted with other things and haven't had the time to work on my RPG in a couple months and this slipped my mind.  Your solution has sparked my drive to start up again!  Thanks a bunch!  This was incredibly helpful thank you to all those who helped!