tokugawa1
Junior Member
Posts: 37
Threads: 8
Joined: Aug 2012
Reputation:
0
|
RE: Spawn monsters
(08-04-2012, 08:30 PM)Steve Wrote: easy one you just need some timers I don't really know how many seconds you want to have between the monster so I just make it 5 seconds.
void OnStart()
{
AddUseItemCallback("", "key_tomb_1", "mansion_1", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("key_tomb_1", "Spawn_Monster", true);
AddUseItemCallback("", "key_torture_chamber_1", "mansion_4", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("key_torture_chamber_1", "Spawn_Monster", true);
SetEntityPlayerInteractCallback("note_generic_3", "Spawn_Monster", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlayGuiSound("unlock_door", 0.8f);
RemoveItem("key_tomb_1");
SetSwingDoorLocked("mansion_4", false, true);
PlayGuiSound("unlock_door", 0.8f);
RemoveItem("key_torture_chamber_1");
}
void Spawn_Monster(string &in asEntity)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddTimer("timer01", 5.0f, "Secondmonster");
}
void Secondmonster(string& asTimer)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 1, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddTimer("timer02", 5.0f, "Thirdmonster");
}
void Thirdmonster(string& asTimer)
{
SetEntityActive("servant_brute_2", true);
SetEntityActive("servant_brute_3", true);
SetEntityActive("servant_brute_4", true);
SetEntityActive("servant_grunt_2", true);
SetEntityActive("servant_grunt_3", true);
}
EDIT:
and it crashed because you had more { } than one in your void.
aand also if you want:
SetEntityActive("servant_brute_2", true);
SetEntityActive("servant_brute_3", true);
SetEntityActive("servant_brute_4", true);
SetEntityActive("servant_grunt_2", true);
SetEntityActive("servant_grunt_3", true);
to have time between them make timers for them as well if you have any question ask me ok thx but i actually wanted to spawn the monsters when picking up something. when i pick up the first key the servant grunt_1 spawns, when i pick up the second key the servant_brute_1 spawns, and when i pick up the note_generic_3 the last monsters spawn :
SetEntityActive("servant_brute_2", true);
SetEntityActive("servant_brute_3", true);
SetEntityActive("servant_brute_4", true);
SetEntityActive("servant_grunt_2", true);
SetEntityActive("servant_grunt_3", true);
|
|