how to drowning in deep water

Users who are viewing this thread

Meneldur

Sergeant Knight
made some scenes with deep deep water and yes I tried to let the char. die simply by falling down.

but that seems to be impossible on horseback:
2dgonme.jpg

:roll: that was not my intend

so can I make the char dying under water??




Tried search with: deep water/drowning

nothing useful droped.
 
Well, there is this script (which I did not write), but it kills you instantly if you go too far below ground level. It was designed for sea battles.
Code:
  ("kill_overboard",
      [(try_for_agents,":agent"),
           (agent_get_position,pos1,":agent"),
           (agent_get_position,pos2,":agent"),
           (position_set_z_to_ground_level, pos2),
           (get_distance_between_positions,":dist",pos1,pos2),
           (gt,":dist",500),
           (agent_set_hit_points,":agent",0,0),
           (agent_deliver_damage_to_agent,":agent",":agent"),    
       (end_try),]),

You might be able to set up a trigger in the mission template that checks your depth every 10 seconds or so and then lowers the player's health with the agent_set_hit_points operation. and then finally kills them with the agent_deliver_damage_to_agent operation once their hitpoints gets to a certain level.
 
I tried this code and it works, but the player_agent always calculates a distance of zero? Does anybody know how to kill the player if they are underwater?
 
Keedo420 said:
Well, there is this script (which I did not write), but it kills you instantly if you go too far below ground level. It was designed for sea battles.
Code:
  ("kill_overboard",
      [(try_for_agents,":agent"),
           (agent_get_position,pos1,":agent"),
           (agent_get_position,pos2,":agent"),
           (position_set_z_to_ground_level, pos2),
           (get_distance_between_positions,":dist",pos1,pos2),
           (gt,":dist",500),
           (agent_set_hit_points,":agent",0,0),
           (agent_deliver_damage_to_agent,":agent",":agent"),    
       (end_try),]),

You might be able to set up a trigger in the mission template that checks your depth every 10 seconds or so and then lowers the player's health with the agent_set_hit_points operation. and then finally kills them with the agent_deliver_damage_to_agent operation once their hitpoints gets to a certain level.

I'm sorry -- it's been (lots of) ages since I scripted anything; but wouldn't this also kill the player if he was 500 *units* above water level? (on a very tall hill or something, I don't know) I was just wondering  :smile: (i.e just for personal knowledge, it's not critisism or anything :razz:)
 
Can't you just change the position coordinates to absolute and check for negative z?
 
Highelf said:
I'm sorry -- it's been (lots of) ages since I scripted anything; but wouldn't this also kill the player if he was 500 *units* above water level? (on a very tall hill or something, I don't know) I was just wondering  :smile:
Well, it's checking the distance from ground level, so you're probably right. It would work both ways. 500 units above or below. But the code was written for sea battles, so the chances of being 500 units above ground level are unlikely. :razz:
 
I think you guys are right that there are some potential issues with the original code.  I'm not sure it calculates correctly either, since I think you'd need to run position_get_z after you get the agents position to find out where they are.  I do appreciate the code since I was able to modify it and it seems to be working correctly.  This is my current code:

Code:
sw_common_battle_kill_underwater = (
	# code concept from http://forums.taleworlds.com/index.php/topic,68852.0.html and http://forums.taleworlds.com/index.php/topic,58880.15.html
  5, 0, 0, [],
	[	
		(try_for_agents,":agent"),
			(agent_is_alive,":agent"),
			(agent_get_position,pos1,":agent"),
			(position_get_z, ":pos_z", pos1),
			#(assign, reg1, ":pos_z"), #debug only
			#(display_message, "@agent z-position is {reg1}"),	#debug only
			(try_begin),
				(le, ":pos_z",-150),	#agent is about 6ft underwater
				(store_agent_hit_points,":hp",":agent",1),
				(val_sub,":hp",7),
				(try_begin),
					(le, ":hp", 0),
					(agent_set_hit_points,":agent",0,0),
				(else_try),
					(agent_set_hit_points,":agent",":hp",1),
				(try_end),				
				(play_sound,"snd_man_grunt"),
				(agent_deliver_damage_to_agent,":agent",":agent"), 
			(try_end),
		(try_end),
	])

I'm using it in some of the new arena's I'm working on for the star wars mod.  Don't fall in the water or the sarlacc.  :wink:

     
 
HokieBT said:
I think you guys are right that there are some potential issues with the original code.  I'm not sure it calculates correctly either, since I think you'd need to run position_get_z after you get the agents position to find out where they are.  I do appreciate the code since I was able to modify it and it seems to be working correctly.  This is my current code:

