Script Help? – Edit Placeable Object Name.
dargno07
Member Posts: 10
Hi
What i'm trying to do is create a lootable corpse on player death that gets deleted after 10 minutes. 1 random equipped item and maybe 10-30% GP from dead player gets placed on corpse. Corpse can then be looted by anyone, but would be great if script had an option (either by cd key, or player name) to link player to their corpse making corpse lootable only by whoever it belongs to.
I have it all working except for option to link player name to the object... anyone able to help me out?
Also, would it be possible to change the name of the corpse/object after it's creation?
Edit; The script is for "OnPlayerRespawn" not ondeath.
What i'm trying to do is create a lootable corpse on player death that gets deleted after 10 minutes. 1 random equipped item and maybe 10-30% GP from dead player gets placed on corpse. Corpse can then be looted by anyone, but would be great if script had an option (either by cd key, or player name) to link player to their corpse making corpse lootable only by whoever it belongs to.
I have it all working except for option to link player name to the object... anyone able to help me out?
Also, would it be possible to change the name of the corpse/object after it's creation?
Edit; The script is for "OnPlayerRespawn" not ondeath.
0
Comments
You can then GetDescription in the OnUsed event etc to check that the player name matches before opening the inventory. If not, tell the player "this is not your corpse" and close the inventory (from memory, clearing player actions or starting a conversation will do that, or you could lock the corpse, unlocking only for the owner).
Thanks
now i am trying to do something else though... after 3 minutes i'd like to make the corpse lootable by everyone, not just the player it's linked to.
to link the player name to the object i use this -
string sPlayerName=GetPCPlayerName(oRespawner);
SetLocalString(oCorpse, "player_name", sPlayerName);
then i delete the string in the same OnPlayerRespawn script -
DelayCommand(180.0,DeleteLocalString(oCorpse, "player_name"));
this is what i have in the OnUsed event for the corpse object -
void main()
{
object oPC=GetLastUsedBy();
string sPlayerName=GetPCPlayerName(oPC);
if(GetLocalString(OBJECT_SELF, "player_name") != sPlayerName)
{
//DelayCommand(1.0, FloatingTextStringOnCreature("This corpse does not belong to you.", oPC, FALSE));
AssignCommand(oPC, ClearAllActions(TRUE));
ActionStartConversation(oPC);
return;
}
}
so... how do i make the object lootable by everyone after 3 minutes, deleting the string doesn't work. After 3 minutes the conversation starts for the player who is linked to the object, and everyone else.
Thank ya!
Then you can add
int iExpired = GetLocalInt (OBJECT_SELF,"expired");
if (iExpired >0) // make lootable if not check playername and fire convo
may be a better way of doing this, but thats my 10c