AMARANT Posted July 8, 2012 Share Posted July 8, 2012 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
Jaysds1 Posted July 8, 2012 Share Posted July 8, 2012 Ok, 1. Read Topic: viewtopic.php?f=91&t=42238&hilit=Why+can%27t+I+click+on+dead&p=427374&view=show#p427297 2. Not sure 3. The body is actually a player, so if the player respawns then the body would be moved. Link to comment
AMARANT Posted July 8, 2012 Author Share Posted July 8, 2012 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
50p Posted July 8, 2012 Share Posted July 8, 2012 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
AMARANT Posted July 8, 2012 Author Share Posted July 8, 2012 It seems that "onElementClicked" doesn't work with dead bodies. I tested it. But i'll try setElementAlpha. Link to comment
AMARANT Posted July 8, 2012 Author Share Posted July 8, 2012 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
50p Posted July 8, 2012 Share Posted July 8, 2012 In what way didn't setElementAlpha solve the problem? Maybe your code is bugged and you have errors which you haven't told us about. Check your debug window. Link to comment
AMARANT Posted July 8, 2012 Author Share Posted July 8, 2012 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
Castillo Posted July 8, 2012 Share Posted July 8, 2012 You could move him to another dimension. Link to comment
AMARANT Posted July 8, 2012 Author Share Posted July 8, 2012 (edited) 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 July 8, 2012 by Guest Link to comment
Castillo Posted July 8, 2012 Share Posted July 8, 2012 Remove the player from the vehicle, then set position? Link to comment
AMARANT Posted July 8, 2012 Author Share Posted July 8, 2012 Unfortunately it's not working too Probably the only way to solve it is reporting on the bugtracker... Link to comment
50p Posted July 8, 2012 Share Posted July 8, 2012 How do you want your script to work? Link to comment
AMARANT Posted July 8, 2012 Author Share Posted July 8, 2012 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
Jaysds1 Posted July 9, 2012 Share Posted July 9, 2012 (edited) 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 July 10, 2012 by Guest Link to comment
AMARANT Posted July 10, 2012 Author Share Posted July 10, 2012 Even Gurus of this forum don't know what to do so I came to a conclusion that there is no way to do something with my problem. It's very sad as I expected much more from MTA Link to comment
qaisjp Posted July 10, 2012 Share Posted July 10, 2012 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. Link to comment
Jaysds1 Posted July 10, 2012 Share Posted July 10, 2012 That's what I said in my other post: viewtopic.php?f=91&t=45148#p451710 Link to comment
50p Posted July 10, 2012 Share Posted July 10, 2012 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
Slothman Posted July 10, 2012 Share Posted July 10, 2012 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
qaisjp Posted July 11, 2012 Share Posted July 11, 2012 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
AMARANT Posted July 11, 2012 Author Share Posted July 11, 2012 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
qaisjp Posted July 12, 2012 Share Posted July 12, 2012 Kick the player out of the vehicle, remove his nametag and set alpha to 0, attach player to vehicle (for collision purposes). then create a ped and warp him inside the vehicle. problem solved. Link to comment
AMARANT Posted July 12, 2012 Author Share Posted July 12, 2012 I've already said that the problem is solved in a different way. And how many times I have to say that YOU CANNOT KICK THE DEAD PLAYER OUT OF THE VEHICLE. So forget it. My system is done and I don't need more help, thank you... Link to comment
Castillo Posted July 12, 2012 Share Posted July 12, 2012 I'll lock the topic so nobody else does useless posting. Link to comment
Recommended Posts