Frictional Games Forum (read-only)
Custom Story Error - 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: Custom Story Error (/thread-24910.html)

Pages: 1 2


Custom Story Error - Hungerzz - 03-23-2014

Hello guys,can you show me how to fix this problem? Here is the script
--------------------------------------------------------------------
19 void AddEntityCollideCallback("PlayerStop", "", "SetPlayerActive", "", 1);
20
21 void SetPlayerActive(false);
22 {
23 StartPlayerLookAt("Grunt", 5.0f, 5.0f, "AddTimer");
24 AddTimer("", 5.0f, "StartWalk");
25 }
26 void StartWalk(string &in asTimer)
27 {
28 SetPlayerActive(true);
29 StopPlayerLookAt();
30 }
------------------------------------------------------------------
And then this error shows up when i start the map :

main(22,1) ERR: Unexpected token '{'

-------------------------------------------------------
I'm trying to make player stop and look at monster for 5 seconds,and then walk again after 5 seconds.


RE: Custom Story Error - 7heDubz - 03-23-2014

19 void AddEntityCollideCallback("PlayerStop", "", "SetPlayerActive", "", 1);
20

There are no braces here first of all.


RE: Custom Story Error - Romulator - 03-23-2014

Actually; hold on, you have a few errors...

Try This!
PHP Code:
void OnStart()
{
AddEntityCollideCallback("Player""PlayerStop""SetPlayerActive"true1);
}

void SetPlayerActive(string &in asParentstring &in asChildint alState)
{
SetPlayerActive(false);
StartPlayerLookAt("Grunt"5.0f5.0f"");
AddTimer(""5.0f"StartWalk");
}

void StartWalk(string &in asTimer)
{
SetPlayerActive(true);
StopPlayerLookAt();


See if it works after that Smile (But if you already have an OnStart(), make sure to put the AddEntityCollideCallback inside of it)


RE: Custom Story Error - Hungerzz - 03-23-2014

Romulator i did as you showed but it still shows me the same error.


RE: Custom Story Error - Romulator - 03-23-2014

Updated! Sorry about that.


RE: Custom Story Error - Hungerzz - 03-23-2014

Thanks so much Romulator! It started looking everything works fine! But there is still one problem.Player doesn't follow Grunt as it moves.What do i do?


RE: Custom Story Error - Romulator - 03-23-2014

That one isn't tough, but can be a bit tedious to code. I'll take a look at Case Statements and get back to you on that in a sec Smile When finished, I will pm you Smile


RE: Custom Story Error - Hungerzz - 03-23-2014

Thanks !
How do i +rep you? Big Grin


RE: Custom Story Error - 7heDubz - 03-23-2014

Leftmost + sign on the bottom left of his post


RE: Custom Story Error - Romulator - 03-23-2014

Sent a PM. Done using a looping timer and localvars instead of case. Would make it a bit more complicated.

My final code came out like this, however in more my favour than Hungerzz. Feel free to use it if you understand how it works!
PHP Code:
void OnStart()
{
    
AddEntityCollideCallback("Player""ScriptArea_1""WalkandFollow"true1);
    
SetLocalVarInt("Time_number"1);
}

void WalkandFollow(string &in asParentstring &in asChildint alState)
{
    
SetPlayerActive(false);
    
AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_1"0.001f"");
    
AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_2"0.001f"");
    
AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_3"0.001f"");
    
AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_4"0.001f"");
    
AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_5"0.001f"");
    
StartPlayerLookAt("servant_grunt_1"10.0f10.0f"");
    
AddTimer("look"0.1f"timer_look");
}
    
void timer_look(string &in asTimer)
{
    if(
GetLocalVarInt("Time_number") == 11)
    {
    
SetPlayerActive(true);
    
StopPlayerLookAt();
    
RemoveTimer("look");
    }
    else
    {
    
StartPlayerLookAt("servant_grunt_1"10.0f10.0f"");
    
AddTimer("look"0.5f"timer_look");
    
AddLocalVarInt("Time_number"1);
    }