Multiplayer Bleed Script {Req Help}

Users who are viewing this thread

Sir_Pink

Veteran
I made this bleed script for Native multiplayer and it works great. If the player aka player_agent hp = 50% health then the players health starts to minus from its current value until it reaches 0. When the players hp hits 1, then the death sound is played. Then the players sound is stopped and the player is killed.

My question is how can I position the (particle_system_burst, "psys_game_blood_2", pos1), on a specific location on the player agent. If I track the player agents position, then set the particle burst at the player agents position the effect appears under his feet. I'm curious if it would be possible to add to the current agents Y axis for example. Say the agent is at 0,60,0 but i need the particle effect to appear above his position so it spurts from his chest. I would have to add 30 so it would be 0,90,0, then set the burst effect to execute at that updated position.

My second idea is to have the particle effect to continuously spurt from where the player was hit from last, then track that position on the player agent. If someone could help me on steam or point me in the right direction of which operators i could use in header_operations, I would greatly appreciate it.

my steam name is coawie13337 (there are 3 threes, a lot of people make the mistake of only typing two ^_^)

Thank you for taking the time to read my wall of text. screen shot with color coding bellow and copy and paste mode for the source.

Copy and paste version:
Code:
hurtplayer = (
             
           #1,0,0,[(store_current_scene,":current_scene"),(multiplayer_is_server),(eq,":current_scene","scn_multi_blankmap")],
			1.5,0,0,[],	  #Fires every 1second
	  [
		(multiplayer_is_server), # test for a multiplayer server.
		#(set_fixed_point_multiplier, 10),
		(try_for_agents,":cur_agent"), # loops through all players.
			(agent_is_alive,":cur_agent"), #  test for alive players.
			(agent_is_human,":cur_agent"), # test for player that are human.
			(store_agent_hit_points,":cur_agent_hp",":cur_agent", 1), # stores the hp value of the alive and human players.
			(gt, ":cur_agent_hp",27.5), #55 = max? #27.5 = 50% # test if the players hp is greater than 27.5 and if true exit the loop.
			(store_add,":cur_full_health", ":cur_agent_hp",0),
			(agent_set_hit_points,":cur_agent", ":cur_full_health",1),
		(else_try),
			(store_sub,":damage",":cur_agent_hp",1), # if the above try_for_agents statement failed, store the players hp and subtract 1 from it.
			(agent_set_hit_points,":cur_agent", ":damage",1), # update the players hp value with the new calculation value from above.
			
			####################################
			#                      Blood Spurt  code START              #
			####################################
			#(agent_get_position,pos1,":cur_agent"), 
			#(position_get_z,":cur_agent_z",pos1),
			#(store_add,":cur_agent_z_above", ":cur_agent_z", 60),
			#(position_set_z, pos2, ":cur_agent_z_above"),
			#(agent_set_position,":cur_agent", pos2),  # (agent_set_position,<agent_id>,<position_no>),
			#(agent_get_position,pos2,":cur_agent"), 
			
			#(particle_system_burst, "psys_game_blood_2", pos1),
			####################################
			#                      Blood Spurt  code  END              #
			####################################
			
				(try_begin), # test if the players hp equals 1.
					(eq, ":damage", 1), 
					(agent_play_sound, ":cur_agent", "snd_man_die"), # if the value is one then play death sound.
				(try_end),
									
		         (try_begin), # test if the players hp value is 0, if so kill him and stop the sounds.
					(le,":damage",0),
					(agent_stop_sound, ":cur_agent"),
					
						#(try_begin),
							#(player_get_death_count, ":player_kill_count", ":cur_agent"),
							(remove_agent, ":cur_agent"),  # Alternative = (agent_deliver_damage_to_agent,":cur_agent",":cur_agent"),
							#(val_sub, ":player_kill_count", 1),
							#(player_set_death_count, ":cur_agent", ":player_kill_count"),
							#(player_get_agent_id, ":bleeding_agent", ":cur_agent"),
						(try_end),

					
				(try_end),
		(try_end),
			
      ])

