I've been trying to make a script that hurts a player while he is in water, but I can't figure out a way to do it. Playerhearts can't be subtracted while the player is in water Please help me with this.
Re: Hurt a player in water?
um, you could have it save the playerhearts to a variable when the player is onwater. Like if(onwater){this.playerhealth=playerhearts;} then go this.playerhealth = this.playerhealth-1; when was hit. When the player touchs land again or this.playerhealth < .5; playerhearts = this.playerhealth; and if need be warp the player to land and kill him off. Just do a loop and check 1 spot right of the player to see if its water, then keep adding 1 x till u hit land or something.
Not the best idea, but something.
Re: Hurt a player in water?
It's imposible on v2.1.7.1 to harm a player on water using the default hp system. You'll have to use a custom hp system if you want to have a player drown.
Re: Hurt a player in water?
An extension to the onwater hp variable idea, is to hide the hud stuff with enablefeatures-flag; and reshow the hud images using showimg and this.screenposition[0] (x) and [1] (y). Then just make a quick hp system that shows the hearts and half hearts based off the hp variable. Still work the same, only difference is you will see the hearts going down when your hit. Also might have to add detection for stuff to hit the player, like arrows and swords well they are in water. (so if explosion or dart in |playerx| &&|playery|)
Best solution overall is to rescript a new water tile. Since you want them to be able to get hit on water anyway. Just add a picture water tile and add
If(playertouchsme){setani swim,;}