Frictional Games Forum (read-only)
[SCRIPT] Need some script help! - 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: [SCRIPT] Need some script help! (/thread-13548.html)

Pages: 1 2


RE: Need some script help! - Obliviator27 - 02-24-2012

(02-24-2012, 11:42 PM)ammislol Wrote:
(02-24-2012, 11:29 PM)Obliviator27 Wrote: To lock the Camera, put
SetPlayerActive(false); in the StartLookSequence function, and then
I messed up on the timers. Where it says
AddTimer("LookTimee4", 12, "NextLook");
Replace it with
AddTimer("LookTimer4", 12, "NextLook");

And finally, put
SetPlayerActive(true);
where the SetEntityActive script is.
So where excact should i change? my script looks like this atm -


void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", false, 1);
}
void StartLookSequence(string &in asParent, string &in asChild, int alState)
{
AddTimer("LookTimer1", 4, "NextLook");
AddTimer("LookTimer2", 8, "NextLook");
AddTimer("LookTimer3", 12, "NextLook");
AddTimer("LookTimer4", 12, "NextLook");
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
SetPlayerActive(false);
}
void NextLook(string &in asTimer)
{
if(asTimer == "LookTimer1")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
if(asTimer == "LookTimer2")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_3", 2, 2, "");
}
if(asTimer == "LookTimer3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_4", 2, 2, "");
}
if(asTimer == "LookTimer4")
{
StopPlayerLookAt();
SetPlayerActive(true);
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}
}



Sorry for being such a noob :< Great help tho! thanks alot.
^ Fix'd.




RE: Need some script help! - ammislol - 02-24-2012

(02-24-2012, 11:45 PM)Obliviator27 Wrote:
(02-24-2012, 11:42 PM)ammislol Wrote:
(02-24-2012, 11:29 PM)Obliviator27 Wrote: To lock the Camera, put
SetPlayerActive(false); in the StartLookSequence function, and then
I messed up on the timers. Where it says
AddTimer("LookTimee4", 12, "NextLook");
Replace it with
AddTimer("LookTimer4", 12, "NextLook");

And finally, put
SetPlayerActive(true);
where the SetEntityActive script is.
So where excact should i change? my script looks like this atm -


void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", false, 1);
}
void StartLookSequence(string &in asParent, string &in asChild, int alState)
{
AddTimer("LookTimer1", 4, "NextLook");
AddTimer("LookTimer2", 8, "NextLook");
AddTimer("LookTimer3", 12, "NextLook");
AddTimer("LookTimer4", 12, "NextLook");
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
SetPlayerActive(false);
}
void NextLook(string &in asTimer)
{
if(asTimer == "LookTimer1")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
if(asTimer == "LookTimer2")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_3", 2, 2, "");
}
if(asTimer == "LookTimer3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_4", 2, 2, "");
}
if(asTimer == "LookTimer4")
{
StopPlayerLookAt();
SetPlayerActive(true);
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}
}



Sorry for being such a noob :< Great help tho! thanks alot.
^ Fix'd.



Works great! now only one more thing LOL :<

The camera moves to area1,2 and 3, but not 4. It just stops after the 3rd, then the monster spawns and breaks the door, but if i stay around the ScriptArea_5. It keeps repeating so it looks at the areas while getting killed by the monster, is there anyway to make it so only look at it once, not everytime i enter the area, if you understand? and how to add a sound when i enter the ScriptArea_5? Sorry for all questions, hope you dont mind.


RE: Need some script help! - flamez3 - 02-26-2012

EDIT: Was too slow :>


RE: Need some script help! - ammislol - 02-26-2012

(02-26-2012, 10:29 AM)flamez3 Wrote: EDIT: Was too slow :>



Indeed :/


RE: Need some script help! - Obliviator27 - 02-26-2012

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", true, 1);
}
void StartLookSequence(string &in asParent, string &in asChild, int alState)
{
AddTimer("LookTimer1", 4, "NextLook");
AddTimer("LookTimer2", 8, "NextLook");
AddTimer("LookTimer3", 12, "NextLook");
AddTimer("LookTimer4", 16, "NextLook");
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
}
void NextLook(string &in asTimer)
{
if(asTimer == "LookTimer1")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
if(asTimer == "LookTimer2")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_3", 2, 2, "");
}
if(asTimer == "LookTimer3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_4", 2, 2, "");
}

if(asTimer == "LookTimer4")
{
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}
}

Bolded areas are what I altered.



RE: Need some script help! - ammislol - 02-26-2012

(02-26-2012, 04:38 PM)Obliviator27 Wrote: void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", true, 1);
}
void StartLookSequence(string &in asParent, string &in asChild, int alState)
{
AddTimer("LookTimer1", 4, "NextLook");
AddTimer("LookTimer2", 8, "NextLook");
AddTimer("LookTimer3", 12, "NextLook");
AddTimer("LookTimer4", 16, "NextLook");
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
}
void NextLook(string &in asTimer)
{
if(asTimer == "LookTimer1")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
if(asTimer == "LookTimer2")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_3", 2, 2, "");
}
if(asTimer == "LookTimer3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_4", 2, 2, "");
}

if(asTimer == "LookTimer4")
{
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}
}

Bolded areas are what I altered.
Yeah works now, but if i turn around and try to run away from the monster I enter the area again - and the player starts to look at area_1,2,3,4 again. Is there anyway to make it so the player only look ONCE and not everytime he enters area_5?


RE: Need some script help! - Obliviator27 - 02-26-2012

By changing the statement to true, it should only happen once.



RE: Need some script help! - ammislol - 02-26-2012

(02-26-2012, 05:31 PM)Obliviator27 Wrote: By changing the statement to true, it should only happen once.
I've got AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", true, 1);

still the same Confused


RE: Need some script help! - Obliviator27 - 02-26-2012

(02-26-2012, 05:39 PM)ammislol Wrote:
(02-26-2012, 05:31 PM)Obliviator27 Wrote: By changing the statement to true, it should only happen once.
I've got AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", true, 1);

still the same Confused
Remove any map_cache files, that may be the root of the problem.