Frictional Games Forum (read-only)
need a little with a script - 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: need a little with a script (/thread-11717.html)



need a little with a script - christopher231 - 12-06-2011

Hey, in my story i have this little puzzle at the start and once you complete it you find a lever, and i want this lever to open a "safety_large_vert" but i can't seem to make it work.



SetEntityConnectionStateChangeCallback("levertodoor1", "Func_shelf");
}

void Func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("safety_large_vert_1",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}

This is what i have, i have used this script to open a "castlebase_secret_door"
and it worked.
so if anyone can help me out, i'll i give you a High Five Big Grin


RE: need a little with a script - flamez3 - 12-06-2011

(12-06-2011, 02:16 PM)christopher231 Wrote: Hey, in my story i have this little puzzle at the start and once you complete it you find a lever, and i want this lever to open a "safety_large_vert" but i can't seem to make it work.



SetEntityConnectionStateChangeCallback("levertodoor1", "Func_shelf");
}

void Func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("safety_large_vert_1",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}

This is what i have, i have used this script to open a "castlebase_secret_door"
and it worked.
so if anyone can help me out, i'll i give you a High Five Big Grin
Are you sure you can move that object? I'm asking because I don't know either :3




RE: need a little with a script - Your Computer - 12-06-2011

Do you mind showing the rest of the script? I want to make sure where and how the connection state change callback is being set.


RE: need a little with a script - christopher231 - 12-08-2011

(12-06-2011, 02:25 PM)flamez3 Wrote:
(12-06-2011, 02:16 PM)christopher231 Wrote: Hey, in my story i have this little puzzle at the start and once you complete it you find a lever, and i want this lever to open a "safety_large_vert" but i can't seem to make it work.



SetEntityConnectionStateChangeCallback("levertodoor1", "Func_shelf");
}

void Func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("safety_large_vert_1",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}

This is what i have, i have used this script to open a "castlebase_secret_door"
and it worked.
so if anyone can help me out, i'll i give you a High Five Big Grin
Are you sure you can move that object? I'm asking because I don't know either :3
i don't know if you can, because you can't go up to it and move it.



(12-06-2011, 05:37 PM)Your Computer Wrote: Do you mind showing the rest of the script? I want to make sure where and how the connection state change callback is being set.
so do you mean the whole .hps file?




RE: need a little with a script - Your Computer - 12-08-2011

(12-08-2011, 03:02 AM)christopher231 Wrote: so do you mean the whole .hps file?

Yeah.


RE: need a little with a script - christopher231 - 12-08-2011

(12-08-2011, 03:06 AM)Your Computer Wrote:
(12-08-2011, 03:02 AM)christopher231 Wrote: so do you mean the whole .hps file?

Yeah.

void OnStart()
{
SetPlayerActive(false);
SetPlayerCrouching(true);
FadeOut(0);
FadeIn(3);
AddTimer("T1", 3, "Intro");
AddTimer("T2", 6, "Intro");
AddTimer("T3", 8, "Intro");
AddTimer("T4", 10, "Intro");
AddTimer("T5", 12, "Intro");
PreloadSound("24_pipe.snt");
AddEntityCollideCallback("Player", "ScriptArea_2", "Func_monster_1", true, 1);
AddEntityCollideCallback("Player", "Crying", "PlayerLook", true, 1);
AddUseItemCallback("", "key_tower_1", "prison_1", "FUNCTION", true);
AddUseItemCallback("", "key_tomb_rusty_1", "wrongcabinet1", "FUNCTION_wrong1", true);
AddUseItemCallback("", "key_tomb_rusty_1", "wrongcabinet2", "FUNCTION_wrong2", true);
AddUseItemCallback("", "key_tomb_rusty_1", "rightcabinet", "FUNCTION_right", true);
AddUseItemCallback("", "Puzzlekey", "puzzlecabinet", "FUNCTION_puzzle1", true);
SetEntityConnectionStateChangeCallback("levertodoor1", "Func_shelf");
}

void Func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("safety_large_vert_1",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}

void FUNCTION_wrong1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("wrongcabinet1", false, true);
PlaySoundAtEntity("", "unlock_door", "wrongcabinet1", 0, false);
RemoveItem("key_tomb_rusty_1");
SetEntityActive("servant_brute_1", true);
}

void FUNCTION_wrong2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("wrongcabinet2", false, true);
PlaySoundAtEntity("", "unlock_door", "wrongcabinet2", 0, false);
RemoveItem("key_tomb_rusty_1");
SetEntityActive("servant_brute_1", true);
}

void FUNCTION_right(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("rightcabinet", false, true);
PlaySoundAtEntity("", "unlock_door", "rightcabinet", 0, false);
RemoveItem("key_tomb_rusty_1");
}

void FUNCTION_puzzle1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("puzzlecabinet", false, true);
PlaySoundAtEntity("", "unlock_door", "puzzlecabinet", 0, false);
RemoveItem("Puzzlekey");
}


void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prison_1", false, true);
PlaySoundAtEntity("", "unlock_door", "prison_1", 0, false);
RemoveItem("key_tower_1");
}

void Func_monster_1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "15_man02_whimp.snt", "ScriptArea_3", 0, false);
SetMessage("screendisplay", "Note_someonecrying_Name", 5);
}

void PlayerLook(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("ScriptArea_3", 3.0f, 3.6f, "ScreenShake");
AddTimer("look01", 4.0f, "Timer_1");
StartScreenShake (0.2f, 0.2f, 1.0f, 1.0f);
PlaySoundAtEntity("", "ui_insanity_touch.snt", "Player", 0, false);
SetMessage("screendisplay", "Note_whatisthat_Name", 5);
}

void Timer_1(string &in asTimer)
{
StopPlayerLookAt();
}
void Intro(string &in asTimer)
{
string x = asTimer;
if (x == "T1")
{
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
FadeOut(3);
}
else if (x == "T2")
{
FadeIn(3);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
SetMessage("screendisplay", "Note_whereami_Name", 5);
}
else if (x == "T3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
SetMessage("screendisplay", "Note_anote_Name", 5);
}
else if (x == "T4")
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
StopPlayerLookAt();
}
else if (x == "T5")
{
SetPlayerCrouching(false);
SetPlayerActive(true);
}
}

void OnEnter()
{
}

void OnLeave()
{
}

here's the whole file everything else works
Don't worry i got it to work, i had to use a crank... thanks anyway