Exploding Arrow trigger not working

Users who are viewing this thread

Toasticuss

Sergeant
Hey guys, I came across an exploding arrow script from a script complication thread and I'm unable to get the arrow to explode. The only thing it does is shoot like a normal arrow and make a small fire particle after it hits something.

Here is the code for the entire object that went in the module_items.py

Code:
["dr_e_arrows", "Explosive Arrows", [("arrow",0), ("flying_missile",ixmesh_flying_ammo), ("quiver", ixmesh_carry)], itp_type_arrows, itcf_carry_quiver_back, 0,weight(3)|abundance(160)|weapon_length(95)|thrust_damage(4, pierce)|max_ammo(20), imodbits_missile,   [       (ti_on_missile_hit,      [
#pos1 - Missile hit position
#param_1 - Shooter agent
(try_begin),
(multiplayer_is_server),
(store_trigger_param_1, ":shooter"),
(particle_system_burst, "psys_torch_fire", pos1, 100),
(get_max_players, ":max"),
(try_for_range, ":i", 1, ":max"),
(player_is_active, ":i"),
(player_get_agent_id, ":agent", ":i"),
(ge, ":agent", 0),
(agent_is_alive, ":agent"),
(agent_get_position, pos2, ":agent"),
(position_move_z, pos2, 50),
(get_distance_between_positions, ":dist", pos1, pos2),
(try_begin),
(lt, ":dist", 150),
(store_agent_hit_points, ":hp", ":agent", 1),
(val_sub, ":hp", 10),
(val_max, ":hp", 0),
(agent_set_hit_points, ":agent", ":hp", 1),
(try_begin),
(eq, ":hp", 0),
(agent_deliver_damage_to_agent, ":shooter", ":agent"),
(try_end),
(try_end),
(try_end),
(try_end),
]),
]],

Any idea why its not working in MP?
 
Vincenzo said:
You need to run above in dedicated server i suppose for it to work.. and it would only work on players.
Why not use a try_for_agents loop?

Just loaded it in a dedicated server, it made no difference.
 
Could you pretty please indent that? It would help people pick out bugs. Other than that, it looks like it should work. It should also work on a non-dedicated server on players that aren't hosting.
 
When looping over players, 1 is the correct starting index, since 0 is only a player if it's a player-hosted server (and 0 will be the player-host). Player 0 does not exist on dedicated servers and will give an error if you try to call something involving it.
 
There's (multiplayer_is_server), checked above on the code at the 1st post. And even at native's multiplayer_server_check_belfry_movement trigger, they scan from 0.
 
Aye, but starting with 1 is a safer bet, especially if you're using messages (which Toasticus will have to use if he wants to add sound to these arrows).

But we're digressing, I indented it, but I still don't see anything wrong. What exactly isn't working?

["dr_e_arrows", "Explosive Arrows", [("arrow",0), ("flying_missile",ixmesh_flying_ammo), ("quiver", ixmesh_carry)], itp_type_arrows, itcf_carry_quiver_back, 0,weight(3)|abundance(160)|weapon_length(95)|thrust_damage(4, pierce)|max_ammo(20), imodbits_missile,  [      (ti_on_missile_hit,      [
#pos1 - Missile hit position
#param_1 - Shooter agent
(try_begin),
    (multiplayer_is_server),
    (store_trigger_param_1, ":shooter"),

    (particle_system_burst, "psys_torch_fire", pos1, 100),

    (get_max_players, ":max"),
    (try_for_range, ":i", 1, ":max"),
          (player_is_active, ":i"),
          (player_get_agent_id, ":agent", ":i"),

          (ge, ":agent", 0),
          (agent_is_alive, ":agent"),
          (agent_get_position, pos2, ":agent"),
          (position_move_z, pos2, 50),

          (get_distance_between_positions, ":dist", pos1, pos2),
          (try_begin),
              (lt, ":dist", 150),
              (store_agent_hit_points, ":hp", ":agent", 1),
              (val_sub, ":hp", 10),
              (val_max, ":hp", 0),
              (agent_set_hit_points, ":agent", ":hp", 1),

              (try_begin),
                    (eq, ":hp", 0),
                    (agent_deliver_damage_to_agent, ":shooter", ":agent"),
              (try_end),

          (try_end),
    (try_end),
(try_end),
]),
]],
 
MadocComadrin said:
Aye, but starting with 1 is a safer bet, especially if you're using messages (which Toasticus will have to use if he wants to add sound to these arrows).

But we're digressing, I indented it, but I still don't see anything wrong. What exactly isn't working?

