Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spawn monsters
tokugawa1 Offline
Junior Member

Posts: 37
Threads: 8
Joined: Aug 2012
Reputation: 0
#1
Spawn monsters

Well i want to spawn these monsters but not at the same time. they spawn at the same time with this script and also the game crashes so here it is

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, "");
}
{
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, "");
}
{
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);
}
08-04-2012, 08:26 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#2
RE: Spawn monsters

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. Wink
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 Big Grin

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
(This post was last modified: 08-04-2012, 08:41 PM by Steve.)
08-04-2012, 08:30 PM
Find
tokugawa1 Offline
Junior Member

Posts: 37
Threads: 8
Joined: Aug 2012
Reputation: 0
#3
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. Wink
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 Big Grin
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);
08-04-2012, 08:47 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#4
RE: Spawn monsters

oh like that than just do this. Big Grin
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_two", true);
SetEntityPlayerInteractCallback("note_generic_3", "Spawn_Monster_three", 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, "");
}
void Spawn_Monster_two(string &in asEntity)
{
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, "");
}

void Spawn_Monster_three(string &in asEntity)
{
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);
}
this should do the job

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
08-04-2012, 09:06 PM
Find
tokugawa1 Offline
Junior Member

Posts: 37
Threads: 8
Joined: Aug 2012
Reputation: 0
#5
RE: Spawn monsters

(08-04-2012, 09:06 PM)Steve Wrote: oh like that than just do this. Big Grin
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_two", true);
SetEntityPlayerInteractCallback("note_generic_3", "Spawn_Monster_three", 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, "");
}
void Spawn_Monster_two(string &in asEntity)
{
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, "");
}

void Spawn_Monster_three(string &in asEntity)
{
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);
}
this should do the job
weird. the first monster didn't spawn because the first key which had no name. randomly got the name of a key from the previous map and i also couldnt unlock the door
08-04-2012, 09:22 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#6
RE: Spawn monsters

as first check the names and make sure they are the same as in the level editor and as second you have both keys unlock the same doors so when you open one door You open both doors to fix that make it like this:

void OnStart()
{
AddUseItemCallback("", "key_tomb_1", "mansion_1", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("key_tomb_1", "Spawn_Monster", true);
AddUseItemCallback("", "key_torture_chamber_1", "mansion_4", "KeyOnDoor", true);
SetEntityPlayerInteractCallback("key_torture_chamber_1", "Spawn_Monster_two", true);
SetEntityPlayerInteractCallback("note_generic_3", "Spawn_Monster_three", true);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlayGuiSound("unlock_door", 0.8f);
RemoveItem("key_tomb_1");
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_4", false, true);
PlayGuiSound("unlock_door", 0.8f);
RemoveItem("key_torture_chamber_1");
}

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
(This post was last modified: 08-04-2012, 09:35 PM by Steve.)
08-04-2012, 09:34 PM
Find
tokugawa1 Offline
Junior Member

Posts: 37
Threads: 8
Joined: Aug 2012
Reputation: 0
#7
RE: Spawn monsters

(08-04-2012, 09:06 PM)Steve Wrote: oh like that than just do this. Big Grin
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_two", true);
SetEntityPlayerInteractCallback("note_generic_3", "Spawn_Monster_three", 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, "");
}
void Spawn_Monster_two(string &in asEntity)
{
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, "");
}

void Spawn_Monster_three(string &in asEntity)
{
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);
}
this should do the job
weird. the first monster didn't spawn because the first key which had no name. randomly got the name of a key from the previous map and i also couldnt unlock the door

(08-04-2012, 09:34 PM)Steve Wrote: as first check the names and make sure they are the same as in the level editor and as second you have both keys unlock the same doors so when you open one door You open both doors to fix that make it like this:

void OnStart()
{
AddUseItemCallback("", "key_tomb_1", "mansion_1", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("key_tomb_1", "Spawn_Monster", true);
AddUseItemCallback("", "key_torture_chamber_1", "mansion_4", "KeyOnDoor", true);
SetEntityPlayerInteractCallback("key_torture_chamber_1", "Spawn_Monster_two", true);
SetEntityPlayerInteractCallback("note_generic_3", "Spawn_Monster_three", true);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlayGuiSound("unlock_door", 0.8f);
RemoveItem("key_tomb_1");
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_4", false, true);
PlayGuiSound("unlock_door", 0.8f);
RemoveItem("key_torture_chamber_1");
}
well before i got that script you gave me, the keys worked. its not your fault something weird happened.
if i get to fix this error i can release my map.. well and the key still says "picked up prison key". the prison key was on the previous map and not on this one. P.S this script is for the second map (after teleporting through a Level Door) maybe that helps
(This post was last modified: 08-04-2012, 10:08 PM by tokugawa1.)
08-04-2012, 09:50 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#8
RE: Spawn monsters

I'm a little tired at the moment but try changing the name of the key.

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
08-05-2012, 05:00 PM
Find
tokugawa1 Offline
Junior Member

Posts: 37
Threads: 8
Joined: Aug 2012
Reputation: 0
#9
RE: Spawn monsters

(08-05-2012, 05:00 PM)Steve Wrote: I'm a little tired at the moment but try changing the name of the key.
Thanks that worked. Smile
08-05-2012, 07:45 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#10
RE: Spawn monsters

that's good to hear Big Grin

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
08-05-2012, 07:46 PM
Find




Users browsing this thread: 1 Guest(s)