I need a battle script about audio!

Discussion in 'RGSS Script Requests' started by Charbomber, May 29, 2018.

  1. Charbomber

    Charbomber Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    I need a script so when certain characters e.g. the main character, the second main character, ect. get hit or hit something, they make a noise, the noise is different for hitting and getting hit, and different for every character. Is it possible and can i have it please?
     
    #1
  2. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    12,272
    Likes Received:
    12,498
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA

    I've moved this thread to RGSSx Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.

     
    #2
  3. mlogan

    mlogan Global Moderators Global Mod

    Messages:
    13,837
    Likes Received:
    7,638
    Location:
    Texas
    First Language:
    English
    Primarily Uses:
    RMMV
    Can I make a suggestion that you change the title to something more specific, as this whole section is about scripts that are needed. A relevant title will allow members to know better whether they can help or not without needing to read the whole post.

    In addition, you might try not using all caps, as it makes it seem as if you are shouting at people.
     
    #3
  4. Charbomber

    Charbomber Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    thanks for the suggestion
     
    #4
  5. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,731
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    Take a look at mog hunter scripts. I do remember in his demo the characters made noises when they got hit or died
     
    #5
  6. Charbomber

    Charbomber Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    but i mean for different people and for hitting things
     
    #6
  7. GGZiron

    GGZiron Veteran Veteran

    Messages:
    75
    Likes Received:
    25
    Location:
    Bulgaria
    First Language:
    Bulgarian
    Primarily Uses:
    RMVXA
    Here I made something for you.
    Code:
    module Play_battle_sound
    
    =begin
    Author: GGZiron
    Terms of use: Free for comercial and uncomercial projects. You have to credit
    me as GGZiron
    Version 1.0.1
    Date of release 30.05.2018
    
    About the script: It allows the actors to produce sound when hit or being hit
    during battle.
    =end
    # Key values must represent the actor's id, and the string
    # is the filename (without the extension)  of sound he/she ll produce
    # Do not try to use sound files that rpg maker cannot play.
    # The sound file is from the SE directory or SE built in RTP resourses.
      ACTOR_ATTACKS ={
      1 => "Blow2",  #in this example, actor with ID 1 will use
                         #sound named "Blow2" from the directory when attack.
      #add more entries
      }             
      ACTOR_IS_HIT ={
      1 => "Blow2",  #in this example, actor with ID 1 will try to use
                         #sound named "Blow2" from the directory when hit.
      #add more entries
      }
    # WARNING: Do not add actor with invalid sound name. That will give error!!!
    # Don't include actors you don't want to have sounds.
    
      #Set what volume and pitch will have the actor's sound
      SOUND_VOLUME = 100
      SOUND_PITCH  = 100
    end
    
    class Game_Battler < Game_BattlerBase
    #===========================Edited Methods===================================
      alias_method :execute_damage_old, :execute_damage
      def execute_damage(user)
        execute_damage_old(user)
        set_battle_sound(user, true) if @result.hp_damage > 0 && self.actor?
      end
      alias_method :item_apply_old, :item_apply
      def item_apply(user, item)
        set_battle_sound(user, false) if user.actor?
        item_apply_old(user, item)
      end
    #============================================================================
    #===========================New Method=======================================
      def set_battle_sound(user, attacked)
        if self.actor? && user.actor?
         return if self.id == user.id
       end
        sound = attacked ? Play_battle_sound::ACTOR_IS_HIT[self.id] : Play_battle_sound::ACTOR_ATTACKS[user.id]
        volume = Play_battle_sound::SOUND_VOLUME
        pitch = Play_battle_sound::SOUND_PITCH
        Audio.se_play("Audio/SE/" + sound, volume, pitch) if sound
      end
    #============================================================================
    end 
    

    Knowing myself, soon I could update some expressions and stuffs I dislike. Is not heavely tested for bugs, just it worked on my playtest. Did not tried everything possible. So, test it too, and tell if works. If no, tell me what's wrong with it.
    Edit: The terms of use are in the script's header.
    Edit 2: The default sounds I set for actor 1 are more than inadequate. They are just for testing purpose, so you edit them if you actually use actor 1.
    Edit 3: Did minor touch, just removed the use of variable, that is not really needed.
     
    Last edited: May 30, 2018
    #7
    Charbomber likes this.
  8. Charbomber

    Charbomber Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    ok, cool!
     
    #8
  9. Charbomber

    Charbomber Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    #9
  10. Charbomber

    Charbomber Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    There is no battler base, remember i want an RPG maker XP script! (just saying, just in case this is an RPG maker VX ace thing. Sucks when you find bugs :/
     
    Last edited: May 31, 2018
    #10
  11. Charbomber

    Charbomber Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    oh i see they thought it was a VXA script request
     
    #11
  12. hiddenone

    hiddenone Lurker Extraordinaire Moderator

    Messages:
    1,985
    Likes Received:
    4,698
    First Language:
    english
    Primarily Uses:
    RMMV

    I've moved this thread to RGSS Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.


    If you don't mention what engine you're using, then people will usually assume that you're talking about whatever engine is listed on your 'Primarily Uses'. :)
    Also @Charbomber , please don't double post just edit your previous post if you have something more to add.
     
    #12
  13. Charbomber

    Charbomber Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    ok, thanks, sorry
     
    #13
  14. DerVVulfman

    DerVVulfman Resident Werewolf Veteran

    Messages:
    305
    Likes Received:
    149
    First Language:
    English
    Primarily Uses:
    RMXP
    Dalissa's Battle Cry
    http://save-point.org/thread-2579.html

    Geez, I hadn't worked on this thing for a decade. I'm sure I 'could' pen a better version now.... But you will see from the demo that it works.
     
    #14

Share This Page