Aller au contenu

Photo

Zombies? Zombies!


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

#1
Snarkblat

Snarkblat
  • Members
  • 52 messages
I want to create a script where the PC encounters zombie corpses, unselectable, on the ground. But when they get within a certain distance, the zombie stands up, becomes selectable, and starts coming at them.  I think what I need to do is first place the zombie down from the palette, make them destroyable(FALSE) and kill them, then apply a resurrect script when the PC approaches... but it's not working for me. :?

Does anyone have experience doing something similar?

#2
Snarkblat

Snarkblat
  • Members
  • 52 messages
Okay, here's the spawn script, this one I use to create unselectable corpses:

//Spawn in Dead
void main()
{

SetIsDestroyable(FALSE, FALSE, FALSE);
SetLootable(OBJECT_SELF, FALSE);

ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectDeath(), OBJECT_SELF);

}






And here's the heartbeat script, the one that's not working:

//ZombieHeartbeat
#include "nw_i0_generic"
void main()
{
object oCreature = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
if (GetIsObjectValid(oCreature) == TRUE && GetDistanceToObject(oCreature) < 10.0)
{
object oTarget;
oTarget = OBJECT_SELF;

ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectResurrection(), OBJECT_SELF);

ActionAttack(oCreature);

DetermineCombatRound(oCreature);

}
}

Modifié par Snarkblat, 28 juillet 2011 - 03:59 .


#3
CID-78

CID-78
  • Members
  • 1 124 messages
Do heartbeat work on dead creatures? I am not sure they do and the two last lines should use OBJECT_SELF (the zombie) not oCreature (the player) right.

#4
Snarkblat

Snarkblat
  • Members
  • 52 messages
Hmm perhaps you're right. In that case I would need to call the script from a trigger instead.

#5
henesua

henesua
  • Members
  • 3 883 messages
This sort of thing has been done before, but as a placeable that spawns a zombie and destroys itself when a player is within a certain distance.

Does that not work for you?

#6
Snarkblat

Snarkblat
  • Members
  • 52 messages
I want to use a custom creature blueprint, not a placeable.

This is my OnEnter script for my trigger, but it's not working. My poor zombies just lie there... dead... never knowing the sweet taste of adventurer flesh.

//OnEnter, raises all the zombies in area
void main()
{

object oPC = GetEnteringObject();

if (!GetIsPC(oPC)) return;
int DoOnce = GetLocalInt(oPC, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE);

object oTarget;
oTarget = GetNearestObjectByTag("MINER_DEAD");



ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectHeal(100), oTarget, 0.0);

ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectResurrection(), oTarget, 0.0);

int nNth = 0;
nNth++;
oTarget = GetObjectByTag("MINER_DEAD", nNth);
}

#7
Xardex

Xardex
  • Members
  • 217 messages
Creatures can't be unselectable, dead or not. Maybe they can be with some custom content, but still you would at the very least have the name when you press TAB.

#8
CID-78

CID-78
  • Members
  • 1 124 messages
you should lookup how you write loops because you are missing one, that script won't work.

#9
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
First thing that needs to be fixed in the first script is in the line:

SetIsDestroyable(FALSE, FALSE, FALSE);

The second parameter is whether or not the creature is raisable. If you have it set to false then you won't be able to raise them anyway. So it should be:

SetIsDestroyable(FALSE, TRUE, FALSE);

Then you trigger script, with a loop like CID-78 has stated, should be like so:


void main()
{
    object oPC = GetEnteringObject();
    if (!GetIsPC(oPC)) return;
    int DoOnce = GetLocalInt(oPC, GetTag(OBJECT_SELF));
    if (DoOnce==TRUE) return;
    SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE);
    int iNth = 1;
    object oDead = GetNearestObjectByTag("MINER_DEAD", oPC, iNth);
    while (GetIsObjectValid(oDead))
    {
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectResurrection(), oDead, 0.0);
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectHeal(100), oDead, 0.0);
        SetIsDestroyable(TRUE, TRUE, TRUE);
        SetLootable(OBJECT_SELF, TRUE);
        iNth++;
        oDead = GetNearestObjectByTag("MINER_DEAD", oPC, iNth);
    }
}


Hope it helps. Good luck.

#10
Snarkblat

Snarkblat
  • Members
  • 52 messages
I can always count on you, Ghost. :)

The script worked like a thing of beauty. There was a slight delay where the zombies just stood there looking confused, so I added an attack command to make it seem more like they woke up hungry. Thanks for setting me straight.