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
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#2
RE: [SCRIPT] Help With .hps File

Quote: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");
}

If you compare the two scripts you wrote here, you are opening functions with your brackets. However, you aren't opening anything at all with your code at the bottom.

Creator of The Dark Treasure.
03-08-2012, 09:59 AM
Website Find
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
#3
RE: [SCRIPT] Help With .hps File

Wheres the void name(syntax)?

Signature to awesome to be displayed.
03-08-2012, 12:00 PM
Find




Users browsing this thread: 1 Guest(s)