Hungerzz
Junior Member
Posts: 10
Threads: 2
Joined: Mar 2014
Reputation:
0
|
Custom Story Error
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.
|
|
03-23-2014, 10:45 AM |
|
7heDubz
Posting Freak
Posts: 1,329
Threads: 40
Joined: Feb 2013
Reputation:
41
|
RE: Custom Story Error
19 void AddEntityCollideCallback("PlayerStop", "", "SetPlayerActive", "", 1);
20
There are no braces here first of all.
|
|
03-23-2014, 10:50 AM |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: Custom Story Error
Actually; hold on, you have a few errors...
Try This!
void OnStart() { AddEntityCollideCallback("Player", "PlayerStop", "SetPlayerActive", true, 1); }
void SetPlayerActive(string &in asParent, string &in asChild, int alState) { SetPlayerActive(false); StartPlayerLookAt("Grunt", 5.0f, 5.0f, ""); AddTimer("", 5.0f, "StartWalk"); }
void StartWalk(string &in asTimer) { SetPlayerActive(true); StopPlayerLookAt(); }
See if it works after that (But if you already have an OnStart(), make sure to put the AddEntityCollideCallback inside of it)
Discord: Romulator#0001
(This post was last modified: 03-23-2014, 10:57 AM by Romulator.)
|
|
03-23-2014, 10:50 AM |
|
Hungerzz
Junior Member
Posts: 10
Threads: 2
Joined: Mar 2014
Reputation:
0
|
RE: Custom Story Error
Romulator i did as you showed but it still shows me the same error.
(This post was last modified: 03-23-2014, 10:56 AM by Hungerzz.)
|
|
03-23-2014, 10:54 AM |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: Custom Story Error
Updated! Sorry about that.
Discord: Romulator#0001
|
|
03-23-2014, 10:57 AM |
|
Hungerzz
Junior Member
Posts: 10
Threads: 2
Joined: Mar 2014
Reputation:
0
|
RE: Custom Story Error
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?
|
|
03-23-2014, 11:07 AM |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: Custom Story Error
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 When finished, I will pm you
Discord: Romulator#0001
(This post was last modified: 03-23-2014, 11:11 AM by Romulator.)
|
|
03-23-2014, 11:10 AM |
|
Hungerzz
Junior Member
Posts: 10
Threads: 2
Joined: Mar 2014
Reputation:
0
|
RE: Custom Story Error
Thanks !
How do i +rep you?
|
|
03-23-2014, 11:11 AM |
|
7heDubz
Posting Freak
Posts: 1,329
Threads: 40
Joined: Feb 2013
Reputation:
41
|
RE: Custom Story Error
Leftmost + sign on the bottom left of his post
|
|
03-23-2014, 11:21 AM |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: Custom Story Error
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!
void OnStart() { AddEntityCollideCallback("Player", "ScriptArea_1", "WalkandFollow", true, 1); SetLocalVarInt("Time_number", 1); }
void WalkandFollow(string &in asParent, string &in asChild, int 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.0f, 10.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.0f, 10.0f, ""); AddTimer("look", 0.5f, "timer_look"); AddLocalVarInt("Time_number", 1); } }
Discord: Romulator#0001
(This post was last modified: 03-23-2014, 12:01 PM by Romulator.)
|
|
03-23-2014, 12:01 PM |
|
|