I just started working on the scripting portion of my new (and first) CS after looking at some wiki tutorials, and I cant seem to start up my game ever since I started scripting. The screen goes black and no error message pops up, so I have no idea what is wrong. Here is my code.
void OnStart()
{
SetEntityConnectionStateChangeCallback("lever", "func_shelf");
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "key_1", "lockeddoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "unlockeddoor_1", 0.0f, false);
RemoveItem("key_1");
AddDebugMessage("KeyOnDoor", false);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0.001, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0.001, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0.001, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.001, "");
SetEntityActive("servant_grunt_1", true);
}
void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("secret_door",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}
void OnEnter()
{
}
void OnLeave()
{
}
Does anyone see whats wrong with this? Thanks in advance!