Spawn monsters according to a variable

I would like to create a spawn system according to a variable.
My idea:

  • A player must complete a quest (variable = 100)
  • Monsters spawn by stepping on the triggers
  • Player complete the quest (variable = 200)
  • Monsters don’t spawn anymore despite that player (only him and his party) steps on those triggers

How can I do it?

Have a look at the large submission download on the Unearthed Gold project page. It should show you how to go about certain aspects of what you want to do. You might also find useful information in the main download on that page.

TR

I wasn’t able to find a solution there :frowning:

I’m not sure I’ve understood correctly, but maybe something like this? (Untested)

void main()
{

//When the PC steps inside a trigger and has a quest called "quest" at a variable of 100, a monster is spawned and the PC completes the quest with the variable of 200. The monster only spawns once.

object oPC = GetEnteringObject();

int nInt=GetLocalInt(oPC, "NW_JOURNAL_ENTRYquest");

if(!GetIsPC(oPC)) return;

	if(!GetLocalInt(OBJECT_SELF,"Done") && GetLocalInt(oPC,"NW_JOURNAL_ENTRYquest") == 100)
	{
	
	object oTarget = GetWaypointByTag("monster_wp");
	location lTarget = GetLocation(oTarget);
	object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "monster", lTarget);
	
	SetLocalInt(OBJECT_SELF,"Done",1);
	AddJournalQuestEntry("questname",200,oPC);
	
	}


}
1 Like

Thanks! :slight_smile: