Main Menu
  • Welcome to The RPG Maker Resource Kit.

Falcao Throw and hits events V 1.0 RMVX

Started by Dark_falcao, October 21, 2009, 02:24:44 PM

0 Members and 1 Guest are viewing this topic.

Dark_falcao

Hi

This script allow you throw any event on map just by equip any weapon like a bow also you can create event target to hit it

Features

- Allow you to throw events on map
- When you throw an event you can hit other event target then START
- Allow you create wepons like bow, boomerang or any tool you want
- Eeasy to use


Instructions

Place the script above main. Then put the following words in the
events command comments.

* Tool commands

WEAPON X     instead X put the weapon ID that represents the object
                    If weapon X is equiped you able to throw the event

ITEM X       Opcional. Instead X put the Item ID that the weapons will
                  spend. (Perfect to crate Bows) only work with WEAPON X

MULTIHIT    Opcional. The event object HIT a target more than one time
                   Perfect to create tools like boomerangs etc.

* Target comands

START        This comment make any event start when it is touched by
                  The event Object


You can create a lot of tools using this great utility


Credits

By Falcao


Demo

http://www.4shared.com/file/142433428/252b7ec4/Throw_and_hit_events.html



I recomend you to dowload demo but if you want the code only. here you go


#==================================================================#
#  #*****************#             Throw and Hit events 1.0        #
#  #*** By Falcao ***#             Allow you throw events objects  #
#  #*****************#             like arrows rocks etc.          #
#         RMVX                                                     #
# makerpalace.onlinegoo.com                                        #
#==================================================================#

module Falcao
 
# Game Variable that represent the Weapon ID in an event page
# Use it like a page condition variable
WeaponVariable = 50

end

#------------------------------------------------------------------------
# * Instructios
#
# Place the script above main. Then put the following words in the
# events command comments.
#
# * Tool commands
#
# WEAPON X     instead X put the weapon ID that represents the object
#              If weapon X is equiped you able to throw the event
#
# ITEM X       Opcional. Instead X put the Item ID that the weapons will
#              spend. (Perfect to crate Bows) only work with WEAPON X
#
# MULTIHIT     Opcional. The event object HIT a target more than one time
#              Perfect to create tools like boomerangs etc.
#
# * Target comands
#
# START        This comment make any event start when it is touched by
#              The event Object
#
# Note: You can create as many event object you nees so use the script
#       wisely
#
# Credits to Falcao (Sorry bad english im Salvadorian)
#-------------------------------------------------------------------------


class Game_Map
 attr_accessor :event_ref
 alias falcaosetupevent_set setup
 def setup(map_id)
   falcaosetupevent_set(map_id)
   @event_ref = false
   actor = $game_party.members[0]
   var = Falcao::WeaponVariable
   $game_variables[var] = actor.weapon_id
   falref_events
 end
 
 alias falcaosetupevent_update update
 def update
   if @event_ref
     falref_events
   end
   falcaosetupevent_update
 end
 
 def falref_events
   for event in @events.values
     event.refresh
     if event.weaponid != nil
       event.transparent = true
       event.through = true
     end
   end
   @event_ref = false
 end
end

class Game_Event < Game_Character
 attr_reader     :weaponid
 attr_reader     :blanco
 attr_reader     :itemid
 attr_reader     :multihit
 attr_accessor   :through
 attr_accessor   :page
 
 alias falcaoHIT_ref refresh
 
 def refresh
   crear_ini
   falcaoHIT_ref
   crear_comments
 end
 
 def crear_ini
   @weaponid = nil
   @itemid = nil
   @blanco = false
   @multihit = false
 end
 
 def crear_comments
   if @page != nil
     for i in @page.list
       if i.code == 108 or i.code == 408
         if i.parameters[0].upcase[/WEAPON/] != nil
           @weaponid = i.parameters[0].split[1].to_i
         end
         if i.parameters[0].upcase[/START/] != nil
           @blanco = true
         end
         if i.parameters[0].upcase[/ITEM/] != nil
           @itemid = i.parameters[0].split[1].to_i
         end
         if i.parameters[0].upcase[/MULTIHIT/] != nil
           @multihit = true
         end
       end
     end
   end
 end
 
 def activar
   return if @list.size <= 1                  
   @starting = true
   lock if @trigger < 3
   $game_map.interpreter.setup_starting_event
 end
end

class Game_Player < Game_Character
 def forzar_movimiento
   for event in $game_map.events.values
     if event.semueve == true
       lista = event.move_route.list.size - 1
       event.move_route.skippable = true
       if lista == event.move_route_index and lista != 0
         event.semueve = false
         event.transparent = true
         event.moveto(0, 0)
         $game_system.menu_disabled = false
       end
       return unless movable?
       case Input.dir4
       when 2;  move_down
       when 4;  move_left
       when 6;  move_right
       when 8;  move_up
       end
     end
   end
 end
end

