Aller au contenu

Photo

Something to add please...


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

#1
Who said that I

Who said that I
  • Members
  • 492 messages

Hello hello! 

 

Here I got yet another question I was wondering about!

 

Here I got this script:

 

void main()
{
    object oTarget;
    object oSpawn;
 
    // Get the creature who triggered this event.
    object oPC = GetEnteringObject();
 
    // Only fire for (real) PCs.
    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )
        return;
 
    // Abort if the PC is not exactly at stage 11 of journal quest "p012".
    if ( GetLocalInt(oPC, "NW_JOURNAL_ENTRYp012") != 11 )
        return;
 
    // Spawn "creature014".
    oTarget = GetWaypointByTag("WP_ELVIRAGHOST");
    oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "creature014", GetLocation(oTarget));
}

 

 

So here is my question then!
 
Is it possible to put a check in there that if the npc is already spawned in there won't be another spawned in till its dead or after an ammount of time?
 


#2
kalbaern

kalbaern
  • Members
  • 824 messages

This should work, just fill in the NPC's real tag where noted.
 
 

void main()

{

object oTarget;

object oSpawn;



// Get the creature who triggered this event.

object oPC = GetEnteringObject();



// Only fire for (real) PCs.

if ( !GetIsPC(oPC) || GetIsDMPossessed(oPC) )

return;



// Abort if the PC is not exactly at stage 11 of journal quest "p012".

if ( GetLocalInt(oPC, "NW_JOURNAL_ENTRYp012") != 11 )

return;



// Spawn "creature014".
if (GetNearestObjectByTag("replace_with_NPC's_tag")!= OBJECT_INVALID)
{
oTarget = GetWaypointByTag("WP_ELVIRAGHOST");
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "creature014", GetLocation(oTarget));
}
return;
}



#3
bdtgazo

bdtgazo
  • Members
  • 53 messages

Isn't that checking to see if the npc IS there?  Meaning it will only spawn the npc if another npc with the same tag is already there?



#4
kalbaern

kalbaern
  • Members
  • 824 messages

Yeah, sorry. "if (GetNearestObjectByTag("replace_with_NPC's_tag")!= OBJECT_INVALID)" should instead be "if (GetNearestObjectByTag("replace_with_NPC's_tag")== OBJECT_INVALID)". I'd sent the correction to the OP over a Skype chat and din't think to post back here. :)