You don’t need a new script, you only have to copy the health text elements etc. to your other entity and add this elements to the attributes of the other entity health script.
oh ok
ARGH now it is not doing anything. i copied all the entities in “Character” to “other”, but it is not working still…
it is still also spawning a clone of the player when only one person is in the game
Did you assign the correct entities to the health script attributes of the other entity?
It’s your game, so if the script does something you don’t expect, check your script. I don’t understand for example why there is an enemySpawner attribute in your health script, but I hope you understand why.
You have many small scripts with similar functions, so make sure you only use scripts that you actually want to use.
this is what happenes now: it still takes damage away from the player who is shooting, but th e health text does not change. also, here i am shooting clones that were spawned for some reason without launching the game twice
result.entity.collision.entity.rigidbody.applyImpulse(this.camera.forward.scale(this.hitImpulse), result.normal);
What is this?
If someone else launch your project (me for example) you also see this as a player.
the code is recoil stuff
I don’t think this is the case. It just enabled the menu screen on the wrong device. I think this is server related and I don’t know how that works yet.
ok
I tried to add something similar in the multiplayer example project. It only works locally right now. You can check the project below.
https://playcanvas.com/project/827020/overview/custom-multiplayer
thanks
Thanks so much! i tried your script, and it takes away the other person’s health, but it kills the person who is shooting…
ok good news: when i try your script, it takes the health away from the other player. bad news: i can’t figure out how to make them return to the main screen when their health hits 0.
this is the code i am using to kill the player, but it is not working
Health2.prototype.update = function(dt) {
if(this.Health <= 0)
{
this.entity.script.enabled = false;
this.deathScreen.enabled = true;
this.mainScreen.enabled = false;
}
};
Are you sure it is this.Health
and not this.health
?
that made it show the death screen, but to the person who was shooting, not the player being shot at… hmm…
Yeah, I don’t know why that is. I think I need to understand the multiplayer server part for that.