class Game_Character
 attr_accessor :direction
 attr_accessor :semueve
 attr_accessor :move_route_index
 attr_accessor :move_route
 attr_accessor :move_failed
 alias falcaopegatinas_ini initialize
 def initialize
   falcaopegatinas_ini
   @objeto_x = 0
   @objeto_y = 0
   @semueve = false
 end
 
 alias falcaopegatinas_update update
 def update
   falcaopegatinas_update
   update_objects
   update_fevents
   $game_player.forzar_movimiento
 end
 
 def update_objects
   for event in $game_map.events.values
     if event.weaponid != nil and event.semueve == true
       @objeto_x = event.x
       @objeto_y = event.y
     end
     
     if event.blanco == true
       if event.x == @objeto_x and event.y == @objeto_y
         event.activar
         clear_hit
       end
     end
   end
 end
 
 def clear_hit
   for event in $game_map.events.values
     if event.semueve == true
       return if event.multihit
       event.move_failed = true
       event.transparent = true
       event.moveto(0, 0)
     end
   end
 end
 #----
 def update_fevents
   for event in $game_map.events.values
     return if event.semueve == true
     if Input.trigger?(Input::X)
       actor = $game_party.members[0]
       if event.weaponid != nil
         if actor.weapons.include?($data_weapons[event.weaponid])
           if event.itemid != nil
             item = $data_items[event.itemid]
             if $game_party.item_quantity(item.id) > 0
               set_event(event.id)
               $game_party.lose_item($data_items[item.id], 1)
             else
               return
             end
           else
             set_event(event.id)
           end
         end
       end
     end
   end
 end
 #----------------
 def set_event(id)
   event = $game_map.events[id]
   event.transparent = false
   cx = $game_player.x
   cy = $game_player.y
   event.moveto(cx, cy)
   event.direction = $game_player.direction
   $game_system.menu_disabled = true
   for i in event.page.list
     if i.code == 205
       event.start
       event.semueve = true
     end
   end
 end
end

class Scene_Equip
 alias falcao_set_update update
 def update
   actor = $game_party.members[0]
   var = Falcao::WeaponVariable
   $game_variables[var] = actor.weapon_id
   if Input.trigger?(Input::B)
     $game_map.event_ref = true
   end
   falcao_set_update
 end
end

class Game_Party < Game_Unit
 def item_quantity(item_id)
   return @items.include?(item_id) ? @items[item_id] : 0
 end
end

class Weaponsadd < Window_Base
 def initialize(x,y)
   super(x, y, 70, 66)
   self.opacity = 150
   self.visible = false
   refresh
 end

 def refresh
   self.contents.clear
   self.contents.font.name = "Times New Roman"
   self.contents.font.size = 16
   self.contents.font.bold = true
   draw_weapons
 end
 def draw_weapons
   for event in $game_map.events.values
     actor = $game_party.members[0]
     if actor.weapon_id == event.weaponid
       weapon = $data_weapons[event.weaponid]
       draw_icon(weapon.icon_index,5, 0)
       if event.itemid != nil
         item = $data_items[event.itemid]
         number = $game_party.item_quantity(item.id)
         self.contents.draw_text(10, 4, 50, 50, number.to_s)
       end
     end
   end
 end
end

class Scene_Map
 alias falcaoadd_weapons_main main
 def main
   crear_ventana
   falcaoadd_weapons_main
   borrar_ventana
 end
 def crear_ventana
   @fweapons = Weaponsadd.new(475,0)
 end
 def borrar_ventana
   @fweapons.dispose
 end
 alias falcaoadd_weapons_update update
 def update
   for event in $game_map.events.values
     if event.itemid != nil
       actor = $game_party.members[0]
       if actor.weapon_id == event.weaponid
         @fweapons.visible = true
         @fweapons.refresh
       else
         @fweapons.visible = false
       end
     end
   end
   falcaoadd_weapons_update
 end
end


Grafikal

Very cool. It'll help those who plan on making a mostly evented battle system.

Fizzly

Okay, I'll be honest. This is...                                 SO COOL! ;)
Thanks! :)
Regards,
Mike


momo

this is a nice script... im trying to use it this script to hit monsters with arrows but im having problems on the events  :'(  im making this monster event and im having problems in trying to get my monster to do this:
when monster get hit with arrows multiple times, movement change to move towards player and HP is drain or in state and when monster touches u after multiple times of being hits by arrow, then go to battle proccessing. can someone help me out please in making my monster to do this event ;9

Dogurasu

I greatly apologize for the necropost, but I do have a question concerning this particular script. Is there a way to make an event work with this script so that it only performs part of an event?

This is what I'm looking for:
1) When the event touches the player, a battle begins with enemies.
2) When the thrown weapon touches the event, it triggers something different: a self-switch, or a variable (that will eventually trigger the self-switch).

Bios

I have to agree that this is a very cool script! ;D but i want to help me (cause I'm a little noob :P) make a bomb item that will hit enemies (I use an action battle system) and also it pushes other events(like rocks etc.)Please help me :-\