Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Hi, its me again ;d
NotASkrub Offline
Junior Member

Posts: 19
Threads: 2
Joined: Jun 2015
Reputation: 0
#21
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!
PHP Code: (Select All)
//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"true1);
    
AddEntityCollideCallback("Player""Scare""PlayerScare"true1);
    
AddEntityCollideCallback("Player""StartLookAt""StartLookAt"true1);
    
AddEntityCollideCallback("Player""ForcedLookAt""ForcedLookAtStop"true1);
    
AddEntityCollideCallback("Player""Quest1Done""TiredDone"true1);
    
SetEntityPlayerLookAtCallback("Tim""Tim", (false));
    
AddUseItemCallback("""MysteriousKey""AwaysLockedDoor""AwaysLockedUnlock"true);
;}

//ExtraScripts for OnStart//

//AddEntityCollideCallback Scripts//
void PlayerScare(string &in asParentstring &in asChildstring &in alState)
{
    
SetSwingDoorClosed("AwaysLockedDoor"truetrue);
    
AddTimer("Lock"2.0f"LockDoor");
;}

void LockDoor(string &in asTimer)
{
    
SetSwingDoorLocked("AwaysLockedDoor"truetrue);
    
PlaySoundAtEntity("""lock_door.snt""Player"0.0ffalse);
    
SetEntityActive("JumpScare"true);
    
ShowEnemyPlayerPosition("JumpScare");
;}

void Tired(string &in asParentstring &in asChildint alState)
{
    
AddQuest("Tired""Tired");
;}

void StartLookAt(string &in asParentstring &in asChildint alState)
{
    
StartPlayerLookAt("ForcedLookAt"2.0f4.0f"");
;}

void ForcedLookAtStop(string &in asParentstring &in asChildint alState)
{
    
StopPlayerLookAt();
;}

void TiredDone(string &in asParentstring &in asChildint 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 asItemstring &in asEntity)
{
    
SetSwingDoorLocked("AwaysLockedDoor", (false), (true));
    
PlaySoundAtEntity("""unlock_door""Player"0false);
    
RemoveItem("MysteriousKey");
;}

void AwaysLockedMessage(string &in asEntitystring &in type)
{
    
SetMessage("Messages""MysteriousKey"0.0f);
;}

//SetEntityPlayerLookAtCallback Scripts//
void Tim(string &in asEntityint 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
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#22
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
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#23
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
Find
NotASkrub Offline
Junior Member

Posts: 19
Threads: 2
Joined: Jun 2015
Reputation: 0
#24
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
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#25
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:

PHP Code: (Select All)
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 ).

PHP Code: (Select All)
void function(string &in asEntity)
{
SetEntityActive("Thing"true);


I also found 2 mistakes:

PHP Code: (Select All)
SetEntityPlayerLookAtCallback("Tim""Tim", (false)); 
Don't place something inside () unless it tells you to. In this case it would just be ("Tim", "Tim", false);

PHP Code: (Select All)
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.
(This post was last modified: 06-21-2015, 07:24 PM by FlawlessHappiness.)
06-21-2015, 07:21 PM
Find
NotASkrub Offline
Junior Member

Posts: 19
Threads: 2
Joined: Jun 2015
Reputation: 0
#26
RE: Hi, its me again ;d

(06-21-2015, 07:21 PM)FlawlessHappiness Wrote:
PHP Code: (Select All)
SetEntityPlayerLookAtCallback("Tim""Tim", (false)); 
Don't place something inside () unless it tells you to. In this case it would just be ("Tim", "Tim", false);

PHP Code: (Select All)
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
Find
Catalyst Offline
Member

Posts: 213
Threads: 32
Joined: Aug 2014
Reputation: 3
#27
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
[Image: 27003.png]
(This post was last modified: 06-21-2015, 08:54 PM by Catalyst.)
06-21-2015, 08:53 PM
Find
NotASkrub Offline
Junior Member

Posts: 19
Threads: 2
Joined: Jun 2015
Reputation: 0
#28
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" Big Grin
The problem was listed above.. My mistake was that you know this code
PHP Code: (Select All)
void AddEntityCollideCallback(stringasParentNamestringasChildNamestringasFunctionbool abDeleteOnCollideint 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 >
PHP Code: (Select All)
void MyFunc(string &in asParentstring &in asChildint 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
Find




Users browsing this thread: 1 Guest(s)