KI kills themselves

Users who are viewing this thread

Darwin

Watchin' your language...
Section Moderator
well, i have this item:
Code:
["fire_wave","Reisa du Brisingr", [("fire",0)],itp_type_thrown |itp_primary|itp_bonus_against_shield ,itcf_throw_stone, 4938 , weight(4)|spd_rtng(90) | shoot_speed(50) | thrust_damage(60 ,  pierce)|max_ammo(200)|weapon_length(65),imodbits_none,
 [(ti_on_weapon_attack, [(play_sound,"snd_footstep_water"),(assign,":distance",99999),(get_player_agent_no, ":player_agent"),
							(agent_get_team,":player_team", ":player_agent"),
							(try_for_agents,":agent"),
                              (agent_is_alive,":agent"),
                              (agent_is_human,":agent"),
                              (agent_get_look_position, pos2, ":agent"),
                              (get_distance_between_positions,":dist",pos1,pos2),
                              (lt,":dist",":distance"),
                              (assign,":chosen",":agent"),
                              (assign,":distance",":dist"),
                            (end_try),
                            (agent_get_position,pos1,":chosen"),
                            (position_move_y,pos1,1000),
                         (assign,":mul",1),
                         (try_for_range,":num",1,11),
                            (val_mul,":num",":mul"),
                            (val_mul,":num",200),
                            (position_move_z,pos1,300),
                            (position_move_x,pos1,":num"),
                            (particle_system_burst,"psys_massive_fire",pos1,75),
                            (position_move_z,pos1,-300),
                            (try_for_agents,":agent"),
                               (neq,agent_has_item_equipped,":agent","itm_black_helmet"),
                               (agent_get_position,pos2,":agent"),
                               (get_distance_between_positions,":dist",pos1,pos2),
                               (lt,":dist",300),
                               (neq,":agent",":player_agent"),
							   (agent_get_team,":team",":agent"),
							   (neq,":team",":player_team"),
							   #(agent_get_position,pos2,":agent"),
                               #(get_distance_between_positions,":dist",pos1,pos2),
                               #(lt,":dist",300),
                               (store_agent_hit_points, ":cur_hit_points",":agent",1),
							(val_sub,":cur_hit_points",25),
							(agent_set_hit_points,":agent",":cur_hit_points",1),
							(agent_deliver_damage_to_agent,":player_agent",":agent"),
                            (end_try),
                            (val_mul,":mul",-1),
                          (end_try),],)]],

actually, it only delivers damage to agents, who are NOT in the player_team. but it seems, this doesnt work :???: what did i wrong?

Edit: uhm, player_agent isnt always the player, is it? its the one who uses the item?
 
Darwin said:
actually, it only delivers damage to agents, who are NOT in the player_team. but it seems, this doesnt work :???: what did i wrong?

Edit: uhm, player_agent isnt always the player, is it? its the one who uses the item?

player_agent is the player, always.
 
That's a good question.

What you can do (since it would seem, looking at the pistol code) is check for the closest agent to pos1.  look at this:
["flintlock_pistol", "Flintlock Pistol", [("flintlock_pistol",0)], itp_type_pistol |itp_primary ,itcf_shoot_pistol|itcf_reload_pistol, 230 , weight(1.5)|difficulty(0)|spd_rtng(3:cool: | shoot_speed(160) | thrust_damage(41 ,pierce)|max_ammo(1)|accuracy(65),imodbits_none,
[(ti_on_weapon_attack, [(play_sound,"snd_pistol_shot"),(position_move_x, pos1,27),(position_move_y, pos1,36),(particle_system_burst, "psys_pistol_smoke", pos1, 15)])]],
No where in this line does it check for where pos1 is.  This would mean that it's based on the user's current position.  As a double check you can then also test, as part of the condition for who is firing the weapon, if they are wielding the item.  That's got to be your user.


 
I hope this works, using:

        (assign, ":min_dist", 999999),
        (assign, ":min_dist_town", -1),
        (try_for_range, ":cur_town", towns_begin, towns_end),
          (store_distance_to_party_from_party, ":cur_dist", ":cur_village", ":cur_town"),
          (lt, ":cur_dist", ":min_dist"),
          (assign, ":min_dist", ":cur_dist"),
          (assign, ":min_dist_town", ":cur_town"),
        (try_end),

Converted to:

        (assign, ":min_dist", 999999),
        (assign, ":min_dist_agent", -1),
        (try_for_agents, ":cur_agent"),
          (agent_get_position,pos2,":cur_agent"),
          (get_distance_between_positions,":cur_dist",pos1,pos2),
          (lt, ":cur_dist", ":min_dist"),
          (assign, ":min_dist", ":cur_dist"),
          (assign, ":min_dist_agent", ":cur_agent"),
        (try_end),

Might work, but I don't have great hopes for it, sorry if it doesn't.
 
ja, artificial intelligence. Und nein ich bin nicht deutsch, ich spreche nur ein bisschen deutsch.

(for the english guys, I just said I don't speak german)
 
Darwin said:
jik said:
check for the closest agent to pos1

how? :???:

Roughly, I would do something like this (just to find the user agent)

[(ti_on_weapon_attack),
    [(copy_position,pos5,pos1),                                  ##hold it in a less used pos
    (assign,":this_item","itm_fire_wave"),                  ##For checking to see what they are using
    (assign,":min_dist",30),                                      ##relatively close, just in case
    (assign,":this_agent",0),                                      ##Will not be 0 if agent is found
    (try_for_agents,":agent"),
          (agent_get_position,pos4,":agent"),
          (get_distance_between_positions,":a_dist",pos4,pos5),
          (try_begin),
              (le,":a_dist",":min_dist"),
              (agent_get_wielded_item,":a_item",":agent",1),            ##Never used this before, not sure what hand is what number...  I would test this else where (like with a key trigger)
              (eq,":a_item",":this_item"),                                          ##Double check.  that they are wielding the item
              (assign,":this_agent",":agent"),
          (try_end),
    (try_end),      ##agent loop end

I wouldn't just plug this straight in, read it and understand it.  Also, make sure I didn't make any mistakes...  In the end, :this_agent should be the agent firing the weapon.  I didn't put in a check if :this_agent is not 0 at the end.  You should add that and put a display_message error warning for testing.
 
Arch3r said:
I hope this works, using:
        (assign, ":min_dist", 999999),
        (assign, ":min_dist_town", -1),
        (try_for_range, ":cur_town", towns_begin, towns_end),
          (store_distance_to_party_from_party, ":cur_dist", ":cur_village", ":cur_town"),
          (lt, ":cur_dist", ":min_dist"),
          (assign, ":min_dist", ":cur_dist"),
          (assign, ":min_dist_town", ":cur_town"),
        (try_end),
Converted to:
        (assign, ":min_dist", 999999),
        (assign, ":min_dist_agent", -1),
        (try_for_agents, ":cur_agent"),
          (agent_get_position,pos2,":cur_agent"),
          (get_distance_between_positions,":cur_dist",pos1,pos2),
          (lt, ":cur_dist", ":min_dist"),
          (assign, ":min_dist", ":cur_dist"),
          (assign, ":min_dist_agent", ":cur_agent"),
        (try_end),
Might work, but I don't have great hopes for it, sorry if it doesn't.

no, now it doesn't deliver damage to anyone
jik said:
(agent_get_wielded_item,":a_item",":agent",1),

never heard or read this, but i'll try...

Edit: i get an error in process_items.py??? "float" is unscriptable :neutral:
 
Back
Top Bottom