OSP Code Combat Scripting Ragdoll Soak

Users who are viewing this thread

K700

Master Knight
As crpg-only feature. On standard engine, only scripts.


WSE requires only for agent_get_animation_progress. You can use timers instead.
Invisible meshes can be taken from PW. You can also try using agent_set_visibility operation.
Tested only on multiplayer.

Code:
per_frame_trigger = (0, 0, 0, 
	[
		(this_or_next|multiplayer_is_server),
		(neg|game_in_multiplayer_mode),
	],
    [
		(try_for_agents, ":agent_no"),
			(agent_is_active, ":agent_no"),
			(agent_is_human, ":agent_no"),
			(agent_get_animation, ":current_animation", ":agent_no", 0),
			(is_between,":current_animation","anim_fall_face_hold", "anim_fall_rider_right_forward"),
			
			(agent_get_troop_id, ":troop_no", ":agent_no"),
			(try_begin),
				(eq, ":troop_no", "trp_invisible_ragdoll"),
				(agent_get_animation_progress, ":animation_progress", ":agent_no", 0),
				(try_begin),
					(ge, ":animation_progress", 90),
					(remove_agent, ":agent_no"),
				(try_end),
			(else_try),
				(agent_slot_eq, ":agent_no", slot_agent_have_invisible_ragdoll_after_death, 0),
				
				(agent_get_position,pos1,":agent_no"),
				(set_spawn_position, pos1),
				(spawn_agent, "trp_invisible_ragdoll"),
				(assign, ":ragdoll_agent_no", reg0),
				(agent_set_is_alarmed, ":ragdoll_agent_no", 0),
				(agent_get_team, ":team_no", ":agent_no"),
				(agent_set_team, ":ragdoll_agent_no", ":team_no"),
				
				(try_begin),
					(multiplayer_is_server),
					(get_max_players, ":num_players"),
					(try_for_range, ":current_player", 1, ":num_players"),
						(player_is_active, ":current_player"),
						(multiplayer_send_2_int_to_player, ":current_player", multiplayer_event_agent_set_team, ":ragdoll_agent_no", ":team_no"),
						(multiplayer_send_3_int_to_player, ":current_player_no", multiplayer_event_agent_set_animation, ":ragdoll_agent_no", ":current_animation", 0),
					(try_end),
				(try_end),

				(agent_set_no_death_knock_down_only, ":ragdoll_agent_no", 1),
				(agent_set_slot, ":agent_no", slot_agent_have_invisible_ragdoll_after_death, 1),
			(try_end),
		(try_end),
    ])

      (ti_on_agent_killed_or_wounded, 0, 0, [],
       [
...
(try_begin), #count players and if round ended understand this.
           (agent_is_human, ":dead_agent_no"),
		   
		   (agent_get_troop_id, ":dead_agent_troop_id", ":dead_agent_no"),
		   (neq, ":dead_agent_troop_id", "trp_invisible_ragdoll"),
		   
           (assign, ":team1_living_players", 0),
           (assign, ":team2_living_players", 0),
           (try_for_agents, ":cur_agent"),
             (agent_is_human, ":cur_agent"),         
             (try_begin),
               (agent_is_alive, ":cur_agent"),
			   
			   (agent_get_troop_id, ":cur_agent_troop_id", ":cur_agent"),
			   (neq, ":cur_agent_troop_id", "trp_invisible_ragdoll"),
			   
               (agent_get_team, ":cur_agent_team", ":cur_agent"),
               (try_begin),
                 (eq, ":cur_agent_team", 0),
                 (val_add, ":team1_living_players", 1),
               (else_try),
                 (eq, ":cur_agent_team", 1),
                 (val_add, ":team2_living_players", 1),
               (try_end),
             (try_end),
           (try_end),       
...         ]),

      (1, 0, 0, [],
       [....
(assign, ":is_found", 0),
             (try_for_agents, ":cur_agent"),
               (eq, ":is_found", 0),
               (agent_is_alive, ":cur_agent"),
               (agent_is_human, ":cur_agent"),
               (agent_is_non_player, ":cur_agent"),
               (agent_get_team ,":cur_team", ":cur_agent"),
               (eq, ":cur_team", ":player_team"),
			   
			   (agent_get_troop_id, ":cur_agent_troop_id", ":cur_agent"),
			   (neq, ":cur_agent_troop_id", "trp_invisible_ragdoll"),
			   
               (assign, ":is_found", 1),
               #(player_control_agent, ":player_no", ":cur_agent"),
             (try_end),

             (try_begin),
               (eq, ":is_found", 1),
               (call_script, "script_find_most_suitable_bot_to_control", ":player_no"),
               (player_control_agent, ":player_no", reg0),

               (player_get_slot, ":num_spawns", ":player_no", slot_player_spawned_this_round),
               (val_add, ":num_spawns", 1),
               (player_set_slot, ":player_no", slot_player_spawned_this_round, ":num_spawns"),
             (try_end),
...         ]),

