Throw System
Authors: LiTTleDRAgo
Version: 1.52
Type: Custom Environment System
Key Term: Custom Environment System
IntroductionCharacter can pick up and throw objects
Features
- Player can pick objects and throw it
Screenshots(http://3.bp.blogspot.com/-1iFP-jTBZBQ/UecmPmbQ77I/AAAAAAAAAPk/48d1ENu7HaU/s1600/throw_system.JPG)
ScriptHere (http://littledrago.blogspot.com/2011/10/rgss-throw-system.html)
InstructionsIn the script
You probably need these
(http://3.bp.blogspot.com/-OVuaOp5kMAo/UecmT8XIbxI/AAAAAAAAAPs/YeORYAWwBSo/s1600/Hero_Pick.png) (http://4.bp.blogspot.com/-97NchbzWehI/UecmUPZdfvI/AAAAAAAAAPw/Kbd4urScEqc/s1600/Hero_TRW.png)
CompatibilityCompatible with/without Blizz ABS 2.84 & 2.85
Other version is untested, but probably works
Credits and Thanks
Author's NotesKnown Issues :
- Have issues with pixel movement
- Probably have issues with changing sprite
- Cannot pick & throw enemies
~Enjoy
OOOOooooo.... LOVELY!!! :^_^': Is there anyway to make the object that is thrown to land on another event and trigger it? for example: a rock is thrown at a switch and once the rock lands on the switch it opens a door? and also is there a way to make an object thrown to shatter? such as a pot thrown and it breaks once it lands? :shy:
If this was for Blizz-ABS... it would be a dream. °-°
Throwing stones after some monsters would be very funny. :D
IMA TEST IT NOW!
Does it hit enemies in BABS?
EDIT:
Got an undefined method error for Game_Player on line 238:
alias pickup_check_event_trigger_there check_event_trigger_there
Quote from: LiTTleDRAgo on October 21, 2011, 12:03:04 am
Compatibility
I don't think it's compatible with Blizz ABS
Certainly doesn't seem like it, especially since it's an independent hash from XAS. I mean, he'd probably be more vocal about it being compatible with Blizz-ABS if he intended it to create it for that, but it seems it's simply, as I mentioned earlier, an independent script entirely with its origins from XAS.
Anyway, nice work, Drago. :)
Quote from: Starrodkirby86 on December 27, 2011, 05:26:33 pm
Quote from: LiTTleDRAgo on October 21, 2011, 12:03:04 am
Compatibility
I don't think it's compatible with Blizz ABS
Certainly doesn't seem like it, especially since it's an independent hash from XAS. I mean, he'd probably be more vocal about it being compatible with Blizz-ABS if he intended it to create it for that, but it seems it's simply, as I mentioned earlier, an independent script entirely with its origins from XAS.
Anyway, nice work, Drago. :)
It's late, have some mercy over me, I read with lucifers popped in my eyes... or somethign like that.
It's a nice script. But I think it's not very useful as long as it isn't compatible with the ABS, because pick up objects and throw them away is easy to make with the maker itself. Throw stones at some monsters would be very practical. 8)
updated to v0.20
Quote from: Stray on January 04, 2012, 11:35:35 am
It's a nice script. But I think it's not very useful as long as it isn't compatible with the ABS, because pick up objects and throw them away is easy to make with the maker itself. Throw stones at some monsters would be very practical. 8)
this is still prototype anyway, don't expect too much
Says compatible with Blizz ABS although I can't seem to pick up the object. I set the rock event to <Throw5> somewhere in the event name and he still doesn't pick up the rock. Tried placing the script above and below Blizz ABS, still didn't fix it.
weird, I seems have no trouble like that
what other script did you use?
Just Blizz ABS, I am using Blizz ABS version 2.84.
On mine, I use the confirm key(Enter), is that what button your suppose to use for picking up and throwing?
yeah, it using confirm button to pick and throw
could you upload a demo for your project?
I can't find any errors in mine
I made a demo but installed Blizz ABS with all defaults on, it worked. I tried for my own game, it did not work but I fiddled around with the demo and found what caused it.
Me turning on pixel movement rate to anything thats not 0.
update to 0.31
try throwing stuff to your enemies XD
I can pick up stuff yet after I pick it up I cannot throw it anywhere. Only way I can get an object off of me is if I goto another map but after that, I can't attack or use skills. Also, it seems to override any pixel movement rate if you have it on too.
Quote from: Sin86 on January 26, 2012, 03:24:49 am
I can pick up stuff yet after I pick it up I cannot throw it anywhere. Only way I can get an object off of me is if I goto another map but after that, I can't attack or use skills. Also, it seems to override any pixel movement rate if you have it on too.
hmm when and what you did to make that error?
Well if I pick it up, I can pick it up however I cannot throw it once I'm holding it.
And when I go into an event that brings me into another location, although the item I'm carrying is now gone, however I cannot seem to attack or do anything else.
I'll look at it after my school is done,
for now try removing striked word and add the bolded word below
-------------------removed----------------------
Understood.
Just did exactly as done by removing out 2 of those lines and making a new one below the 2nd scratched out line and I got this error.
Script 'Throw System' line 97: NoMethodError occurred.
undefined method `sprite_normal' for #<Game_Player0x95b3830>
--"
could you upload a demo for your project?
http://www.sendspace.com/file/zzatfn
Link to demo with a completely default Blizz ABS on it.
However, the Throw System is exactly how you wanted the segments to be altered on your previous post.
updated to 0.40, try that
Can still piick up but cannot throw. However this time, I can goto an event that takes me to another map without having attacks and skills being disabled.
I also can pick up but can't throw, maybe ask help of someone else? g_g, winkio,... ?
is this supposed to be in ""?
eval_text = "
class #{name}
if $BlizzABS
alias update_for_throwing update_moving
alias move_for_throwing move
else
alias update_for_throwing update
end
alias pickup_check_event_trigger_there check_event_trigger_there
#--------------------------------------------------------------------------
# ● Check Event Pickup
#--------------------------------------------------------------------------
def player() $game_player end unless $BlizzABS
def check_event_trigger_there(triggers)
throw_event(0)
pickup_event
return if player.pickup_lock
return if !player.pickup_lock_time.nil? && player.pickup_lock_time > 0
pickup_check_event_trigger_there(triggers)
end
#--------------------------------------------------------------------------
# ● Update Moving (BlizzABS)
#--------------------------------------------------------------------------
def update_moving(d)
update_for_throwing(d)
update_carry_time
update_throw_position
end
#--------------------------------------------------------------------------
# ● Update (Non BlizzABS)
#--------------------------------------------------------------------------
def update
update_for_throwing
update_carry_time
update_throw_position
end
#--------------------------------------------------------------------------
# ● Move (BlizzABS)
#--------------------------------------------------------------------------
def move(d)
return if !player.pickup_lock_time.nil? && player.pickup_lock_time > 0
move_for_throwing(d)
end
#--------------------------------------------------------------------------
# ● Update Carry Time
#--------------------------------------------------------------------------
def update_carry_time
if !player.pickup_lock_time.nil? && player.pickup_lock_time > 0
player.pickup_lock_time -= 1
sprite_normal if player.pickup_lock_time == 0 ##
end
if !$game_temp.carry_time.nil? && $game_temp.carry_time > 0
$game_temp.carry_time -= 1
reset_pickup if $game_temp.carry_time == 0
end
end
#--------------------------------------------------------------------------
# ● Update Throw Position
#--------------------------------------------------------------------------
def update_throw_position
$game_map.events.each_value {|event|
if event.throw_active && !event.jumping?
event.real_x = player.real_x
event.real_y = player.real_y - 128
event.x = player.x
event.y = player.y
sprite_carry
end }
end
#--------------------------------------------------------------------------
# ● Throw Event
#--------------------------------------------------------------------------
def throw_event(type)
return if !player.pickup_lock
return if player.pickup_lock_time > 0
return if $game_system.map_interpreter.running?
$game_map.events.each_value {|event|
return unless event.is_a?(Game_Event)
if event.throw_active && !event.jumping?
$game_temp.can_throw = true
if type == 1
event.throw_action(1)
else
event.throw_action(event.throw)
end
return if !$game_temp.can_throw
sprite_throw
$game_temp.throw_pos_x = event.x
$game_temp.throw_pos_y = event.y
player.pickup_lock_time = 15
event.throw_active = false
player.pickup_lock = false
event.move_speed = event.pre_move_speed
event.walk_anime = event.pre_walk_anime
end }
end
#--------------------------------------------------------------------------
# ● Pickup Event
#--------------------------------------------------------------------------
def pickup_event
return if player.pickup_lock
return if !player.pickup_lock_time.nil? && player.pickup_lock_time > 0
return if $game_system.map_interpreter.running?
$game_map.events.each_value {|event|
if player.front_pos?(event.x,event.y)
return if event.throw.nil? || event.throw == 0
return if event.erased
return if event.through
player.pickup_lock_time = 15
event.throw_active = true
player.pickup_lock = true
sprite_throw
event.jump(0,0)
event.x = player.x
event.y = player.y
event.pre_walk_anime = event.walk_anime
event.pre_move_speed = event.move_speed
event.move_speed = 7
event.walk_anime = false
end }
end
#--------------------------------------------------------------------------
# ● About Actor
#--------------------------------------------------------------------------
def about_actor
@actor = {}
@actor = {
1 => $game_party.actors[0],
2 => $game_party.actors[1],
3 => $game_party.actors[2],
4 => $game_party.actors[3],
99 => $game_party.actors[99] }
end
#--------------------------------------------------------------------------
# ● Sprite Throw
#--------------------------------------------------------------------------
def sprite_throw
about_actor
for i in 1..4
name = @actor[i].character_name.to_s rescue ''
if player.character_name == name or
player.character_name == name + '_PICK'
player.character_name = name + '_TRW'
end
end
end
#--------------------------------------------------------------------------
# ● Sprite Carry
#--------------------------------------------------------------------------
def sprite_carry
about_actor
for i in 1..4
name = @actor[i].character_name.to_s rescue ''
if player.character_name == name or
player.character_name == name + '_TRW'
player.character_name = name + '_PICK'
end
end
end
#--------------------------------------------------------------------------
# ● Normal
#--------------------------------------------------------------------------
def sprite_normal
about_actor
for i in 1..4
name = @actor[i].character_name.to_s rescue ''
if player.character_name == name + '_PICK' or
player.character_name == name + '_TRW'
player.character_name = name
end
end
end
end"
I found out why I can't throw.
I did a process looking to find what scripts were wrong, deleted them out and that wasn't what caused it. I tried removing any paraell processes, didn't work either. I came to a point to where it all comes to how many enemies and destroyable objects are on the screen as well as events that are not tagged as enemies or objects are on the screen. It kind of depends on how many enemy/object events are and also how many non-enemie/object events are on the maps.
For instance, I got 8 enemy/objects on my screen and 2 normal events and 1 rock event(rock event depicts a rock that you can pick up and throw). At that point I can pick up but not throw. However, if I remove one of the enemy/objects from the map(6 are destroyable, 2 are not, I however remove one that is destroyable), then I can throw my rock around.
updated to 0.43
I don't get it. I tried working this new version on one demo with no other scripts besides this and the current Blizz ABS and it works. Yet I do it with another demo that also just uses no other scripts besides this and the current Blizz ABS and that one did not work. Both rock events have the same event names too in both demos and the confirm keys on both are also Enter as well.
forget to mention
character can't pick / throw if didn't have "_Pick" & "_TRW" graphic
Ah, that explains why the other demo character didn't pick up the rock. No message shown like in the other versions.
Sweet, I can throw rocks just about anywhere regardless of how many events/enemies/objects there are.
Thank you so much Littledrago, it really works now(and thank Moghunter too).
Oh yeah, is there also a way on how you can have it to where once you throw a rock, it crumbles and can't be used again unless you leave and re-enter the map?
update to 0.50
(http://i.imgur.com/VyXb3.jpg)
how about that?
Really good but now if you throw an object after it explodes, well if you leave the room and come back in a first time, the rock will disappear and the animation will play. Leave the room a 2nd time and come back in a 2nd time the rock will come back. Pick it up and throw it again, you will have to leave and come back in twice.
try adding this line
Quote
alias upd_for_throw update
def update
upd_for_throw
if @throwed && @thssw && !jumping?
$game_self_switches[[$game_map.map_id,@id,@thssw]] = true
$game_map.need_refresh = true
@throwed = false
end
end
end
It worked.
Once again, thank you very much.
Can you update this so when the first block in front of the player is unpassable, you cannot throw the item?
Now when you throw it when there is an unpassable block in front of the player, it drops under the player.
Also, could you make it impossible to throw at through events? Maybe with a tag like <Unpassable>
done, update to 0.52
btw I already use <Unpassable> on another script so I change it to <BlockThrow>
Quote from: LiTTleDRAgo on January 28, 2012, 08:28:46 pm
done, update to 0.52
btw I already use <Unpassable> on another script so I change it to <BlockThrow>
Also, I use idle sprites for Blizz-ABS and when I picked something up, the idle sprites overwrite the picked-up sprites. I need the idle sprites because of some other bug...
done, updated to 0.53
try it out
This looks epic. It'll be perfect once you add pixel movement compatibility!
Quote from: Boba Fett Link on January 29, 2012, 03:42:22 pm
This looks epic. It'll be perfect once you add pixel movement compatibility!
Agreed!
Also, now the "idle" when something is picked up keeps walking!
+ The rocks don't hit enemies?
Quote from: Futendra on January 29, 2012, 03:48:34 pm
Quote from: Boba Fett Link on January 29, 2012, 03:42:22 pm
This looks epic. It'll be perfect once you add pixel movement compatibility!
Agreed!
Also, now the "idle" when something is picked up keeps walking!
+ The rocks don't hit enemies?
I can't understand your statement perfectly
is this what you mean?
- when player picked something up, his sprite keeps walking (like step animation is activated)?
- the rocks didn't do anything when hit an enemy?
Quote from: LiTTleDRAgo on January 29, 2012, 10:02:09 pm
Quote from: Futendra on January 29, 2012, 03:48:34 pm
Quote from: Boba Fett Link on January 29, 2012, 03:42:22 pm
This looks epic. It'll be perfect once you add pixel movement compatibility!
Agreed!
Also, now the "idle" when something is picked up keeps walking!
+ The rocks don't hit enemies?
I can't understand your statement perfectly
is this what you mean?
- when player picked something up, his sprite keeps walking (like step animation is activated)?
- the rocks didn't do anything when hit an enemy?
Yes, that is what I mean.
1. I didn't have any problem like that, but I'll look at it tomorrow
2. Do you include <AtkPower*> in the event name?
if yes try using number greater than 100 / 600
Quote from: LiTTleDRAgo on January 30, 2012, 08:58:55 am
1. I didn't have any problem like that, but I'll look at it tomorrow
2. Do you include <AtkPower*> in the event name?
if yes try using number greater than 100 / 600
My rocks are meant to be weak... they need 50 atk power
update to 0.54,
step anime
probably fixed
the damage is depending on your enemy pdef
if you using a number lower than your enemy pdef then it won't do any damage
if you want static damages, add that bolded line
Quote
def throw_event?(x_plus, y_plus,p )
dir = $game_player.direction
terrain_disable = $game_map.terrain_tag(@x + x_plus, @y + y_plus)
# return false
new_x = @x + (dir == 6 ? 1 : dir == 4 ? -1 : 0)
new_y = @y + (dir == 2 ? 1 : dir == 8 ? -1 : 0)
terrain_disable2 = $game_map.terrain_tag(new_x,new_y)
# return false
v = 1
org_x = @x + x_plus
org_y = @y + y_plus
p.times do
new_x2 = org_x + (dir == 6 ? -v : dir == 4 ? + v : 0)
new_y2 = org_y + (dir == 2 ? -v : dir == 8 ? + v : 0)
terrain_disable3 = $game_map.terrain_tag(new_x2,new_y2)
# return false
$game_map.events.each_value {|event|
if event.x == new_x2 && event.y == new_y2
if event.name =~ /<BlockThrow>/i && !event.through
return false
end
if $BlizzABS && !event.through && event.is_a?(Map_Enemy)
event.animation_id = 4 if @animethrow
if @atkpow
atk = [@atkpow - event.battler.pdef / 2, 0].max
atk = @atkpow
event.battler.hp -= atk
event.battler.hpdamage = atk
$BlizzABS.util.request_damage_sprite(event) if atk > 0
$BlizzABS.util.request_damage_sprite(event,'0') if atk <= 0
end
return false
end
end }
v += 1
end
return true
end
Well, Winkio's incorporating a throw system anyway, :/ So I'm placing my bets on him....
I'm too deep of a BABS user to switch to Xas XD.
update to work with blizz abs 2.85
Hi guys so im really interested in using this but its just not working, i added <Throw3> to the event name and when i press enter on it nothing happens :( Im using rmx-os and blizz abs latest
Love the system, i would like to ask if some 1 could make it global and rmx-os ready so the items save in a place also? thanks
Hey :3
I get an error, even though I did everything as it says in the description.
Line 197
undefined method 'name' for #<Game_Event: variable number >
What did I do wrong?
Demo (http://www.mediafire.com/download/vaqqwg141gzader/throw_system.rar)
Josey~
No one? :<
After getting the error message to pop up, open up your scripts and the cursor will be on the line where the error occurred. Change it to this
if event.character_name =~ /<BlockThrow>/i && !event.through
I'm kind of surprised this went unnoticed for a long time.
* fixed * (probably)
Nb : Untested (I didn't hold rmxp right now)
Many Thanks! :D
It works! :3
Why did not anyone had this error before?
And would it look as if the rock is rolling across the floor, instead of flying? Is it that intentional?
Hi! :3
I have another request. :D
Is it possible to add some features to the script?
- if the player changes the map, he should still carrying the event/item (maybe, I need a script-command "throws event 1")
-> an free event on the destination map could change its graphic to the item the player is holding (via $game_variables) and the event is placed on the players head (the player should change his graphic too)
- throwing/removing the event by using a script command
-> idea: the player collects some items and puts them (by press another button) in his inventory, the event becomes invisible, but the player still in carry-position (and the event is still over his head)
I hope someone can help me!
I would be very grateful :)
Josey~
No one here? ._.
Still searching ._.
Someone found, that has made! :D
bump. i guess
added this script and got a slight movement of a rock, no hold, run/hold, etc. Am I missing something?
Could you be a bit more descriptive as to what you did? Pictures would be nice.
My Bad,
I have been familiar with XP (most preferred of the makers) for a couple years but scripting has always been a foreign concept, I have a basic knowledge but still need a lot of help cause I don't really know what I'm doing half the time with it :facepalm: *I make sprites lol*
little background for system,
-making a platformer styled game (Mario/Mario 2 *if I can get the throw right)
-Using G@meF@ce platform/gravity scripts (enemy ref/springs/etc)
-Custom HUD, but not important atm
-Other known bugs but will get to around fixing (primarily gravity on moving platforms/enemy gravity/movement on the same grounds)
I am using a couple other scripts due to gameplay but am unsure if any are conflicting
(maybe even disable the up and down carrying code but would have no idea where to start)
added the script above Main, with my others
(http://i67.tinypic.com/21oms5e.png)
Imported the graphics necessary (Didn't work so tried readding them with exact names in script still no result in changing of the graphic)
(http://i65.tinypic.com/25qvh2t.png)
In game shot, everything's smooth and running fine
(http://i64.tinypic.com/2wbwzeg.png)
Walk up to the boulder (Event named as <Throw4>)
(http://i68.tinypic.com/2s8qrf5.png)
Using the action button (needs to also be changed due to his run/dash is the same button) The rock/evert does move but it flies right over him, even if I change <ThrowX> to <Throw1000>
(http://i66.tinypic.com/2diiro3.png)
Now the event does nothing, just stays stationary, action button does nothing.
(http://i67.tinypic.com/1zc3ibm.png)
I can upload a demo if necessary and willing to accept any help.
Thanks.
edit: I did add it to a new game just to test it and it DOES work, I am going to play around with he actual button command but it may be conflicting scripts?***
I tried looking through the throw script for a Input setting but cannot find it, maybe if it's set to to the c on the keyboard but I don't have a clue how to edit it :???:
Since it seems to just be an event that does something special (i.e. pick up and throw), I'm going to assume that it is the confirm button (C, Space, Enter, etc.) that picks up the event since this is how you normally trigger an event. That is default RMXP behavior--there is no setting in the script to change it.
My guess with the odd movement of the boulder is due to the platformer script you're using. It's most likely incompatible as this script was written for default RMXP movement and not pixel-based platformers.
I thought about that too but wouldn't the action still be considered possible? Maybe changing the dash key?
I thought forsure that there was a way to active an event via button being pushed.
If you want to change how to trigger an event, it would be located in Game_Player at the bottom of the script. I wouldn't advise it unless you really know what you're doing.
And I think you're mistaking that for a Conditional Branch where the check is for if a button is currently being pressed. That's not the same as triggering an event to start.
It's starting to look a bit like a loss cause, even if I got the desired result it would probably bug due to the platforming script disabling Up & Down, that throwing while jumping or running.
One could dream I guess
Well that is what I told you from the start. You're better off making it yourself from scratch than trying to repurpose this one to work.
over and out