iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

The 2nd Quarter Contest has arrived! Go check it out in the Community Announcements now!
 
Reply to this topicStart new topic
> Grab-pickup system, i already have the script, take a look
Lord Mephisto
post Feb 18 2012, 12:19 AM
Post #1



Group Icon


Type: Designer




ok, the thing is easy... i got the vampyr pick up script, wich i think is good, you can grab and throw, but you can also push the events. Vlad makes allways good scripts, the thing here is that vlad never places the correct way 2 use the scripts... so, he says in the instructions just write in notes "push" or w/e. but, dosnt work... can a good scripter read it fast and tell us how this works?

here it is the script:
CODE

#==============================================================================
# Vampyr Grab
#==============================================================================
if Vampyr_Kernel.enabled?("Vampyr Character Core")
#------------------------------------------------------------------------------
Vampyr_Kernel.register("Vampyr Grab", 1.0, "09/01/2009")
#------------------------------------------------------------------------------
Grab_Button = Input::C # Button used to hold the object

Move_Sound = "Push" # Sound played when you move the object

Throw_Sound = "Earth1" # Sound playerd when you yhrow the object

Hit_Animation_id = 84 # Animation showed when object colide when something

Item_Needed = 0 # ID of Item needed to allows player to grab objects

# Add folowing comments in a event that will be a movable object:
# Grabable - Allows the event to be grabable and pushable;
# Throwable - Allows the event to be throwable;

# Add folowing comments in a event that will be a place to put the object:
# Place X . Change X to ID of Event taht is the Object;
# Place Self Switch A: If Object is above the Place, self switch A will be activated;
# Place Self Switch B: If Object is above the Place, self switch B will be activated;
# Place Self Switch C: If Object is above the Place, self switch C will be activated;
# Place Self Switch D: If Object is above the Place, self switch D will be activated;
# Place Switch X: If Object is above the Place, switch X will be activated;
# Place Variable X: If Object is above the Place, variable X will increased +1;

#------------------------------------------------------------------------------

class Game_Player < Game_Character

attr_accessor (:grabbed, :grabbed_event)

alias vampyr_grab_gplayer_update update
alias vampyr_grab_gplayer_dash dash?

def update
vampyr_grab_gplayer_update
update_grab
end

def move_by_input
if Vampyr_Kernel.enabled?("Vampyr SBABS")
return if self.freeze or (self.anime_attack/2) > 0
end
return unless movable?
return if $game_map.interpreter.running?
case Input.dir4
when 2
return unless move_grabing?(2)
move_down
grab_event(2)
when 4
return unless move_grabing?(4)
move_left
grab_event(4)
when 6
return unless move_grabing?(6)
move_right
grab_event(6)
when 8
return unless move_grabing?(8)
move_up
grab_event(8)
end
end

def update_grab
return unless Item_Needed <= 0 or $game_party.has_item?($data_items[Item_Needed])
for event in $game_map.events.values
if event.grabable and Input.press?(Grab_Button) and in_front?(self, event) and !Input.trigger?(Input::C)
next if event.grabbed
@grabbed_event = event
old_direction_fix = @direction_fix
old_event_dir_fix = event.direction_fix
@direction_fix = true
event.direction_fix = true
event.move_speed = 4
event.grabbed = true
elsif Input.trigger?(Input::C) and event.throwable and event.grabbed
RPG::SE.new(Throw_Sound, 80).play if Throw_Sound != ""
event.direction_fix = false
event.set_direction(@direction)
event.direction_fix = true
event.move_speed = 6
event.throw = true
event.grabbed = false
@grabbed_event = nil
elsif !Input.press?(Grab_Button)
if event.grabbed
event.direction_fix = old_event_dir_fix
event.grabbed = false
end
@direction_fix = old_direction_fix
@grabbed_event = nil
end
end
end

def grab_event(dir)
return if @grabbed_event.nil?
return if @grabbed_event.moving?
case dir
when 2
@grabbed_event.move_down
when 4
@grabbed_event.move_left
when 6
@grabbed_event.move_right
when 8
@grabbed_event.move_up
end
RPG::SE.new(Move_Sound, 80).play if Move_Sound != ""
end

def move_grabing?(dir)
return true if @grabbed_event.nil?
return false if events_xy(@grabbed_event, dir)
return false if !is_passable?(@grabbed_event, dir)
case dir
when 2
return false if events_xy(self, dir) and @direction != 2
return false if !is_passable?(self, dir)
when 4
return false if events_xy(self, dir) and @direction != 4
return false if !is_passable?(self, dir)
when 6
return false if events_xy(self, dir) and @direction != 6
return false if !is_passable?(self, dir)
when 8
return false if events_xy(self, dir) and @direction != 8
return false if !is_passable?(self, dir)
end
return true
end

def dash?
return false unless @grabbed_event.nil?
vampyr_grab_gplayer_dash
end

end

#------------------------------------------------------------------------------
class Game_Event < Game_Character

