Aller au contenu

Photo

Make a spell prevent target from dropping items on death


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
RadishAnarcane

RadishAnarcane
  • Members
  • 5 messages
I'm working on making dismissal/banishment appear to act more like their original PnP versions, instead of just as outsider-only death spells. Though the outsider is still technically killed, this is disguised as much as possible by using a no-feedback death effect and timely invisibility.

The issue that remains (other than the creature's death scream, which is unresolvable >:|) is loot – obviously, a creature ejected to some other plane shouldn't leave any loot behind. For this I've resorted to just looping through the target's items (after checking that it's not a party member) and destroying everything without a plot flag, but I don't like it; mostly due to unsureness on my part that I've adequately checked for party-member-ness, but also because I'm not sure if this will run before or after random treasure is generated, and because it's, well... rather destructive.

Here's the relevant excerpt from my script in progress:

/*
int nSoundSet = GetSoundSet(oTarget);  // WTF FUNCTION DOESN'T EXIST                                                                                 
SetSoundSet(oTarget, 448);  // set sound set to (none) so there's no death scream  ++ No way to set it back if death effect doesn't work >:|
*/

ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(FALSE, FALSE, TRUE), oTarget); // no feedback, ignore immunity

if (GetIsDead(oTarget, TRUE)) // death effect worked
{
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectNWN2SpecialEffectFile("total_invisibility"), oTarget, 6.0); // makes oTarget *completely* invisible
    
    if (!(GetIsOwnedByPlayer(oTarget) || GetIsRosterMember(oTarget) || GetCommandable(oTarget))) // if not a party member
    {   // Destroy non-plot items on oTarget, since the banished creature's inventory would have been banished with it
        object oItem = GetFirstItemInInventory(oTarget);
        while (GetIsObjectValid(oItem))
        {
            if (!GetPlotFlag(oItem))  // don't destroy if plot item
                DestroyObject(oItem);
            GetNextItemInInventory(oTarget);
        }
    }
    
    AssignCommand(oTarget, SetIsDestroyable(TRUE, FALSE, FALSE)); // don't leave a corpse
}
/*else // give up
{
    SetSoundSet(oTarget, nSoundSet);
}*/

If anyone can think of a better way, or address my concerns regarding party members and random treasure, it would be muchly appreciated.

#2
kevL

kevL
  • Members
  • 4 078 messages
just some thoughts:

random treasure should get created onSpawn, so np. You could CopyItem/Object( ) to a secret chest perhaps; that way it would at least still be in the game-world (including Plot). don't forget there's also ScriptHidden( ) ...


yer right, i couldn't find GetSoundSet either. oh, GetIsPC( ) is another good one to throw into the check! I think GetIsPC covers GetIsDM .. ;)

#3
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Try this to check if a oTarget is in the player's party:

if (GetIsOwnedByPlayer(GetFactionLeader(oTarget))



This checks the faction leader of the spell's target and then if the faction leader is owned by player, Any creature in the PC's party will have the PC as the faction leader and the PC is always an owned by player..

#4
The Fred

The Fred
  • Members
  • 2 516 messages
You could just destroy the creature - that would probably be more appropriate. However, you do have an issue with plot creatures and plot items.

#5
kevL

kevL
  • Members
  • 4 078 messages
something else to consider:

if a Banishable creature has Improved Disarm, it might grab a PC's weapon and stick it in its inventory


that could lead to some face-keyboard action!

#6
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 603 messages
Another recent thread about checking to see if someone is in the party.

#7
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

The Fred wrote...

You could just destroy the creature - that would probably be more appropriate. However, you do have an issue with plot creatures and plot items.



Ooooh! Good solution.  That would solve the death scream problem too.  If plot flags are a potential problem, you could just add the

SetPlotFlag(oTarget,FALSE)

Line in there to take care of that. 

You would have to check for plot items though.  Good thought.