37 lines
1.2 KiB
Plaintext
37 lines
1.2 KiB
Plaintext
|
void main()
|
||
|
{
|
||
|
// Declare major variables
|
||
|
object oPlaceable = OBJECT_SELF;
|
||
|
|
||
|
// Check if the Dung Monster has already been spawned in the module
|
||
|
int DungMonsterSpawned = GetLocalInt(GetModule(), "DungMonsterSpawned");
|
||
|
|
||
|
// If it's not already spawned, spawn the Dung Monster
|
||
|
if (DungMonsterSpawned == 0)
|
||
|
{
|
||
|
// Spawn the Dung Monster
|
||
|
object oCreature = CreateObject(OBJECT_TYPE_CREATURE, "ra_dungmonster01", GetLocation(oPlaceable));
|
||
|
|
||
|
// Get the nearest player to the placeable
|
||
|
object oNearestPlayer = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oPlaceable);
|
||
|
|
||
|
// If we found a player, make the creature attack them
|
||
|
if (GetIsObjectValid(oCreature) && GetIsObjectValid(oNearestPlayer))
|
||
|
{
|
||
|
AssignCommand(oCreature, ActionAttack(oNearestPlayer));
|
||
|
}
|
||
|
|
||
|
// Set the Dung Monster as spawned in the module
|
||
|
SetLocalInt(GetModule(), "DungMonsterSpawned", 1);
|
||
|
}
|
||
|
|
||
|
// Clear the plot flag on the commode
|
||
|
SetPlotFlag(oPlaceable, FALSE);
|
||
|
|
||
|
// Destroy the commode
|
||
|
DestroyObject(oPlaceable, 0.0f);
|
||
|
|
||
|
// Spawn the latrine hole
|
||
|
object oHole = CreateObject(OBJECT_TYPE_PLACEABLE, "ra_plc_dm_hole", GetLocation(oPlaceable));
|
||
|
}
|