Code:
sw_common_battle_kill_underwater = (
	# code concept from http://forums.taleworlds.com/index.php/topic,68852.0.html and http://forums.taleworlds.com/index.php/topic,58880.15.html
  5, 0, 0, [],
	[	
		(try_for_agents,":agent"),
			(agent_is_alive,":agent"),
			(agent_get_position,pos1,":agent"),
			(position_get_z, ":pos_z", pos1),
			#(assign, reg1, ":pos_z"), #debug only
			#(display_message, "@agent z-position is {reg1}"),	#debug only
			(try_begin),
				(le, ":pos_z",-150),	#agent is about 6ft underwater
				(store_agent_hit_points,":hp",":agent",1),
				(val_sub,":hp",7),
				(try_begin),
					(le, ":hp", 0),
					(agent_set_hit_points,":agent",0,0),
				(else_try),
					(agent_set_hit_points,":agent",":hp",1),
				(try_end),				
				(play_sound,"snd_man_grunt"),
				(agent_deliver_damage_to_agent,":agent",":agent"), 
			(try_end),
		(try_end),
	])

I'm using it in some of the new arena's I'm working on for the star wars mod.  Don't fall in the water or the sarlacc.  :wink:

     

This code does not work for me?! I have past it in the end of module_missions_templates and I get this error when I try to build the module:
Traceback (most recent call last):
  File "process_init.py", line 2, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_global_variables.py", line 12, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
  File "process_map_icons.py", line 6, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 66, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Exporting scene data...
Traceback (most recent call last):
  File "process_scenes.py", line 15, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
  File "process_scene_props.py", line 7, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_tableau_materials.py", line 8, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_presentations.py", line 8, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Exporting party_template data...
Traceback (most recent call last):
  File "process_parties.py", line 6, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
  File "process_scripts.py", line 7, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_mission_tmps.py", line 5, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_game_menus.py", line 8, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_simple_triggers.py", line 5, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_dialogs.py", line 9, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\process_operations.p
y", line 21, in <module>
    from module_mission_templates import *
  File "D:\Dokument\M&B Warband!\System\Module_system 1.143\module_mission_templ
ates.py", line 14857
    sw_common_battle_kill_underwater = (
                                    ^
SyntaxError: invalid syntax
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .

I have warband...
 
I have this sea battle http://forums.taleworlds.com/index.php/topic,136095.0.html, were should I put it then? In the module_mission_templates? In this?:
        #Wulf begin
    (
    "ship_battle",mtf_battle_mode,-1,
    "You close in and board the enemy ships",
    [(0,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (1,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (2,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (3,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (4,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (5,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (6,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),   
    (7,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (10,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (11,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (8,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (9,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (12,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (13,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (14,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (15,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    ],
    [
      (ti_on_agent_spawn, 0, 0, [],
      [
        (store_trigger_param_1, ":agent_no"),
        (call_script, "script_agent_reassign_team", ":agent_no"),
        ]),
   

     
      (0, 0, ti_once, [], [(assign,"$battle_won",0),
                          (assign,"$defender_reinforcement_stage",0),
                          (assign,"$attacker_reinforcement_stage",0),
                          (assign,"$g_presentation_battle_active", 0),
                          (call_script, "script_place_player_banner_near_inventory"),
                          (call_script, "script_combat_music_set_situation_with_culture"),
                          ]),
      common_music_situation_update,
      common_battle_check_friendly_kills,

      (1, 0, 5, [(lt,"$defender_reinforcement_stage",2),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_defenders", 0),
                (lt,":num_defenders",6),
#                (assign, reg2, ":num_defenders"),
#                (display_message,"@num_defenders = {reg2}")
                ],
          [(add_reinforcements_to_entry,0,7),(val_add,"$defender_reinforcement_stage",1)]),
     
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",2),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_attackers", 1),
                (lt,":num_attackers",6),
#                (assign, reg2, ":num_attackers"),
#                (display_message,"@num_attackers = {reg2}")
                ],
          [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),
     
      common_battle_check_victory_condition,
      common_battle_victory_display,
      common_battle_tab_press,

      (1, 4, ti_once, [(main_hero_fallen)],
          [
              (assign, "$pin_player_fallen", 1),
              (str_store_string, s5, "str_retreat"),
              (call_script, "script_simulate_retreat", 10, 20),
              (assign, "$g_battle_result", -1),
              (set_mission_result,-1),
              (call_script, "script_count_mission_casualties_from_agents"),
              (finish_mission,0)]),
#Wulf end
      ]),

Can you please show exactly where? I really need this...
 
Back
Top Bottom