NotASkrub
Junior Member
Posts: 19
Threads: 2
Joined: Jun 2015
Reputation:
0
RE: Hi, its me again ;d
(06-21-2015, 01:30 PM) FlawlessHappiness Wrote: Please, every time you've done something and it doesn't work, update your script in your next post so that we can see if you made any errors.
Oh, sorry, didnt knew I had to do this ;d
Here is the script:
Spoiler below!
//Everything with "//" at the start of the text and at the end is just a comment.// //Everything starting with "//" only, may not be needed in the script.// //When game starts for first time (e.g. mostly used in full conversion modes)// //void OnGameStart() //{ // //;} //On start of a map for first time.// void OnStart () { TeleportPlayer ( "PlayerStartArea_1" ); AddEntityCollideCallback ( "Player" , "Quest1" , "Tired" , true , 1 ); AddEntityCollideCallback ( "Player" , "Scare" , "PlayerScare" , true , 1 ); AddEntityCollideCallback ( "Player" , "StartLookAt" , "StartLookAt" , true , 1 ); AddEntityCollideCallback ( "Player" , "ForcedLookAt" , "ForcedLookAtStop" , true , 1 ); AddEntityCollideCallback ( "Player" , "Quest1Done" , "TiredDone" , true , 1 ); SetEntityPlayerLookAtCallback ( "Tim" , "Tim" , ( false )); AddUseItemCallback ( "" , "MysteriousKey" , "AwaysLockedDoor" , "AwaysLockedUnlock" , true ); ;} //ExtraScripts for OnStart// //AddEntityCollideCallback Scripts// void PlayerScare ( string & in asParent , string & in asChild , string & in alState ) { SetSwingDoorClosed ( "AwaysLockedDoor" , true , true ); AddTimer ( "Lock" , 2.0f , "LockDoor" ); ;} void LockDoor ( string & in asTimer ) { SetSwingDoorLocked ( "AwaysLockedDoor" , true , true ); PlaySoundAtEntity ( "" , "lock_door.snt" , "Player" , 0.0f , false ); SetEntityActive ( "JumpScare" , true ); ShowEnemyPlayerPosition ( "JumpScare" ); ;} void Tired ( string & in asParent , string & in asChild , int alState ) { AddQuest ( "Tired" , "Tired" ); ;} void StartLookAt ( string & in asParent , string & in asChild , int alState ) { StartPlayerLookAt ( "ForcedLookAt" , 2.0f , 4.0f , "" ); ;} void ForcedLookAtStop ( string & in asParent , string & in asChild , int alState ) { StopPlayerLookAt (); ;} void TiredDone ( string & in asParent , string & in asChild , int alState ) { StopPlayerLookAt (); CompleteQuest ( "Tired" , "Tired" ); AddTimer ( "FadeOutTimer" , 0.5f , "FadeOutFunc" ); ;} void FadeOutFunc ( string & in asTimer ) { FadeOut ( 2.0f ); AddTimer ( "FadeInTimer" , 2.5f , "FadeInFunc" ); ;} void FadeInFunc ( string & in asTimer ) { PlaySoundAtEntity ( "PlayerScare" , "BruteEnabled.snt" , "Player" , ( 5.0 ), ( false )); FadeIn ( 4.0f ); SetEntityActive ( "MysteriousKey" , ( true )); AddTimer ( "SoundQuest" , 5.0f , "SoundQuest" ); ;} void SoundQuest ( string & in asTimer ) { AddQuest ( "SoundQuest" , "SoundQuest" ); ;} //AddUseItemCallback Scripts// void AwaysLockedUnlock ( string & in asItem , string & in asEntity ) { SetSwingDoorLocked ( "AwaysLockedDoor" , ( false ), ( true )); PlaySoundAtEntity ( "" , "unlock_door" , "Player" , 0 , false ); RemoveItem ( "MysteriousKey" ); ;} void AwaysLockedMessage ( string & in asEntity , string & in type ) { SetMessage ( "Messages" , "MysteriousKey" , 0.0f ); ;} //SetEntityPlayerLookAtCallback Scripts// void Tim ( string & in asEntity , int alState ) { SetMessage ( "Messages" , "Tim" , 0.3f ); ;} //On enter of the map (e.g using a map multiple times).// void OnEnter () { ;} //On leaving the map.// void OnLeave () { ;} //EXTRA SCRIPTS (Functions, codes and etc.)//
06-21-2015, 02:14 PM
DnALANGE
Banned
Posts: 1,549
Threads: 73
Joined: Jan 2012
RE: Hi, its me again ;d
Remove all the smiley ;}
Replace all of them just with the }
And then try again.
(This post was last modified: 06-21-2015, 05:14 PM by DnALANGE .)
06-21-2015, 05:14 PM
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
RE: Hi, its me again ;d
The smileys shouldn't do anything. It's preferred to not have it just for the fact that it's odd practise and redundant, but it shouldn't cause any issues.
You can have several semi-colons after a function, like MyFunc();;;. That's basically what's going on here, it's just on a new line.
MyFunc();;;
;;;
(This post was last modified: 06-21-2015, 05:22 PM by Mudbill .)
06-21-2015, 05:22 PM
NotASkrub
Junior Member
Posts: 19
Threads: 2
Joined: Jun 2015
Reputation:
0
RE: Hi, its me again ;d
Actually I get an error that its expecting a semi colon before the "}"..
06-21-2015, 06:55 PM
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
RE: Hi, its me again ;d
(06-21-2015, 06:55 PM) NotASkrub Wrote: Actually I get an error that its expecting a semi colon before the "}"..
That is not true.
It may say that it expected it there. But that's because it's the LAST place it would expect it. Not necessarily the right place.
You could write:
void function( string & in asEntity ) { SetEntityActive ( "Thing" , true ) }
It would now say it expected a ; behind the }. But that's not the right place. It may expect it there, but the actual way is to place ; after ).
void function( string & in asEntity ) { SetEntityActive ( "Thing" , true ); }
I also found 2 mistakes:
SetEntityPlayerLookAtCallback ( "Tim" , "Tim" , ( false ));
Don't place something inside () unless it tells you to. In this case it would just be ("Tim", "Tim", false);
PlaySoundAtEntity ( "PlayerScare" , "BruteEnabled.snt" , "Player" , ( 5.0 ), ( false ));
Here you did the same thing, but with a number instead.
Trying is the first step to success.
06-21-2015, 07:21 PM
NotASkrub
Junior Member
Posts: 19
Threads: 2
Joined: Jun 2015
Reputation:
0
RE: Hi, its me again ;d
(06-21-2015, 07:21 PM) FlawlessHappiness Wrote: SetEntityPlayerLookAtCallback ( "Tim" , "Tim" , ( false ));
Don't place something inside () unless it tells you to. In this case it would just be ("Tim", "Tim", false);
PlaySoundAtEntity ( "PlayerScare" , "BruteEnabled.snt" , "Player" , ( 5.0 ), ( false ));
Here you did the same thing, but with a number instead.What if I told you, it tells me to do so.. and believe it or not, it expects a semi colon before the "}"..
EDIT: Never mind that.. I removed the semi colons for now, it seems to work.. but lets move to the problem I have..
(This post was last modified: 06-21-2015, 08:40 PM by NotASkrub .)
06-21-2015, 08:35 PM
Catalyst
Member
Posts: 213
Threads: 32
Joined: Aug 2014
Reputation:
3
RE: Hi, its me again ;d
what's the problem, maybe you'll show a script content again? I don't know what is the problem actualy.
Egypt CS
(This post was last modified: 06-21-2015, 08:54 PM by Catalyst .)
06-21-2015, 08:53 PM
NotASkrub
Junior Member
Posts: 19
Threads: 2
Joined: Jun 2015
Reputation:
0
RE: Hi, its me again ;d
(06-21-2015, 08:53 PM) Catalyst Wrote: what's the problem, maybe you'll show a script content again? I don't know what is the problem actualy.
Its not "actualy" it is "actually"
The problem was listed above.. My mistake was that you know this code
void AddEntityCollideCallback ( string & asParentName , string & asChildName , string & asFunction , bool abDeleteOnCollide , int alStates );
And then below it theres the callback (e.g. when the certain entity enters the certain area it calls a certain function) A.K.A. This >
void MyFunc ( string & in asParent , string & in asChild , int alState )
< code..
So my dumb mistake was, that I used at the end "string &in alState" (instead of "int alState") and we know that numbers are not considered as text in the scripting...
Anyway, I fixed my mistake, fixed my error and for now it seems that everything works..
If I get further errors/mistakes or problems I will post here, in this topic!
Thank you again for the help ;d
(This post was last modified: 06-21-2015, 11:01 PM by NotASkrub .)
06-21-2015, 10:59 PM