invalid_player_ID at troop raise_skill operation (solved)

正在查看此主题的用户

Meneldur

Sergeant Knight
Edit1 14.9.2011:
My question is about a scene_prop on which i try to put an Troop_raise_skill operation.
It is meant to be a ti_on_scene_prop_use effect.
I have a problem (red ingame display message says: invalid player id)
and several questions about it!

A statue scene_prop on which you pray/spend money for a skill-bonus!
Here is my code:

插入代码块:
("statues_1",sokf_destructible|sokf_show_hit_point_bar|sokf_moveable|spr_use_time(9),"statues_1","bo_hbsprops_sorcerers",  [
   (ti_on_init_scene_prop,
    [
      (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 500),
    ]),


(ti_on_scene_prop_use,
    [
      (store_trigger_param_1, ":agent_id"),
        (store_trigger_param_2, ":instance_id"),

      
      (multiplayer_is_server),
      (assign, ":cost", 650), #gold required for healing
      (agent_get_player_id,":player_no",":agent_id"),
      (try_begin),
        (player_is_active, ":player_no"),
        (player_get_gold, ":player_gold", ":player_no"),
        (gt, ":player_gold", ":cost"),
        (player_get_troop_id, ":troop_no", ":player_no"),
       (this_or_next|eq,":troop_no","trp_orc_bowman_multiplayer"),
        (this_or_next|eq,":troop_no","trp_orc_infantry_multiplayer"),
        (eq,":troop_no","trp_boar_rider_multiplayer"),
         (get_max_players, ":num_players"),                               
      (try_for_range, ":player_no", 1, ":num_players"), #0 is server so starting from 1
        (player_is_active, ":player_no"),
        (multiplayer_send_2_int_to_player, ":player_no", multiplayer_event_pray, ":instance_id", ":agent_id"),
      
 (try_end),
      (agent_get_troop_id,":troop_id", ":agent_id"),
     
(troop_raise_skill,":troop_id","skl_power_throw",3),

                 
    
        (display_message, "str_mystring1"),    
				
      (play_sound, "snd_orc_yell"),
        (agent_set_animation, ":agent_id", "anim_release_swingright_fist"),
     
     
 (val_sub, ":player_gold", ":cost"),
        (player_set_gold, ":player_no", ":player_gold", multi_max_gold_that_can_be_stored),
 
     
      (try_end),

      ]),
(ti_on_scene_prop_destroy,
    [
        (store_trigger_param_1, ":instance_no"),
        (prop_instance_get_position, pos2, ":instance_no"),
        (play_sound, "snd_orc_grunt_long"),
		(display_message, "@You destroyed a shrine of Trondrag the merciless!"),
 #     (particle_system_burst, "psys_explosion_fire", pos1, 100),      #percentage_burst_strength is 100
        #(position_rotate_x, 5),         #use these if you wish to rotate it
        #(position_rotate_y, 5),
        #(position_rotate_z, 5),     
        (position_move_z, pos2, -1500),      #up/down         #move the door out of the way (underground)
      #(position_move_x, pos2, -200),      #left/right
      #(position_move_y, pos2, -200),      #forward/back
        (prop_instance_animate_to_position, ":instance_no", 2, 800), #animate to position in 8 seconds
    ]),
    (ti_on_scene_prop_hit,
    [
        (play_sound, "snd_dummy_hit"),
        (particle_system_burst, "psys_dummy_smoke", pos1, 25),      #percentage_burst_strength was 100
    ]),     
 ]),

did not test in real multiplayer so far but it seems to work as i tested with riding and power_throw. while appears to be buggy.
I get a script warning display message:
b3sz9e.jpg

1. is my player track really targeting a single player or am i just changing the skill of all troops of type:trp_orc_infantry  ? :neutral:
    i need the troop of type check to specify the holy statues for different races; not to have elven who pray to Tondrag the    merciless in the end.

2.what is wrong about my player_id_track?
I already tried to get the players track the other way arround with:

(store_trigger_param_1, ":player_no"),
instead of
(store_trigger_param_1, ":agent_id"),
and
(player_get_agent_id, ":agent_id", ":player_no"),
instead of
  (agent_get_player_id,":player_no",":agent_id"),
that simply made it a no result operation.  :???:
But still a error display message appears. 


3. Once the effect is casted the skill bonus (in my single hosted tests)  rests over rounds and even player death!
How can i make the server  reset changes on player stats.? at least in case of death...


4. finally not needed but i tried to abuse the "stand:to_crouch_animation" as a during pray animation! But whenever i try to get any crouch animation at my scene_prop_effect simply nothing happens while other seem to work so far.


 
the bad deed i know but please anybody help me get it working proper it looks realy cool.
28sotn4.jpg
anyone?  :oops:
 
插入代码块:
(ti_on_scene_prop_use, [
	...
	(agent_get_player_id,":player_no",":agent_id"),
	(try_begin),
		(player_is_active, ":player_no"),
		...	                             
		(try_for_range, ":player_no", 1, ":num_players"), #0 is server so starting from 1
			(player_is_active, ":player_no"),
			...
		(try_end),
		...
		(player_set_gold, ":player_no", ":player_gold", multi_max_gold_that_can_be_stored),
	(try_end),
]),

In the last player_set_gold call player_no will have been overwritten by the try_for_range loop in the middle. Use a different variable name in the loop.
 
Wow you again....  :grin:
Solved due to your patience and generousity! Using ":player_id" in the range loop did it perfectly!
 
后退
顶部 底部