Viewing version:
129d76ba7c2a9a4e77e09f2cbc4ca95a.png


Bonus:
fuqi2t.gif
 
First of all, to get percentage health, the last parameter in store_agent_hit_points should be 0. The loop will exit after gt fails (alternatively, change it to le and remove the else_try), so there's no need to re-set hp if it doesn't change. There should be a try_begin under agent_is_human, otherwise the second half of your code will trigger for horses (a matching try_end already exist). Keep in mind that you can re-use local variables, so the store_sub/add may not be necessary.

To answer your original question, the code you used should be correct, except you forgot to use set_fixed_point_multiplier in order to specify the magnitude of translation in the z axis. Alternatively, you can make a copy in module_particle_systems, and increase the emit box size.
 
I don't think that quite answered my question. How can i get the blood particle effect to to appear up by his chest. as you can see in the screen shot, it's in the wrong spot. Currently its bursting from his feet.

caf6903ba686688a41b623f6b51b1309.png
 
Sir_Pink said:
My question is how can I position the (particle_system_burst, "psys_game_blood_2", pos1), on a specific location on the player agent. If I track the player agents position, then set the particle burst at the player agents position the effect appears under his feet. I'm curious if it would be possible to add to the current agents Y axis for example. Say the agent is at 0,60,0 but i need the particle effect to appear above his position so it spurts from his chest. I would have to add 30 so it would be 0,90,0, then set the burst effect to execute at that updated position.

You can add lines to move the blood's Y and Z positions, and even rotate it so that it spurts outwards, like this:

     
      (agent_get_position, pos1, ":cur_agent"),
        (position_move_z, pos1, 103), #makes the blood higher, otherwise it's on ground level
        (position_move_x, pos1, -35), #makes the blood out from the torso towards the arm stump
        (position_move_y, pos1, -10), #makes the blood come out severed stump
        (position_rotate_x, pos1, -90), #makes the blood spurt downwards
        (particle_system_burst, "psys_game_blood_2", pos1, 100), #100 as power.

This is what I use to make blood spurt from the stump of a chopped off arm.  You will have to change the
height on the z axis especially, probably to about 150 or 160, and either change it's position on the x axis to be closer in to the body, or remove the x line altogether.  Tracking where the player was last hit and making the blood continuously come from that point on the body is a lot more complex, I'm afraid I can't really help with that.
 
You sir are amazing, thank you so much  :grin:. Exactly what i was looking for! ^_^.  I'm curious if its possible to have the blood stain on your clothes grow, just like if a blade were to hit you, then you get hit again the blood strain gets larger. It would be a nice effect to have the blood stain keep growing as the players health ticks down so the blood effect isn't as dramatic.

My idea behind the logic of it would be soon as the players health drops bellow 50% hp in my script, have that position that the player was hit tracked and have the blood stain on the clothes keep bursting. until the players hp drops bellow 0 and dies.
 
You could rotate the blood spurt so that it is kind of spurting "into" the person rather than out of them - the stain on their clothes will grow, and there wouldn't be so much blood flying outward off of them after they've been hit. 

Once you have the blood at the correct height use something like  - (position_rotate_x, pos1, -45),

Or you might want to use a positive number, near 45, so that instead of the blood spraying out of them it is spraying backward onto their body and staining their clothes.  That should work.  It might actually be a rotate y or z command you want, but one of those will work.
 
I wasn't sure about that.  I kind of thought it was, 'cos I've seen my guys with bloodstains on them from their wounds/stumps, but I suppose that could have come from the strike itself.  Is there a way to apply vertex blood via scripting?
 
Via screwing around with the tableau system and re-equiping items. It will get rid of the existing blood, but you can probably make custom splatter patterns or something.
 
Back
Top Bottom