["dr_e_arrows", "Explosive Arrows", [("arrow",0), ("flying_missile",ixmesh_flying_ammo), ("quiver", ixmesh_carry)], itp_type_arrows, itcf_carry_quiver_back, 0,weight(3)|abundance(160)|weapon_length(95)|thrust_damage(4, pierce)|max_ammo(20), imodbits_missile,  [      (ti_on_missile_hit,      [
#pos1 - Missile hit position
#param_1 - Shooter agent
(try_begin),
    (multiplayer_is_server),
    (store_trigger_param_1, ":shooter"),

    (particle_system_burst, "psys_torch_fire", pos1, 100),

    (get_max_players, ":max"),
    (try_for_range, ":i", 1, ":max"),
          (player_is_active, ":i"),
          (player_get_agent_id, ":agent", ":i"),

          (ge, ":agent", 0),
          (agent_is_alive, ":agent"),
          (agent_get_position, pos2, ":agent"),
          (position_move_z, pos2, 50),

          (get_distance_between_positions, ":dist", pos1, pos2),
          (try_begin),
              (lt, ":dist", 150),
              (store_agent_hit_points, ":hp", ":agent", 1),
              (val_sub, ":hp", 10),
              (val_max, ":hp", 0),
              (agent_set_hit_points, ":agent", ":hp", 1),

              (try_begin),
                    (eq, ":hp", 0),
                    (agent_deliver_damage_to_agent, ":shooter", ":agent"),
              (try_end),

          (try_end),
    (try_end),
(try_end),
]),
]],

The arrow will shoot exactly like an arrow, it doesnt explode or do any AoE damage, it just shoots and then becomes flaming after hitting a object.
 
Toasticuss said:
The arrow will shoot exactly like an arrow, it doesnt explode or do any AoE damage, it just shoots and then becomes flaming after hitting a object.

The particle effect used only creates flames at the arrow, not an explosion-you'll have to come up with another particle effect for that. Also, the AOE splash radius is really small, you might want to increase that by a multiple of ten and try it again.
 
MadocComadrin said:
Toasticuss said:
The arrow will shoot exactly like an arrow, it doesnt explode or do any AoE damage, it just shoots and then becomes flaming after hitting a object.

The particle effect used only creates flames at the arrow, not an explosion-you'll have to come up with another particle effect for that. Also, the AOE splash radius is really small, you might want to increase that by a multiple of ten and try it again.

Which value is the AOE splash radius?
 
The 150 in red is the radius of the blast. I'd try multiplying by 10 and fine-tuning it from there.

["dr_e_arrows", "Explosive Arrows", [("arrow",0), ("flying_missile",ixmesh_flying_ammo), ("quiver", ixmesh_carry)], itp_type_arrows, itcf_carry_quiver_back, 0,weight(3)|abundance(160)|weapon_length(95)|thrust_damage(4, pierce)|max_ammo(20), imodbits_missile,  [      (ti_on_missile_hit,      [
#pos1 - Missile hit position
#param_1 - Shooter agent
(try_begin),
    (multiplayer_is_server),
    (store_trigger_param_1, ":shooter"),

    (particle_system_burst, "psys_torch_fire", pos1, 100),

    (get_max_players, ":max"),
    (try_for_range, ":i", 1, ":max"),
          (player_is_active, ":i"),
          (player_get_agent_id, ":agent", ":i"),

          (ge, ":agent", 0),
          (agent_is_alive, ":agent"),
          (agent_get_position, pos2, ":agent"),
          (position_move_z, pos2, 50),

          (get_distance_between_positions, ":dist", pos1, pos2),
          (try_begin),
              (lt, ":dist", 150),
              (store_agent_hit_points, ":hp", ":agent", 1),
              (val_sub, ":hp", 10),
              (val_max, ":hp", 0),
              (agent_set_hit_points, ":agent", ":hp", 1),

              (try_begin),
                    (eq, ":hp", 0),
                    (agent_deliver_damage_to_agent, ":shooter", ":agent"),
              (try_end),

          (try_end),
    (try_end),
(try_end),
]),
]],
 
MadocComadrin said:
The 150 in red is the radius of the blast. I'd try multiplying by 10 and fine-tuning it from there.

