Files
dsrc/sku.0/sys.server/compiled/game/script/quest/util/theater_spawner.script
T

74 lines
2.4 KiB
Plaintext

/**********************************************************************
*
* Title: quest_creature
* Description: Script that attaches to any creature spawned via the quest
* spawner
**********************************************************************/
/***** INCLUDES ********************************************************/
include library.quests;
/***** CONSTANTS *******************************************************/
const string VAR_SPAWNER_CURRENT_POPULATION = "quest_spawner.current_pop";
const string VAR_SPAWNED_BY = "quest_spawner.spawned_by";
/***** TRIGGERS ********************************************************/
trigger OnInitialize()
{
string spawner = getStringObjVar(self, "quest_spawner.type");
if (spawner == null || spawner.length() < 1)
{
LOG("quest", "theater_spawner.OnInitialize -- spawner is null or empty");
return SCRIPT_CONTINUE;
}
string datatable = getStringObjVar(self, "quest_spawner.datatable");
if (datatable == null || datatable.length() < 1)
{
LOG("quest", "theater_spawner.OnInitialize -- datatable is null or empty");
return SCRIPT_CONTINUE;
}
int index = dataTableSearchColumnForString(spawner, "type", datatable);
if (index == -1)
{
LOG("quest", "theater_spawner.OnInitialize -- can't find spawner " + spawner + " within datatable " + datatable);
return SCRIPT_CONTINUE;
}
dictionary row = dataTableGetRow(datatable, index);
if (row == null)
{
LOG("quest", "theater_spawner.OnInitialize -- can't find data in row " + index + " for datatable " + datatable);
return SCRIPT_CONTINUE;
}
int pulse = row.getInt("pulse");
int max_spawn = row.getInt("max_spawn");
int max_population = row.getInt("max_population");
int expire = row.getInt("expire");
setObjVar(self, "quest_spawner.pulse", pulse);
setObjVar(self, "quest_spawner.max_spawn", max_spawn);
setObjVar(self, "quest_spawner.max_pop", max_population);
if (expire > 1)
setObjVar(self, "quest_spawner.time_expired" , expire + getGameTime());
else
setObjVar(self, "quest_spawner.time_expired", 0);
detachScript(self, "quest.util.theater_spawner");
attachScript(self, "quest.util.quest_spawner");
messageTo(self, "msgQuestSpawnerPulse", null, 5.0f, false);
return SCRIPT_CONTINUE;
}
/***** MESSAGEHANDLERS *************************************************/
/***** COMMANDHANDLERS *************************************************/
/***** FUNCTIONS *******************************************************/