
MoooseGuy
Joined: Aug 10, 2008
I Approve This Message.
|
Posted: Oct 13, 2010 02:38 PM
Msg. 1 of 7
Hey guys, this is one of the weirder questions out there, but how can I set a script to be able to damage a player at a specified amount when he enters a volume? If anyone knows how to do this, thanks. I will be needing this before I can continue scripting some other things. 
|
|
|

d4rfnader
Joined: Jul 16, 2010
Open mouth, insert sandwhich.
|
Posted: Oct 13, 2010 03:45 PM
Msg. 2 of 7
Nevermind, it doesn't work i'll try to figure it out. Edited by d4rfnader on Oct 13, 2010 at 03:58 PM
|
|
|

MoooseGuy
Joined: Aug 10, 2008
I Approve This Message.
|
Posted: Oct 13, 2010 04:14 PM
Msg. 3 of 7
OMG Grunts YOU ARE GOD! Thank you so much. ^^ This is gonna be for a singleplayer map, and I want the volume to instantly kill the player, but without using the unit_kill command (for special reasons). Is there any fluff I should remove based on this? Thanks again 
|
|
|

Gamma927
Joined: Jun 12, 2008
Steam: gamma927
|
Posted: Oct 13, 2010 04:46 PM
Msg. 4 of 7
Quote: --- Original message by: ASP_GRUNTS(script static unit player (unit (list_get (players) player_number)) )
(script continuous damageplayer (if (= (volume_test_object tvolname (player)) true) (if (= (unit_get_shield (player)) 0) (unit_set_current_vitality (player) (- (unit_get_health (player)) 1) (unit_get_shield (player))) (unit_set_current_vitality (player) (unit_get_health (player)) (- (unit_get_shield (player)) 1)) ) ) (set player_number (+ player_number 1)) (if (= player_number 16) (set player_number 0) ) ) There might be a few errors in there I overlooked in the parenthesis, but it has all of the essential pieces in there. Any player, once in the specified trigger volume (replace tvolname with the name), will recieve a damage of 1 on his shields, until the shields reach 0, and that's when it will damage the health of that player by 1. Keep in mind, a player's default shield and health amount is 75. The script runs 30 times a second. It will take exactly 2.5 seconds (2.5x30=75) for the shields to run out, and another 2.5 seconds for the health to run out, and the player will die. You can change the amount of damage the player is taking in the script. If you wish to do so, tell me and I'll explain further on how to do that, if you don't know. Doesn't work, because the unit_get_health command returns either 0 or 1, 0 for none, 1 for full, and -1 for nonexistent.
|
|
|

Gamma927
Joined: Jun 12, 2008
Steam: gamma927
|
Posted: Oct 13, 2010 04:52 PM
Msg. 5 of 7
That "someone" is wrong. From the scripting bible:
(unit_get_health [unit])
returns the health [0,1] of the unit, returns -1 if the unit does not exists Edited by Gamma927 on Oct 13, 2010 at 04:55 PM
|
|
|

Gamma927
Joined: Jun 12, 2008
Steam: gamma927
|
Posted: Oct 13, 2010 04:57 PM
Msg. 6 of 7
I don't give a crap if you believe me or not. The truth is the truth.
|
|
|

Gamma927
Joined: Jun 12, 2008
Steam: gamma927
|
Posted: Oct 13, 2010 05:09 PM
Msg. 7 of 7
Well then, why must I test it? Would you disagree with the scripting bible and I who've used the script just to stick to that "someone" who said it didn't work?
Simple test for whoever doesn't believe me:
1) Place a biped in Sapien, and name it biped1 2) Hit the `/~ key to bring up the Sapien console 3) Type in: unit_get_health biped1 4) Look at what number Sapien gives you. If it's between 0 and 1, then I'm right. If it's -1, the biped's dead, and I'm right. If it's any other number other than anything between 0 and 1, or -1, then GRUNTS is right.
Happy? Edited by Gamma927 on Oct 13, 2010 at 05:11 PM
|
|
|
| |
|
|
 |
|