DBP == death by posession
3 posters
Page 1 of 1
DBP == death by posession
vlad possessed merux to scout the area.merux got sniped by a troll and vlad died.
not good for mages.it made me a sad sad panda and i lost 6k xp and 100k gold vlad didnt spawn a corpse.standing in fugue sucks.
fix to anph-on-pc-death.same code as on your public mod .difference is i made a wrapper around to look for possessesed pcs
on dying needs the fix also.made the same thing here.,
it looks like you can avoid dying by possessing a familiar just before you die but the hardcode stops that. if pc dies familiar unsummons and pc has no living object to return to so pc dies.this works 100%.no way to avoid it.
the delay is there cuz it can lag and then nwscript looooooooves delays then.
not good for mages.it made me a sad sad panda and i lost 6k xp and 100k gold vlad didnt spawn a corpse.standing in fugue sucks.
fix to anph-on-pc-death.same code as on your public mod .difference is i made a wrapper around to look for possessesed pcs
- Code:
#include "hc_inc"
#include "hc_inc_on_death"
#include "anph_inc"
#include "anph_db_inc"
#include "anph_dropstuff"
#include "anph_xp_inc"
#include "anphrez_inc"
#include "zep_inc_phenos2"
#include "moth_inc_effects"
#include "x3_inc_horse"
void jumpToFugue (object oPlayer);
void AnphPCDeath(object oPlayer);
void main()
{
if(!preEvent()) return;
object oPlayer = GetLastPlayerDied();
if(!GetIsPossessedFamiliar(oPlayer)){
DelayCommand(0.1,AnphPCDeath(oPlayer));
}
}
void jumpToFugue (object oPlayer)
{
string sLimboTag;
int iPlayerTeam = AnphGetPlayerTeamInt (oPlayer);
sLimboTag = GetLocalString(oMod, "FACTION_0" + IntToString(iPlayerTeam) + "_FUGUE");
object oLimbo = GetObjectByTag (sLimboTag);
AssignCommand (oPlayer, JumpToObject (oLimbo));
}
void AnphPCDeath(object oPlayer)
{
object oHenchman = GetHenchman(oPlayer);
object oKiller;
location lTarget;
object oTarget;
location lLocation;
int PvPDeath = FALSE;
object LastActor = GetLastHostileActor();
if (GetItemPossessedBy(oPlayer, "axfellwarriorrin")!= OBJECT_INVALID)
{
oTarget = GetWaypointByTag("AxfellFugue");
lTarget = GetLocation(oTarget);
}
if (GetItemPossessedBy(oPlayer, "cleavenmilitiari")!= OBJECT_INVALID)
{
oTarget = GetWaypointByTag("CleavenFugue");
lTarget = GetLocation(oTarget);
}
if(MothGetIsOrbWorld(oPlayer)==TRUE)
{
string sStartTag = GetLocalString(GetModule(), "FACTION_0" + IntToString(AnphGetPlayerTeamInt(oPlayer)) + "_STARTLOCATION");
oTarget = GetObjectByTag(sStartTag);
lTarget = GetLocation(oTarget);
}
if (GetLocalObject(oPlayer, "LastHostileActor") == OBJECT_INVALID ||
GetObjectType(LastActor) == OBJECT_TYPE_CREATURE)
{
oKiller = GetLastHostileActor(oPlayer);
}
else
{
oKiller = GetLocalObject(oPlayer, "LastHostileActor");
}
if ((GetLocalInt(oPlayer, "PvPDeath") == 1 ||
GetIsPC(oKiller) ||
GetIsPC(GetMaster(oKiller)) ||
!GetIsObjectValid(oKiller) ||
GetName(oKiller) == "") &&
(AnphGetPlayerTeam(oPlayer) != AnphGetPlayerTeam(oKiller) ||
(AnphGetPlayerTeam(oPlayer) != AnphGetPlayerTeam(GetMaster(oKiller)) &&
GetIsPC(GetMaster(oKiller))
)
)
)
{
PvPDeath = TRUE;
}
if (GetIsDM(oKiller) ||
GetIsDM(GetMaster(oKiller)))
PvPDeath = FALSE;
DeleteLocalInt(oPlayer, "PvPDeath");
if (GetName(oKiller) == "") SendMessageToAllDMs("Last Trap-Setter identified as: " + GetName(GetTrapCreator(oKiller)) + ".");
string sName = GetName (oPlayer);
if (GetIsObjectValid(oHenchman))
RemoveHenchman(oPlayer, oHenchman);
AnphDropStuff (oPlayer);
location lDiedHere = GetLocation (oPlayer);
SetLocalLocation (oPlayer, "DeathLocation", lDiedHere);
int iDidXPLoss = GetLocalInt (oPlayer, "DidXPLoss");
if (iDidXPLoss != 1)
doXPLoss (oPlayer, oKiller, FALSE, OBJECT_INVALID, FALSE, PvPDeath);
SetLocalInt (oPlayer, "DidXPLoss", 1);
DelayCommand (20.0, DeleteLocalInt (oPlayer, "DidXPLoss"));
if (GetIsObjectValid (oKiller))
SendMessageToAllDMs("** " + sName + " was killed by "+
GetName(oKiller) + " in " + GetName(GetArea(oKiller)));
AnphCheckPK (oPlayer, oKiller);
if(PvPDeath){
WriteTimestampedLogEntry("*** PvP Death -!- killerLogin:" + GetPCPlayerName(oKiller) + ", killer:" + GetName(oKiller) + ", victimLogin:" + GetPCPlayerName(oPlayer) + ", victim:" + GetName(oPlayer) + ", area:" + GetName(GetArea(oKiller)) + ", ***");
}else{
WriteTimestampedLogEntry("*** PvE Death -!- killer:" + GetName(oKiller) + ", victimLogin:" + GetPCPlayerName(oPlayer) + ", victim:" + GetName(oPlayer) + ", area:" + GetName(GetArea(oKiller)) + ", ***");
}
DeleteLocalObject(oPlayer, "LastHostileActor");
DelayCommand(1.0, ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectResurrection (), oPlayer));
DelayCommand(1.0, ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectHeal (GetMaxHitPoints (oPlayer)), oPlayer));
zep_Dismount(oPlayer);
object oHorse;
object oInventory;
string sID;
int nC;
string sT;
string sR;
int nCH;
int nST;
object oItem;
effect eEffect;
string sDB="X3SADDLEBAG"+GetTag(GetModule());
if (GetStringLength(GetLocalString(GetModule(),"X3_SADDLEBAG_DATABASE"))>0) sDB=GetLocalString(GetModule(),"X3_SADDLEBAG_DATABASE");
if (HorseGetIsMounted(oPlayer))
{
DelayCommand(0.3,HORSE_SupportResetUnmountedAppearance(oPlayer));
DelayCommand(3.0,HORSE_SupportCleanVariables(oPlayer));
DelayCommand(1.0,HORSE_SupportRemoveACBonus(oPlayer));
DelayCommand(1.0,HORSE_SupportRemoveHPBonus(oPlayer));
DelayCommand(1.1,HORSE_SupportRemoveMountedSkillDecreases(oPlayer));
DelayCommand(1.1,HORSE_SupportAdjustMountedArcheryPenalty(oPlayer));
DelayCommand(1.2,HORSE_SupportOriginalSpeed(oPlayer));
if (!GetLocalInt(GetModule(),"X3_HORSE_NO_CORPSES"))
{
sR=GetSkinString(oPlayer,"sX3_HorseResRef");
sT=GetSkinString(oPlayer,"sX3_HorseMountTag");
nCH=GetSkinInt(oPlayer,"nX3_HorseAppearance");
nST=GetSkinInt(oPlayer,"nX3_HorseTail");
nC=GetLocalInt(oPlayer,"nX3_HorsePortrait");
if (GetStringLength(sR)>0&&GetStringLeft(sR,GetStringLength(HORSE_PALADIN_PREFIX))!=HORSE_PALADIN_PREFIX)
{
oHorse=HorseCreateHorse(sR,GetLocation(oPlayer),oPlayer,sT,nCH,nST);
SetLootable(oHorse,TRUE);
SetPortraitId(oHorse,nC);
SetLocalInt(oHorse,"bDie",TRUE);
AssignCommand(oHorse,SetIsDestroyable(FALSE,TRUE,TRUE));
}
}
oInventory=GetLocalObject(oPlayer,"oX3_Saddlebags");
sID=GetLocalString(oPlayer,"sDB_Inv");
if (GetIsObjectValid(oInventory))
{
if (!GetIsObjectValid(oHorse))
{
HORSE_SupportTransferInventory(oInventory,OBJECT_INVALID,GetLocation(oPlayer),TRUE);
}
else
{
HORSE_SupportTransferInventory(oInventory,oHorse,GetLocation(oHorse),TRUE);
}
}
else if (GetStringLength(sID)>0)
{
nC=GetCampaignInt(sDB,"nCO_"+sID);
while(nC>0)
{
sR=GetCampaignString(sDB,"sR"+sID+IntToString(nC));
sT=GetCampaignString(sDB,"sT"+sID+IntToString(nC));
nST=GetCampaignInt(sDB,"nS"+sID+IntToString(nC));
nCH=GetCampaignInt(sDB,"nC"+sID+IntToString(nC));
DeleteCampaignVariable(sDB,"sR"+sID+IntToString(nC));
DeleteCampaignVariable(sDB,"sT"+sID+IntToString(nC));
DeleteCampaignVariable(sDB,"nS"+sID+IntToString(nC));
DeleteCampaignVariable(sDB,"nC"+sID+IntToString(nC));
if (!GetIsObjectValid(oHorse))
{
oItem=CreateObject(OBJECT_TYPE_ITEM,sR,GetLocation(oPlayer),FALSE,sT);
}
else
{
oItem=CreateItemOnObject(sR,oHorse,nST,sT);
}
if (GetItemStackSize(oItem)!=nST) SetItemStackSize(oItem,nST);
if (nCH>0) SetItemCharges(oItem,nCH);
nC--;
}
DeleteCampaignVariable(sDB,"nCO_"+sID);
if (GetIsObjectValid(oHorse)&&GetLocalInt(oHorse,"bDie")) DelayCommand(3.0,KillTheHorse(oHorse));
}
else if (GetIsObjectValid(oHorse))
{
DelayCommand(2.0,KillTheHorse(oHorse));
}
}
AssignCommand(oPlayer, ClearAllActions());
object aRelic = GetItemPossessedBy(oPlayer, "axfellrelic");
object cRelic = GetItemPossessedBy(oPlayer, "cleavenrelic");
int relicStatus = GetLocalInt(GetModule(),"Relic_Status");
switch(relicStatus)
{
case 1:
if (GetIsObjectValid (aRelic)){
SendMessageToPC (oPlayer, "You have failed, and lost the Axfell Relic");
DestroyObject (aRelic);
SetLocalInt(oMod, "Relic_Status", 0);
SetCustomToken(901, "<c þ >Safe"); // Axfell green is safe
DeleteLocalInt(GetModule(), "MOTHAXFRELIC");
object aPC = GetFirstPC();
while (GetIsObjectValid(aPC))
{
SendMessageToPC(aPC, "<c þ>[Faction] Axfell has recovered their relic!</c>");
aPC = GetNextPC();
}
}
case 2:
if (GetIsObjectValid (cRelic)){
SendMessageToPC (oPlayer, "You have failed, and lost the Cleaven Relic");
DestroyObject (cRelic);
SetLocalInt(oMod, "Relic_Status", 0);
SetCustomToken(900, "<c þ >Safe"); // Cleaven green is safe
DeleteLocalInt(GetModule(), "MOTHCLVRELIC");
object aPC = GetFirstPC();
while (GetIsObjectValid(aPC))
{
SendMessageToPC(aPC, "<c þ>[Faction] Cleaven has recovered their relic!</c>");
aPC = GetNextPC();
}
}
break;
case 5:
if (GetIsObjectValid (aRelic)){
SendMessageToPC (oPlayer, "You have failed, and lost the Axfell Relic");
DestroyObject (aRelic);
SetLocalInt(oMod, "Relic_Status", 3);
SetCustomToken(901, "<c þ >Safe"); // Axfell green is safe
SetCustomToken(900, "<cþ >Stolen"); // Cleaven red is stolen
DeleteLocalInt(GetModule(), "MOTHAXFRELIC");
DeleteLocalInt(GetModule(), "MOTHCLVRELIC");
object aPC = GetFirstPC();
while (GetIsObjectValid(aPC))
{
SendMessageToPC(aPC, "<c þ>[Faction] Axfell has recovered both relics!</c>");
aPC = GetNextPC();
}
}
if (GetIsObjectValid (cRelic)){
SendMessageToPC (oPlayer, "You have failed, and lost the Cleaven Relic");
SetCustomToken(901, "<c þ >Safe"); // Axfell green is safe
SetCustomToken(900, "<cþ >Stolen"); // Cleaven red is stolen
DestroyObject (cRelic);
SetLocalInt(oMod, "Relic_Status", 3);
}
break;
case 6:
if (GetIsObjectValid (aRelic)){
SendMessageToPC (oPlayer, "You have failed, and lost the Axfell Relic");
DestroyObject (aRelic);
SetLocalInt(oMod, "Relic_Status", 4);
SetCustomToken(901, "<cþ >Stolen"); // Axfell green is stolen
SetCustomToken(900, "<c þ >Safe"); // Cleaven red is safe
DeleteLocalInt(GetModule(), "MOTHAXFRELIC");
DeleteLocalInt(GetModule(), "MOTHCLVRELIC");
object aPC = GetFirstPC();
while (GetIsObjectValid(aPC))
{
SendMessageToPC(aPC, "<c þ>[Faction] Cleaven has recovered both relics!</c>");
aPC = GetNextPC();
}
}
if (GetIsObjectValid (cRelic)){
SendMessageToPC (oPlayer, "You have failed, and lost the Cleaven Relic");
DestroyObject (cRelic);
SetLocalInt(oMod, "Relic_Status", 4);
SetCustomToken(901, "<cþ >Stolen"); // Axfell green is stolen
SetCustomToken(900, "<c þ >Safe"); // Cleaven red is safe
}
break;
}
MothGiveHalfOrcItem(oPlayer);
MothSetShifterLevels(oPlayer);
MothSetIsPMCaster(oPlayer);
DelayCommand(0.5, AssignCommand(oPlayer, ActionJumpToLocation(lTarget)));
DelayCommand(0.8, AssignCommand(oPlayer, ActionJumpToLocation(lTarget)));
DelayCommand(1.0, AssignCommand(oPlayer, ActionJumpToLocation(lTarget)));
postEvent();
}
on dying needs the fix also.made the same thing here.,
- Code:
#include "hc_inc"
#include "anph_inc"
#include "zep_inc_phenos2"
#include "anph_db_inc"
#include "anph_xp_inc"
#include "anph_dropstuff"
void CheckPlayerBleed (object oPC);
void AnphPCDying(object oPC);
void main()
{
object oPC = GetLastPlayerDying();
if(!GetIsPossessedFamiliar(oPC)){
DelayCommand(0.1,AnphPCDying(oPC));
}
}
void AnphPCDying(object oPC)
{
object oHostile = GetLastHostileActor(oPC);
AnphDropStuff (oPC);
if (GetIsObjectValid(GetMaster(oHostile)))
{
oHostile = GetMaster(oHostile);
}
if (!GetIsPC (oHostile))
{
int nLevel = GetHitDice (oPC);
int nXPVal = GetLocalInt (oHostile, "MyXPValue");
SetLocalInt (oHostile, "MyXPValue", nXPVal + 50 + nLevel * 10);
}
SetLocalObject(oPC, "LastHostileActor", oHostile);
if ((GetIsPC(oHostile) ||
GetIsPC(GetMaster(oHostile)) ||
!GetIsObjectValid(oHostile) ||
GetName(oHostile) == ""
)
)
{
if (AnphGetPlayerTeam(oPC) != AnphGetPlayerTeam(oHostile))
{
SetLocalInt(oPC, "PvPDeath", 1);
}
else if (AnphGetPlayerTeam(oPC) != AnphGetPlayerTeam(GetMaster(oHostile)))
{
if (GetIsPC(GetMaster(oHostile)))
{
SetLocalInt(oPC, "PvPDeath", 1);
}
}
}
object oFam = GetAssociate (ASSOCIATE_TYPE_FAMILIAR, oPC);
if (GetIsObjectValid (oFam))
{
RemoveSummonedAssociate (oPC, oFam);
}
DelayCommand(12.0, CheckPlayerBleed(oPC));
}
void CheckPlayerBleed (object oPC)
{
zep_Dismount(oPC);
if ( (GetCurrentHitPoints (oPC) <= 0) &&
(GetCurrentHitPoints (oPC) >= -10) )
{
if (d20(2) <= (7 + GetAbilityModifier (ABILITY_CONSTITUTION, oPC)) )
{
int iHitpoints = GetCurrentHitPoints (oPC);
int iHeal = abs (iHitpoints) + 1;
effect eHeal = EffectHeal (iHeal);
SendMessageToPC (oPC, "You have recovered from your wounds.");
ApplyEffectToObject (DURATION_TYPE_INSTANT, eHeal, oPC);
} else if (GetLocalInt(oPC, "DelayBleed") == 1)
{
if (d4() == 1)
SetLocalInt(oPC, "DelayBleed", 0);
} else
{
effect eDamage = EffectDamage(1, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_FIVE);
ApplyEffectToObject (DURATION_TYPE_INSTANT, eDamage, oPC);
SendMessageToPC (oPC, "You slip closer to death..");
int which = d6();
switch (which)
{
case 1:
PlayVoiceChat (VOICE_CHAT_PAIN1, oPC);
break;
case 2:
PlayVoiceChat (VOICE_CHAT_PAIN2, oPC);
break;
case 3:
PlayVoiceChat (VOICE_CHAT_PAIN3, oPC);
break;
case 4:
PlayVoiceChat (VOICE_CHAT_HEALME, oPC);
break;
case 5:
PlayVoiceChat (VOICE_CHAT_NEARDEATH, oPC);
break;
case 6:
PlayVoiceChat (VOICE_CHAT_HELP, oPC);
break;
}
string sName = GetName (oPC);
string sPlayerName = GetPCPlayerName (oPC);
SetLocalInt (oMod, sName + sPlayerName + "RHP",
1);
SetLocalInt (oMod, sName + sPlayerName + "CHP",
GetCurrentHitPoints (oPC));
}
DelayCommand(12.0, CheckPlayerBleed(oPC));
}
}
it looks like you can avoid dying by possessing a familiar just before you die but the hardcode stops that. if pc dies familiar unsummons and pc has no living object to return to so pc dies.this works 100%.no way to avoid it.
the delay is there cuz it can lag and then nwscript looooooooves delays then.
Vladimir- Posts : 110
Join date : 2011-05-17
Re: DBP == death by posession
So, on possession, when your familiar dies, you die?... I can't replicate that.
If you mean, if your PC dies, while you're possessing a familiar -you don't drop a corpse, then I totally get you.
The death script is buggy in a whole lot of circumstances, there'll be a more robust script put in with a few fail-safes when it's done properly, though!
If you mean, if your PC dies, while you're possessing a familiar -you don't drop a corpse, then I totally get you.
The death script is buggy in a whole lot of circumstances, there'll be a more robust script put in with a few fail-safes when it's done properly, though!
Professor Plum- Posts : 783
Join date : 2011-04-09
Re: DBP == death by posession
I've never had that problem with the death script--not in Anphillia, nor in the OCs, which also sport death scripts. Nor can I reproduce it. The on dying script does need fixing, though.
J. Persinne- Posts : 591
Join date : 2011-03-10
Re: DBP == death by posession
this time when vlads fam died he got ported to the loc. even if vlad was half a map away.didnt kill vlad this time.almost killed him indirectly cuz it was a bad place to get ported to.
Vladimir- Posts : 110
Join date : 2011-05-17
Re: DBP == death by posession
There are a few possession bugs and exploits that are hardcoded, so nothing can be done about them.
Professor Plum- Posts : 783
Join date : 2011-04-09
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum