(08-12-2011, 06:28 PM)Tanshaydar Wrote: If you already have a deactivated monster in your map, then:
void OnStart()
{
AddEntityCollideCallback("Player", "AreaEen", "CollideRoomEen", true, 1);
}
void CollideRoomEen(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("hanskamerdeur", true, true);
SetEntityActive("monster_name_here", true);
AddEnemyPatrolNode("monster_name_here", "node_name_here", 0, "");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "hanskamerdeurkey_1", "hanskamerdeur", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("hanskamerdeur", false, true);
PlaySoundAtEntity("", "unlock_door", "hanskamerdeur", 0, false);
RemoveItem("hanskamerdeurkey_1");
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Thanks for helping, But I seem to be a total noob at coding.
I made it like this now :
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "AreaEen", "CollideRoomEen", true, 1);
}
void CollideRoomEen(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("hanskamerdeur", true, true);
SetEntityActive("Hans", true);
AddEnemyPatrolNode("Hans", "PadTwee", 0, "");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "hanskamerdeurkey_1", "hanskamerdeur", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("hanskamerdeur", false, true);
PlaySoundAtEntity("", "unlock_door", "hanskamerdeur", 0, false);
RemoveItem("hanskamerdeurkey_1");
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
But I get this error :
FATAL ERROR: Could not load script file
'custom_stories/DeAvond/maps/Lol.hps'!
main (36,1) : ERR : Unexpected token '--''
Sorry again for not being able to fix it