Frictional Games Forum (read-only)

Full Version: Custom Story Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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.
19 void AddEntityCollideCallback("PlayerStop", "", "SetPlayerActive", "", 1);
20

There are no braces here first of all.
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)
Romulator i did as you showed but it still shows me the same error.
Updated! Sorry about that.
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?
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
Thanks !
How do i +rep you? Big Grin
Leftmost + sign on the bottom left of his post
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);
    }

Pages: 1 2