attr_reader (:grabable, :throwable, :place, :place_self_switch_a, :place_self_switch_b,
:place_self_switch_c, :place_self_switch_d, :place_switch, :place_variable)
attr_accessor (:grabbed, :throw)

alias vampyr_grab_gevent_initialize initialize
alias vampyr_grab_gevent_update update
alias vampyr_grab_gevent_refresh refresh
alias vampyr_grab_gevent_check_event_trigger_touch check_event_trigger_touch

def initialize(map_id, event)
@grabable = false
@grabbed = false
@throwable = false
@throw = false
@place = false
@place_properties = false
vampyr_grab_gevent_initialize(map_id, event)
end

def update
vampyr_grab_gevent_update
throwself if @throw
put_in_place
end

def refresh
vampyr_grab_gevent_refresh
@grabable = check_comment("Grabable")
@throwable = check_comment("Throwable")
@place = check_value("Place")
@place_self_switch_a = check_comment("Place Self Switch A")
@place_self_switch_b = check_comment("Place Self Switch B")
@place_self_switch_c = check_comment("Place Self Switch C")
@place_self_switch_d = check_comment("Place Self Switch D")
@place_switch = check_value("Place Switch")
@place_variable = check_value("Place Variable")
end

def throwself
move_forward unless moving?
@throw = false if stopping?
end

def check_event_trigger_touch(x, y)
vampyr_grab_gevent_check_event_trigger_touch(x, y)
return unless Vampyr_Kernel.enabled?("Vampyr SBABS")
for event in $game_map.events.values
next unless event.x == x and event.y == y and event.in_battle and @throw
event.animation_id = Hit_Animation_id
event.actor.attack_effect($game_player.actor)
@throw = false
end
end

def put_in_place
for event in $game_map.events.values
next if event == self
next unless event.place > 0
next if @id != event.place
next unless @x == event.x and @y == event.y
if event.place_self_switch_a
key = [$game_map.map_id, event.id, "A"]
$game_self_switches[key] = !$game_self_switches[key]
elsif event.place_self_switch_b
key = [$game_map.map_id, event.id, "B"]
$game_self_switches[key] = !$game_self_switches[key]
elsif event.place_self_switch_c
key = [$game_map.map_id, event.id, "C"]
$game_self_switches[key] = !$game_self_switches[key]
elsif event.place_self_switch_d
key = [$game_map.map_id, event.id, "D"]
$game_self_switches[key] = !$game_self_switches[key]
elsif event.place_switch > 0
$game_switches[event.place_switch] = !$game_switches[event.place_switch]
elsif event.place_variable > 0
$game_variables[event.place_variable] += 1
end
$game_map.need_refresh = true
end
end

end

#------------------------------------------------------------------------------
end

i hope you guys can help. and ty btw.

This post has been edited by Lord Mephisto: Feb 18 2012, 08:54 PM


--------------------
Go to the top of the page
 
+Quote Post
   
Scinaya
post Feb 18 2012, 11:36 AM
Post #2


Spreading the Valentine's joy
Group Icon


Type: Artist
Alignment: Chaotic Good




I'm not scripter, but I think the part you should look at is:

# Add folowing comments in a event that will be a movable object:
# Grabable - Allows the event to be grabable and pushable; <<< You should try make the note with this Grabable instead of "push".
# Throwable - Allows the event to be throwable;

Have you also assigned the button for the grabbing? Or have you set the item that is needed for grabbing and do you have it possibly?
These are the few quick user issues that could cause it not to work. .m. If none of that helps I wish you good luck and hopefully someone in better terms with scripts could come by~

.o. That said please, if you put up scripts put it in codebox tags rather than spoiler, as pasting the script as itself onto the post ruins the format and makes it harder to read. x3


--------------------
;u; Thank you:


Go to the top of the page
 
+Quote Post
   
Lord Mephisto
post Feb 18 2012, 08:52 PM
Post #3



Group Icon


Type: Designer




QUOTE (Scinaya @ Feb 18 2012, 12:36 PM) *
I'm not scripter, but I think the part you should look at is:

# Add folowing comments in a event that will be a movable object:
# Grabable - Allows the event to be grabable and pushable; <<< You should try make the note with this Grabable instead of "push".
# Throwable - Allows the event to be throwable;

Have you also assigned the button for the grabbing? Or have you set the item that is needed for grabbing and do you have it possibly?
These are the few quick user issues that could cause it not to work. .m. If none of that helps I wish you good luck and hopefully someone in better terms with scripts could come by~

.o. That said please, if you put up scripts put it in codebox tags rather than spoiler, as pasting the script as itself onto the post ruins the format and makes it harder to read. x3


yup, i tried all that, i dont post before i look for every possible solution tongue.gif so... yes. "push" was an exampe. i used grabable and throwable, i changed the letter and tried 2 use a item. didnt work. thats why i asked tongue.gif but let me thank you for trying 2 help (:

BTW let me try 2 edit and change 2 code box. and.. sorry for my bad english, did my best.


--------------------
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th April 2014 - 08:52 PM

RPGMakerVX.net is an Privacy Policy, Legal.