Script formatting help: "Different item effects in and out of battle"

Discussion in 'RGSS3 Script Requests' started by Romanticist, Jun 3, 2019.

    Tags:
  1. Romanticist

    Romanticist Veteran Veteran

    Messages:
    161
    Likes Received:
    84
    First Language:
    English
    Primarily Uses:
    RMVXA
    Here's another case of old script code being jumbled up due to forum formatting errors.
    I have been fixing the formatting of many scripts by myself lately, but I cannot figure this one out. So, any help is appreciated.

    Code:
    #==============================================================================# Different effects outside the battle# By Lecode#----------------------# Use <when_outside: x> on skills and items notetags.# When the party is outside, the effects of the skill/item with # the ID x w'll be used instead of the selected skill/item's effects#==============================================================================module Lecode_ItemOutside def self.get_outside_item(item) return item if $game_party.in_battle other_id = item.outside_item_id if other_id > 0 if item.is_a?(RPG::Skill) return $data_skills[other_id] elsif item.is_a?(RPG::Item) return $data_items[other_id] end end return item end endclass Scene_ItemBase def use_item_to_actors true_item = Lecode_ItemOutside.get_outside_item(item) item_target_actors.each do |target| true_item.repeats.times { target.item_apply(user, true_item) } end end endclass Game_Battler def use_item(item) pay_skill_cost(item) if item.is_a?(RPG::Skill) consume_item(item) if item.is_a?(RPG::Item) true_item = Lecode_ItemOutside.get_outside_item(item) true_item.effects.each {|effect| item_global_effect_apply(effect) } end endclass RPG::UsableItem def outside_item_id self.note =~ /<when_outside:[ ]?(.+)>/ ? $1.to_i : 0 end end 
    Here's the original thread: https://forums.rpgmakerweb.com/index.php?threads/different-item-effects-in-and-out-of-battle.43837/
    Thank you :)
     
    #1
  2. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,513
    Likes Received:
    323
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    Fixed in the thread, but haven't tested.
     
    #2
    Romanticist likes this.
  3. Romanticist

    Romanticist Veteran Veteran

    Messages:
    161
    Likes Received:
    84
    First Language:
    English
    Primarily Uses:
    RMVXA
    Thank you! It half-works, it does use a different effect outside of battle, but inside battle the item's default effect doesn't work. :kaodes:
     
    #3
  4. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,513
    Likes Received:
    323
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    I just tested it. It's working for me. What is the item/skill you are trying to perform?
     
    #4
  5. Romanticist

    Romanticist Veteran Veteran

    Messages:
    161
    Likes Received:
    84
    First Language:
    English
    Primarily Uses:
    RMVXA
    I have an "Escape Rope" similar to Pokemon, but then during battle I want it to allow you to escape from battle.
    I have 2 items, the first one was my original Escape Rope, but I made a second one with the Escape from battle function; I have the second one call the original one with the notetag "<when_outside: 327>". It successfully calls the original effect outside of battle, but does not call its own effect of escaping from battle.
    In other words, with the notetag, it will successfully replicate the item that it is calling, but its own effect (the Special Effect "Escape") is negated.
     
    #5
  6. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    11,613
    Likes Received:
    11,606
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    FYI, special effect escape is meant to be monster use only. You'll see why if you ever use it in battle but someone is KO'd, you'll get a Game Over, as all special effect Escape does is it removes you from the battle party.

    You'll probably want to make it call a common event instead.
     
    #6
    Romanticist likes this.
  7. Romanticist

    Romanticist Veteran Veteran

    Messages:
    161
    Likes Received:
    84
    First Language:
    English
    Primarily Uses:
    RMVXA
    :kaoswt2: Well, that would explain it then... Whoops! Wish that was more clear haha.
    I'll see what I can do with a common event but I'm not sure how to escape from battle in an event. Do I just abort the battle?

    EDIT: Yeah, aborting the battle works fine, but I would like it to play the escape message. Is there any way to do this? Actually, I'll just replicate the message and sound effect in the common event.

    Well, this works now. Thanks, to the both of you! :LZSsmile:
     
    #7

Share This Page