Jump to content

Dead mechanics


AMARANT

Recommended Posts

I have some questions about player's dead state. I started making revive system and came across many problems with it. So...

1) Why can't I click on a dead body lying on the ground?

2) What really happens with player element after in-game death?

3) Why can't I see a dead body on its death spot after relogin?

Thanks in advance for your answers.

Link to comment

But how can I remove the lying body somewhere if I want to create a ped on that dead spot? I mean hide it or something. I tried to change its position and it worked fine until I tried again with the player being in a car. As a result of it there were two bodies. One of it was my just created ped and the other one was actually my player. Is there any way to sort out this problem with removing "real" body?

Link to comment

You can use setElementAlpha to hide elements (but shadow is still visible if it's vehicle or ped).

What's the point having 2 peds anyway? Doesn't onElementClick work with dead player?

Link to comment

setElementAlpha didn't solve the problem unfortunately :( I see the only way in creating a ped instead of player but I need to remove that player somewhere. Like I said it works fine with ordinary situations but if the player dies in a vehicle I can't remove his body. The body is like attached to the vehicle and even the function "removePedFromVehicle" doesn't help. What that could be?

Link to comment

My code is not bugged. By saying "setElementAlpha didn't solve the problem" I meant that it's not the way to make my system 100% work. Alpha makes a body invisible but there are still player's HP bar, nickname and shadow. I'd put up with it but only not when a player dies in a vehicle. In this case those bars, nicknames and shadows move with the vehicle. Like I said the main problem at the moment is a dead player in a vehicle that cannot be removed from it. If I could just change the dead player's position then my system would work perfect even without setting alpha to 0. But because of death in a vehicle it's impossible and I thought that someone knew the solution.

Link to comment

Apparently nobody dealt with it yet :)Solidsnake14 it was the first thing I tried to do. And I was very surprised because it didn't work. But moving to another position did until I found out about those problems with death in vehicle.

Edited by Guest
Link to comment

The best way would be clicking on a dead body. But as it's impossible I'd like to create lying ped on the death spot and removing real player's body from that position somewhere. Then I could click on that ped and the player would be revived from GUI window. That's it.

Link to comment

How about leaving the players health higher than death(0) then when you click on the player then you could revive the player,

but you have to set them in a animation and disable their controls.

Edited by Guest
Link to comment
You can modify the onPlayerDamage to make the death at "1", so when you reach health=1, then you set the animation and prevent any further damages. It is possible.

Remember, when you die from explosion you won't even be left with 1hp. You could set his health to 1 but that won't prevent him from dying since he's already dead.

Link to comment

to make a player revivable, onclientdamage, if the damage is enough to kill the player, then cancel it and induce a different pretend death using player animations. you could have players "fake" their deaths with this method as well, which could make for some interesting gameplay in something like stealth.

if you want the corpse of a player to still be there after a player respawns, replace the player corpse with a ped of the same skin and position, set the death animation (you can even set the progress of the animation to the end to make it as seamless as possible).

The only visible side effect to these would be that the corpse would not fade to blue in infrared mode.

Link to comment

Or, create something like this:

  
function spawnCorpse( ) 
    local x,y,z = getElementPosition(source) 
    local mod = getElementModel(source) 
    local rot = getPedRotation(source) 
    local dead = createPed(mod,x,y,z,rot) 
    setPedAnimation(dead,...) 
end 
onPlayerSpawn:Handle(spawnCorpse) 
  

Ofcourse this is just mixed openframe code. But yes, thats rough code.

Link to comment

Thanks for your advice, but I suppose that some of you guys haven't read the whole topic. I'm not a newbie scripter and I know how to do many things unless I come across something new that I haven't dealt with yet. And I created a ped with animation, sticked camera to him, removed a real dead player to another place, made everything to create an illusion of death as if there were my dead player lying on the ground. But! If you had read previous page of this topic then you would have known that there is a very annoying bug with death in a car or other vehicle. You can't remove dead player from that vehicle in case of death. That was my largest problem.

As there is no way to fix that, I put up with it because I found a solution - function "spawnPlayer" that actually revives player. I just revive player at the moment of his death and spawn him at different location. That works fine even if you died in a car and lets me create ped, animations and other stuff on the dead spot. So I think that the problem is solved. But I reported a new issue on the bugtracker. And you can help to fix dead bugs in the future by leaving some comments on this page. Anyway thanks to everyone who tried to help me with this :)

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...