The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SCRIPT] Help With .hps File
NaughtySly Offline
Junior Member

Posts: 1
Threads: 1
Joined: Mar 2012
Reputation: 0
#1
[SCRIPT] Help With .hps File

Ok so I'm quite new to the whole scripting and Amnesia Custom Map Making but I've been doing good up untill this point which is where I got this problem and everywhere I go there is no awnser or help to this so my problem is..
In my .hps say if I had a KEY to open ADOOR and AGRUNT would spawn. like this


void OnStart()
{
AddUseItemCallback("", "KEY", "ADOOR", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("KEY", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("ADOOR", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "ADOOR", 0, false);
RemoveItem("KEY");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("AGRUNT", true);
ShowEnemyPlayerPosition("AGRUNT");
}

Now in the same map I want to have a diffrent key open a diffrent door but how would I put that because I just right it like this.. Then I get a error saying something like "ERR Incorrect"{" or something like that so just look


{
AddUseItemCallback("", "KEY", "ADOOR", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("KEY", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("ADOOR", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "ADOOR", 0, false);
RemoveItem("KEY");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("AGRUNT", true);
ShowEnemyPlayerPosition("AGRUNT");
}


{<-This little guy right here is what causes the error?? now please tell me why? and how to correctly right this
AddUseItemCallback("", "KEY1", "ADOOR1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("KEY1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("ADOOR1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "ADOOR1", 0, false);
RemoveItem("KEY1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("AGRUNT1", true);
ShowEnemyPlayerPosition("AGRUNT1");
}

just so I dont confuse you to much here is my full script.


void OnStart()
{
AddUseItemCallback("", "bedroomkey", "bedroomdoor", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("bedroomkey", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("bedroomdoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "bedroomdoor", 0, false);
RemoveItem("bedroomkey");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("monster_grunt", true);
ShowEnemyPlayerPosition("monster_grunt");
}
Every thing here works fine but instead of having another Door opened by another Key I have a monster activated by PLAYER walking into an Area and it works but! not if I have it set up like this.. It keeps saying the same error about how "{" that is placed incorrectly or something so pretty much my question is "How do I start a new FUNCTION like a Whole new Script set up like 2 diffrent things happening like here? With out any problems"
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 1, "");
}

void OnEnter()
{
SetLocalVarInt("Var1", 0);
SetEntityPlayerInteractCallback("hallbutton_1", "func1", true);
SetEntityPlayerInteractCallback("hallbutton_2", "func2", true);
SetEntityPlayerInteractCallback("hallbutton_3", "func3", true);
SetEntityPlayerInteractCallback("hallbutton_4", "func4", true);
}

void func1(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func2(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func3(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func4(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func5()
{
if(GetLocalVarInt("Var1") == 4)
{

SetSwingDoorLocked("halldoor", false, false);
PlaySoundAtEntity("", "unlock_door.snt", "halldoor", 0.5f, false);
}
}

If You can please help me out with this! I would Forever thank you! sorry for such a long Thread but I really Need Help...
03-08-2012, 04:57 AM
Find


Messages In This Thread
[SCRIPT] Help With .hps File - by NaughtySly - 03-08-2012, 04:57 AM
RE: [SCRIPT] Help With .hps File - by Stepper321 - 03-08-2012, 12:00 PM



Users browsing this thread: 3 Guest(s)