It's not fast job, as you notice, by default the death process works like : when player die he
Logout
and its basically removed from game.
According to that - all variables/things/events that related to him before his death - were lost (cuz object got destroyed) and you can't refer to him anymore, because when he login (spawned after death) his object and
creatureId
is new (TFS is assigning new creatureId everytime when new creature object is created).
However, you can do magic and refer to players
GUID
which is unique and constant for each player.
If you don't have experience in C++, you can try to do workaround with introducing "party cache" - something like:
- Create an empty table, for example:
ActiveParties = {}
somewhere in LUA that is loaded "on top of everything" and you can reference to all variables in this file globally, so maybe in global.lua in order to store/cache newly created parties and his members;
- When someone will create party, insert to
ActiveParties
this party with Leader's GUID as an key (person who created party);
- Remember to handle all party events like when player leave party / party disbanded / leader changes / bla bla bla / etc, don't know all possible scenarios from head at this moment.. by performing operations on the
ActiveParties
table as needed;
then... in
login.lua
, do the trick that will search through
ActiveParties
table, look for logged player GUID, if he was in party before, check if party is active, add him to the party, etc.
Of course, there can be other ideas like..
Simulate death : Upon death - instead of logout - heal killed player and teleport him to temple, handle his experience and loot loss by creating player corpse upon death in place where he died, move possible playerLoss items to the corpse, assign all variables that will be on this corpse normally (in normal gameplay scenario), remove experience from him, etc.
probably should be more workarounds, creating something is just limited to your imagination and how well you know what you are working on, in this case TFS, brother.
It's doable but it's time consuming process and not that simple, but not impossible.
Just gave an hint, good luck!