Aller au contenu

Photo

Making a PC completely invisible or ignored for a few seconds?


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

#1
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
What I'd like to happen is to make it so that when a player gets killed by a mob of creatures and the player respawns where they are, they get 20 seconds to get away from the mob before the creatures start to attack again.
Is there an effect I can use to make this happen?

I tried using EffectSanctuary, but the creatures can still see the player sometimes. I get the same problem with the various types of invisibility. I've also tried using EffectCustsceneGhost but it doesn't seem to even get applied to the player when he respawns. I've also tried ScriptHidden but it is kinda weird. It makes the monsters hidden as well and the player can sort of move but the screen doesn't move. It makes it hard to figure out what is going on.

I would prefer to not mess around with looping through the nearby creatures and making them temporarily friendly etc. And I'd prefer a non hak method first if there is one.

This is the script I've been working on (gui_respawn):


#include "nw_i0_plot"
//Apply XP and/or GOLD penalty for respawning.
void ApplyPenalty(object oDead)
{
    int iXP = GetXP(oDead);
    int iPenalty = 25 * GetHitDice(oDead);
    int iHD = GetHitDice(oDead);
    // * You can not lose a level with this respawning
    int iMin = ((iHD * (iHD - 1)) / 2) * 1000;
    int iNewXP = iXP - iPenalty;
    if (iNewXP < iMin) iNewXP = iMin;
    int iGoldToTake = FloatToInt(0.10 * GetGold(oDead));
    // * a cap of 10 000gp taken from you
    if (iGoldToTake > 10000) iGoldToTake = 10000;
    
    SetXP(oDead, iNewXP);
    //AssignCommand(oDead, TakeGoldFromCreature(iGoldToTake, oDead, TRUE));
}

void main()
{
    object oRespawner = OBJECT_SELF;
    effect eGhost = SupernaturalEffect(EffectCutsceneGhost());
    effect eInvis = EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(),oRespawner);    
    //RemoveEffects(oRespawner);
    ApplyPenalty(oRespawner);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eGhost, oRespawner, 20.0);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eInvis, oRespawner, 20.0);
    //ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectSanctuary(255), oRespawner, 20.0);
    
}


Any advice very much appreciated. Thank you.

#2
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
Perhaps you could have the death/respawn script set a global variable and then fire off a delayed command to reset the variable, and then modify the standard perception script used by NPCs to ignore any PCs when that global is set.

Regards

#3
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
use ethereal for it, that way when they attack it gets removed. Ghost does not do what you want, and sanctuary gives them a save. )

( use the spell script to see how it's set up )

#4
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
You can be totally invisible by ScriptHidden as well.

#5
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I have noticed that sometimes with invisibility it takes a round or so for the AI to catch up with the fact that the PC is invisible, but they catch up eventually. Maybe you could set the PC's plot flag to "TRUE" for a few seconds to make them invulnerable while they are escaping the mob.

#6
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Ah ha. Pain's suggestion is exactly what I needed. Just using the Ethereal effect does the same thing as Sanctuary but the observers don't get a saving throw.

Thanks Pain.

#7
Shallina

Shallina
  • Members
  • 1 011 messages
script hidden is made for that.

#8
Morbane

Morbane
  • Members
  • 1 883 messages

Shallina wrote...

script hidden is made for that.


GhostOfGod Wrote...I've also tried ScriptHidden but it is kinda weird. It makes the monsters hidden as well and the player can sort of move but the screen doesn't move. It makes it hard to figure out what is going on.

GOG already tried script hidden

#9
The Fred

The Fred
  • Members
  • 2 516 messages
I think ScriptHidden is slightly different. I haven't really used it myself, though.

CutsceneGhost only lets you walk through walls.

You can make someone appear invisible with the CUTSCENE_INVISIBILITY visual effect, but they aren't ignore.

#10
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
EffectCutsceneGhost:

// Creates a cutscene ghost effect, this will allow creatures
// to pathfind through other creatures without bumping into them
// for the duration of the effect.
effect EffectCutsceneGhost();

The reason I tried using the above function was just kinda based off the description. That you could walk through creatures. Figured it'd be worth a shot.

I would actually still like to apply this effect as well though. This way if the player who died is completely surrounded by bad guys he can make his way out of the mob much easier. But as I posted earlier, for some reason this effect wouldn't get applied to the player in my script when they respawned. Or at least in my test, as soon as i respawned, before the bad guy would attack again, I would attempt to run through him. Didn't work.

Is there some particular way it is supposed to be used? Is it broken?

Modifié par GhostOfGod, 06 juin 2011 - 05:50 .


#11
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Bumpy?

#12
MasterChanger

MasterChanger
  • Members
  • 686 messages
If the problem is still with CutsceneGhost, split out that problem for testing: spawn a PC surrounded by friendly/neutral NPCs, apply the effect, and see if you can walk through them. It's going to be harder to test while you're around with hostile creatures.

Once you determine if that works or doesn't, you can proceed accordingly. At this point, you could be dealing with multiple variables: the Effect itself, AI responding to being attacked, etc.

#13
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Ok. I put this script into an objects OnUsed event:

void main()
{
    object oPC = GetLastUsedBy();
    effect eGhost = EffectCutsceneGhost();
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eGhost, oPC, 20.0);
    SendMessageToPC(oPC, "Cutscene ghost test.");
}

When the object is used the PC get's the message. I then try to walk through friendly NPCs and they get bumbed around all over the place. There is also no icon up in the corner to indicate that there is an effect on the player.

#14
Morbane

Morbane
  • Members
  • 1 883 messages
I checked the lexicon 1.69 and your syntax is good - have you tried to make it permanent? just to get results? I thought you were going to try for ethereal - didnt that work either?

Modifié par Morbane, 06 juin 2011 - 08:01 .


#15
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Hello there Morbane. The Ethereal effect is working just fine. I was going to add the CutsceneGhost effect for 20 seconds also, to make it easier for the player to "get the heck out of dodge". And yes I did also try permanent and instant. Still no go.

I'm thinking broken at this point? I could probably just set the bump state for the player and then do a delay to set it back? I just figured adding the Cutscene Ghost effect as a duration would be a little simpler and I've never used the SetBumpState function. I'm guessing it would work the same as that effect? The only problem though with me using the BumpState is that I believe players can then walk through locked doors?

Modifié par GhostOfGod, 06 juin 2011 - 04:05 .


#16
SkywingvL

SkywingvL
  • Members
  • 351 messages
Script hidden disables all perception as you note. It's usually not intended for use with players in most circumstances.