Aller au contenu

Photo

Set variable and journal when all monsters cleared


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

#1
simomate

simomate
  • Members
  • 83 messages
How do you achieve a variable "den_evil" being set to 10 and the journal entry for it being activated, once all of the monsters in the cave as been cleared.

#2
Fester Pot

Fester Pot
  • Members
  • 1 394 messages
There are a few ways, such as putting a counter on the creature's OnDeath script or check the area's heartbeat for creatures that still exist.

Area Heartbeat script

void main()
{
object oCreature = GetObjectByTag("TAG_OF_CREATURE");

if(!GetIsObjectValid(oCreature))
{
AddJournalQuestEntry("TAG_OF_JOURNAL_HERE", ##, GetFirstPC(), TRUE, FALSE, TRUE);
SetLocalInt(GetModule(), "den_evil", 10);
}
}


Creature's OnDeath script

void main()
{
int nNth = GetLocalInt(GetModule(), "den_evil");

nNth++;
SetLocalInt(GetModule(), "den_evil", nNth);

if (GetLocalInt(GetModule(), "den_evil") == 10)
{
AddJournalQuestEntry("TAG_OF_JOURNAL_HERE", ##, GetFirstPC(), TRUE, FALSE, TRUE);
}
}


FP!

Modifié par Fester Pot, 01 octobre 2010 - 04:17 .


#3
simomate

simomate
  • Members
  • 83 messages
I did the area on heartbeat, and set all of the monsters in the den to the same tag. But when I cleared it out, the jounarl entry kept "updating" every second.



I wanted to set the variable so I could confirm to the NPC that it was done



(Text appears when)



However, apparntly this scripting didn't work :s

#4
Fester Pot

Fester Pot
  • Members
  • 1 394 messages
For the heartbeat script,

add

if (GetLocalInt(GetModule(), "den_evil") == 10) return;


above

AddJournalQuestEntry("TAG_OF_JOURNAL_HERE", ##, GetFirstPC(), TRUE, FALSE, TRUE);


FP!

Modifié par Fester Pot, 24 octobre 2010 - 03:13 .


#5
simomate

simomate
  • Members
  • 83 messages
The edit fixed the journal problem. But when I speak to the PC (after clearing out the cave) I still don't get the "It's Done" text that only appears when the variable is set to 10

------------------------

This is on the heartbeat



void main()

{

object oCreature = GetObjectByTag("evilden");



if(!GetIsObjectValid(oCreature))





{

if (GetLocalInt(GetModule(), "den_evil") == 10) return;

AddJournalQuestEntry("den_evil", 2, GetFirstPC(), TRUE, FALSE, TRUE);

SetLocalInt(GetModule(), "den_evil", 10);

}

}



this is for "Text Appears When"



int StartingConditional()

{



// Inspect local variables

if(!(GetLocalInt(GetPCSpeaker(), "den_evil") == 10))

return FALSE;



return TRUE;

}

-------------------------------------------

I did suspect I might need to change if(!(GetLocalInt(GetPCSpeaker(), "den_evil") == 10))



to

if (GetLocalInt(GetModule(), "den_evil") == 10)



but that only resulted in the text appearing BEFORE the cave is cleared.




#6
Fester Pot

Fester Pot
  • Members
  • 1 394 messages
Your conditional script must be -

int StartingConditional()
{

// Inspect local variables
if(!(GetLocalInt(GetModule(), "den_evil") == 10))
return FALSE;

return TRUE;
}


You must also have it placed in the proper order within the conversation itself for it to appear correctly.

Here's an example of the conversation tree -

1. Cleared monsters (den_evil == 10)
2. Asked to clear monsters
3. Met NPC before
4. First time meeting NPC


Also, after killing all the creatures, use the in-game debug commands to verify the value of den_evil and that it is set to 10 before speaking with the NPC.

FP!

Modifié par Fester Pot, 25 octobre 2010 - 12:58 .