["dr_e_arrows", "Explosive Arrows", [("arrow",0), ("flying_missile",ixmesh_flying_ammo), ("quiver", ixmesh_carry)], itp_type_arrows, itcf_carry_quiver_back, 0,weight(3)|abundance(160)|weapon_length(95)|thrust_damage(4, pierce)|max_ammo(20), imodbits_missile,  [      (ti_on_missile_hit,      [
#pos1 - Missile hit position
#param_1 - Shooter agent
(try_begin),
    (multiplayer_is_server),
    (store_trigger_param_1, ":shooter"),

    (particle_system_burst, "psys_torch_fire", pos1, 100),

    (get_max_players, ":max"),
    (try_for_range, ":i", 1, ":max"),
          (player_is_active, ":i"),
          (player_get_agent_id, ":agent", ":i"),

          (ge, ":agent", 0),
          (agent_is_alive, ":agent"),
          (agent_get_position, pos2, ":agent"),
          (position_move_z, pos2, 50),

          (get_distance_between_positions, ":dist", pos1, pos2),
          (try_begin),
              (lt, ":dist", 150),
              (store_agent_hit_points, ":hp", ":agent", 1),
              (val_sub, ":hp", 10),
              (val_max, ":hp", 0),
              (agent_set_hit_points, ":agent", ":hp", 1),

              (try_begin),
                    (eq, ":hp", 0),
                    (agent_deliver_damage_to_agent, ":shooter", ":agent"),
              (try_end),

          (try_end),
    (try_end),
(try_end),
]),
]],

Had no effect hosting locally with the 150 changed to 1500, ill try dedicated tomorrow unless you think it doesnt matter....
 
Vincenzo said:
Why not use a try_for_agents loop?
This...

Code:
     (get_max_players, ":max"),
     (try_for_range, ":i", 1, ":max"),
          (player_is_active, ":i"),
          (player_get_agent_id, ":agent", ":i"),
Replace with:
Code:
     (try_for_agent,":agent"),
 
Beaver said:
Vincenzo said:
Why not use a try_for_agents loop?
This...

Code:
     (get_max_players, ":max"),
     (try_for_range, ":i", 1, ":max"),
          (player_is_active, ":i"),
          (player_get_agent_id, ":agent", ":i"),
Replace with:
Code:
     (try_for_agent,":agent"),

Replace all of that with that?

Whats the final code look like so i don't screw it up...
 
Like so:
Code:
["dr_e_arrows", "Explosive Arrows", [("arrow",0), ("flying_missile",ixmesh_flying_ammo), ("quiver", ixmesh_carry)], itp_type_arrows, itcf_carry_quiver_back, 0,weight(3)|abundance(160)|weapon_length(95)|thrust_damage(4, pierce)|max_ammo(20), imodbits_missile,   [       (ti_on_missile_hit,      [
#pos1 - Missile hit position
#param_1 - Shooter agent
(try_begin),
     (multiplayer_is_server),
     (store_trigger_param_1, ":shooter"),

     (particle_system_burst, "psys_torch_fire", pos1, 100),

     (try_for_agents,":agent"),

          (ge, ":agent", 0),
          (agent_is_alive, ":agent"),
          (agent_get_position, pos2, ":agent"),
          (position_move_z, pos2, 50),

          (get_distance_between_positions, ":dist", pos1, pos2),
          (try_begin),
               (lt, ":dist", 150),
               (store_agent_hit_points, ":hp", ":agent", 1),
               (val_sub, ":hp", 10),
               (val_max, ":hp", 0),
               (agent_set_hit_points, ":agent", ":hp", 1),

               (try_begin),
                    (eq, ":hp", 0),
                    (agent_deliver_damage_to_agent, ":shooter", ":agent"),
               (try_end),

          (try_end),
     (try_end),
(try_end),
]),
]],
 
Beaver said:
Like so:
Code:
["dr_e_arrows", "Explosive Arrows", [("arrow",0), ("flying_missile",ixmesh_flying_ammo), ("quiver", ixmesh_carry)], itp_type_arrows, itcf_carry_quiver_back, 0,weight(3)|abundance(160)|weapon_length(95)|thrust_damage(4, pierce)|max_ammo(20), imodbits_missile,   [       (ti_on_missile_hit,      [
#pos1 - Missile hit position
#param_1 - Shooter agent
(try_begin),
     (multiplayer_is_server),
     (store_trigger_param_1, ":shooter"),

     (particle_system_burst, "psys_torch_fire", pos1, 100),

     (try_for_agents,":agent"),

          (ge, ":agent", 0),
          (agent_is_alive, ":agent"),
          (agent_get_position, pos2, ":agent"),
          (position_move_z, pos2, 50),

          (get_distance_between_positions, ":dist", pos1, pos2),
          (try_begin),
               (lt, ":dist", 150),
               (store_agent_hit_points, ":hp", ":agent", 1),
               (val_sub, ":hp", 10),
               (val_max, ":hp", 0),
               (agent_set_hit_points, ":agent", ":hp", 1),

               (try_begin),
                    (eq, ":hp", 0),
                    (agent_deliver_damage_to_agent, ":shooter", ":agent"),
               (try_end),

          (try_end),
     (try_end),
(try_end),
]),
]],
Awesome, its working, thanks for everyones help.

The health subtraction was at 10 so I guess thats why I didnt notice it very much.
 
Back
Top Bottom