Frictional Games Forum (read-only)
HPL level editor Need help now! - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: HPL level editor Need help now! (/thread-17932.html)



HPL level editor Need help now! - Fanstetic - 08-24-2012

Hello, I'm having a scripting problem, basically I have a monster spawning in one spot using a playerstart and a script that you walk through, I wanted to make another one but it keeps spawning at the wrong playerstart. Here is the script

void OnStart()
{
SetEntityConnectionStateChangeCallback("lever", "unlockdoor");
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
AddEntityCollideCallback("Player","start","monster",true,1);
AddEntityCollideCallback("grunt","stop","monsterend",true,1);
AddEntityCollideCallback("Player","start2","monster",true,1);
}

void unlockdoor(string &in asEntity, int alState) {
if(GetLeverState("lever")==1){ SetSwingDoorLocked("door", false, true);
}
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("door1", 0.0f);


PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);


PlaySoundAtEntity("", "react_scare", "Player", 0, false);


PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);


GiveSanityDamage(5.0f, true);
}

void monster(string &in asParent, string &in asChild, int alstate){
SetEntityActive("grunt",true);
AddEnemyPatrolNode("grunt","node",0,"");
}

void monsterend(string &in asParent, string &in asChild, int alstate){
SetEntityActive("grunt",false);
}

void monster2(string &in asParent, string &in asChild, int alstate){
SetEntityActive("crawler",true);
AddEnemyPatrolNode("crawler","node2",0,"");
}

Please note I'm very new so if you notice any fails, anything I am doing wrong please point it out. Thanks.


RE: HPL level editor Need help now! - Adny - 08-24-2012

void OnStart()
{
SetEntityConnectionStateChangeCallback("lever", "unlockdoor");
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
AddEntityCollideCallback("Player", "start", "monster", true, 1);
AddEntityCollideCallback("grunt", "stop", "monsterend", true, 1);
AddEntityCollideCallback("Player", "start2", "monster", true, 1);
}

The second bolded AddEntityCollideCallback should call the function "monster2"; it just calls the same function as the AddEntityCollideCallback for the first monster.

AddEntityCollideCallback("Player", "start2", "monster2", true, 1);



Hope that helped!


RE: HPL level editor Need help now! - Fanstetic - 08-24-2012

(08-24-2012, 08:45 AM)andyrockin123 Wrote: void OnStart()
{
SetEntityConnectionStateChangeCallback("lever", "unlockdoor");
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
AddEntityCollideCallback("Player", "start", "monster", true, 1);
AddEntityCollideCallback("grunt", "stop", "monsterend", true, 1);
AddEntityCollideCallback("Player", "start2", "monster", true, 1);
}

The second bolded AddEntityCollideCallback should call the function "monster2"; it just calls the same function as the AddEntityCollideCallback for the first monster.

AddEntityCollideCallback("Player", "start2", "monster2", true, 1);



Hope that helped!
Thank you sooo much!!!!!