Pumpkin Lord
Heya everyone!
Here is a little script from me which basicly allows player to pull any agent/player to himself as you can find a preview of it by the video above. (I modified the code after taking this video though.) It is nothing complicated and basicly involves of only one simple mission trigger to be added properly.
What it does is, you shoot an agent with any bow identified in the "is_between" range -or you can try to uncomment my item_get_type conditions and go with that, I preferred this way.- and voila, it ends up in front of you. Of course needless to say, there are conditions like not being able to pull from unrealistic distances or simply an animal to yourself.
Here is the code
Code:
ranged_pull = (
ti_on_agent_hit, 0, 0, [(is_between, reg0, "itm_heavy_throwing_axes_melee", "itm_torch"),
# (item_get_type, ":is_bow", reg0),
# (eq, ":is_bow", itp_type_bow),
# (eq, reg0, "itm_short_bow"),
],
[ #(display_message, "@IP: Arrow shot."),
(store_trigger_param_1, ":target"),
(store_trigger_param_2, ":source"),
(get_player_agent_no, ":me"),
(str_store_agent_name, s0, ":target"),
(agent_is_alive, ":source"),
(agent_get_position, pos1, ":target"),
(agent_get_position, pos2, ":source"),
(get_distance_between_positions, ":dist", pos1, pos2),
(assign, reg1, ":dist"),
(position_move_x, pos2, 50),
(eq, ":source", ":me"),
(try_begin),
(le, ":dist", 200),
(str_store_string, s1, "@Too close to pull! Distance: {reg1}"),
(else_try),
(ge, ":dist", 1000),
(str_store_string, s1, "@Too far to pull! Distance: {reg1}"),
(else_try),
(neg|agent_is_human, ":target"),
(str_store_string, s1, "@You cannot pull an animal! Distance: {reg1}"),
(else_try),
(agent_get_horse, ":has_horse", ":target"),
(neq, ":has_horse", -1),
(str_store_string, s1, "@You cannot pull horsemen! Distance: {reg1}"),
(else_try),
(agent_is_alive, ":target"),
(agent_set_position, ":target", pos2),
(str_store_string, s1, "@Pulled {s0}. Distance: {reg1}"),
(try_end),
(display_message, "@{s1}"),
])
How to add
You know module system, you locate mission_templates.py...good. Add the trigger just like any other and put this in whatever mission you want this to be.
Code:
ranged_pull,
Credits go to Blizzard for the Butcher's Cleaver as my inspiration. Feel free to credit me or not, I don't really care but If I see it somewhere by accident, I will devour you.