Code:
["invisible_ragdoll", " ", " ", tf_no_sound|tf_disable_sounds|tf_guarantee_all, 0, 0, 0, [itm_invisible_head, itm_invisible_legs, itm_invisible_hands, itm_invisible_body], str_6|agi_6, 0, 0, swadian_face_middle_1, swadian_face_old_2],

Code:
["invisible_head", "Headless", [("invisible",0)], itp_type_head_armor|itp_covers_head   ,0, 0 , weight(0)|abundance(0)|head_armor(0)|body_armor(0)|leg_armor(0)|difficulty(0) ,imodbits_plate ],
["invisible_legs", "Legsless", [("invisible",0)], itp_type_foot_armor|itp_attach_armature   ,0, 0 , weight(0)|abundance(0)|head_armor(0)|body_armor(0)|leg_armor(0)|difficulty(0) ,imodbits_plate ],
["invisible_hands", "Handsless", [("invisible_L",0)], itp_type_hand_armor   ,0, 0 , weight(0)|abundance(0)|head_armor(0)|body_armor(0)|leg_armor(0)|difficulty(0) ,imodbits_plate ],
["invisible_body", "Bodyless", [("invisible",0)], itp_covers_legs|itp_type_body_armor   ,0, 0 , weight(0)|abundance(0)|head_armor(0)|body_armor(0)|leg_armor(0)|difficulty(0) ,imodbits_plate ],

Code:
(
    "no_sound", 0,
    "man_body", "man_calf_l", "m_handL",
    "male_head", man_face_keys,
    [],
    [],
    ["hair_blonde"],
    [],
    [("manface_young_2",0xffcbe0e0,["hair_blonde"],[0xffffffff, 0xffb04717, 0xff502a19]), ],
    [], #voice sounds
    "skel_human", 1.0,
    psys_game_blood,psys_game_blood_2,
  ),


Code:
tf_no_sound       = 4

Code:
slot_agent_have_invisible_ragdoll_after_death = 30

Code:
("game_quick_start",
    [....
        (str_clear, s0),
	(troop_set_name, "trp_invisible_ragdoll", s0),
	(troop_set_plural_name, "trp_invisible_ragdoll", s0),
...   ]),

  ("game_receive_network_message",
    [...
	
	(else_try),
		(eq, ":event_type", multiplayer_event_agent_set_team),
		(store_script_param,":agent_no",3),	
		(store_script_param,":team_no",4),
		(agent_set_team, ":agent_no", ":team_no"),
	(else_try),	
		(eq, ":action", multiplayer_event_agent_set_animation),
                (store_script_param, ":agent_no", 3),
		(store_script_param, ":anim", 4),
		(store_script_param, ":value", 5),
		(agent_set_animation, ":agent_no", ":anim", ":value"),	
		
	.....]),    

  ("add_kill_death_counts",
   [...
 (try_begin),
            (agent_is_non_player, ":dead_agent_no"), #if dead agent is bot then increase bot kill counts of dead agent's team by one.
			(agent_get_troop_id, ":troop_id", ":dead_agent_no"),
			(neq, ":troop_id", "trp_invisible_ragdoll"),
            (agent_get_team, ":dead_agent_team", ":dead_agent_no"),
            (team_get_bot_death_count, ":dead_agent_team_bot_death_count", ":dead_agent_team"),
            (val_add, ":dead_agent_team_bot_death_count", 1),
            (team_set_bot_death_count, ":dead_agent_team", ":dead_agent_team_bot_death_count"),
          (else_try), #if dead agent is not bot then increase death counts of dead agent's player by one.
    ...]),


  #script_troop_agent_set_banner
  # INPUT: agent_no
  # OUTPUT: none
  ("troop_agent_set_banner",
    [
       (store_script_param, ":tableau_no",1),
       (store_script_param, ":agent_no", 2),
       (store_script_param, ":troop_no", 3),
       (try_begin),
		   (neq, ":troop_no", "trp_invisible_ragdoll"),
		   (call_script, "script_agent_troop_get_banner_mesh", ":agent_no", ":troop_no"),
		   (cur_agent_set_banner_tableau_material, ":tableau_no", reg0),
       (try_end),

     ]),

Code:
multiplayer_event_agent_set_team = 113 
multiplayer_event_agent_set_animation = 114
 
Namakan said:
It's placeholders.
There's other stuff in those scripts already, so you need to place it somewhere inside them. Make sure to not place it in some try blocks if it's not needed.

ERROR: Usage of unassigned local variable: :action
ERROR: Usage of unassigned local variable: :current_player_no
ERROR: Usage of unassigned local variable: :current_player_no
ERROR: Usage of unassigned local variable: :current_player_no
ERROR: Usage of unassigned local variable: :current_player_no
ERROR: Usage of unassigned local variable: :current_player_no
ERROR: Usage of unassigned local variable: :current_player_no
ERROR: Usage of unassigned local variable: :current_player_no
ERROR: Usage of unassigned local variable: :current_player_no


need a help


i added it but invisible ragdoll is walking and another warriors fight with the ragdoll. How to fix the issue
 
Back
Top Bottom