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
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#11
RE: Hi, its me again ;d

PHP Code: (Select All)
if(GetSwingDoorClosed() == false) {



This function needs a string argument. So for example GetSwingDoorClosed("MyDoor") or GetSwingDoorClosed(asParent).

You should also stop doing the (bool) and (float) conversions. There are much better ways to input one of those values, like just writing it straight forward.

SetSwingDoorLocked also uses arguments of String, Bool, Bool. Not String, Bool, String like how you've written it.

06-20-2015, 02:10 PM
Find
NotASkrub Offline
Junior Member

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

Spoiler below!
(06-20-2015, 02:02 PM)DnALANGE Wrote: void PlayerScare(string &in asParent, string &in asChild, string &in alState)
{
if(GetSwingDoorClosed(asEntity) == false)
{
SetSwingDoorClosed("AwaysLockedDoor", true, "true");
AddTimer("Lock", float (1.0), "LockDoor");
}
}

Quote:SetSwingDoorClosed(string& asName, bool abClosed, bool abEffects);
has to be like this :
SetSwingDoorClosed("""Name of your door", true or false, true or false);

So choose OR true OR false,like :
PHP Code: (Select All)
SetSwingDoorClosed("""Name of your door"true,false); 

For your script as it is now no need to write bool AND true.
Bool = true or false.

Here is an example from me, try playing with it :
PHP Code: (Select All)
SetSwingDoorLocked("door1"falsefalse);
SetSwingDoorClosed("door1"falsefalse); 
-
PHP Code: (Select All)
void Bathroomdoor(string &in asEntity)
{
    if(
GetSwingDoorLocked(asEntity) == true)

//DO SOMETHING HERE/ Put your script here. Only when touching the door and have (Bathroomdoor) set in your leveleditor as PlayerInteractCallBack.



Okey, I fixed that, I dont get the error messages anymore, now there's another problem.. When I enter the defined area (e.g script area) it doesn't run anything.. I checked the names, and everything was correct..
06-20-2015, 02:56 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#13
RE: Hi, its me again ;d

Could you have run into the area when the door was closed first?

Because then the function will delete itself and not call anymore unless you reload the map.

Trying is the first step to success.
06-20-2015, 05:01 PM
Find
NotASkrub Offline
Junior Member

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

(06-20-2015, 05:01 PM)FlawlessHappiness Wrote: Could you have run into the area when the door was closed first?

Because then the function will delete itself and not call anymore unless you reload the map.
No, I intentionally leave it open.. But that gives me the idea, that I can add another "if" function, that will directly move to the scare part if the door is closed..
But you know, mostly people let the doors open, unless they see a monster..
(This post was last modified: 06-20-2015, 06:20 PM by NotASkrub.)
06-20-2015, 06:08 PM
Find
NotASkrub Offline
Junior Member

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

Sorry for bump, but I need the help about the problem listed above..
06-20-2015, 10:11 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#16
RE: Hi, its me again ;d

Show how you've set up the script right now.

Trying is the first step to success.
06-21-2015, 01:28 AM
Find
NotASkrub Offline
Junior Member

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

(06-21-2015, 01:28 AM)FlawlessHappiness Wrote: Show how you've set up the script right now.
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"bool (false));
    
AddUseItemCallback("""MysteriousKey""AwaysLockedDoor""AwaysLockedUnlock"true);
;}

//ExtraScripts for OnStart//

//AddEntityCollideCallback Scripts//
void PlayerScare(string &in asParentstring &in asChildstring &in alState)
{
    if (
GetSwingDoorClosed("AwaysLockedDoor") == false)
        {
            
SetSwingDoorClosed("AwaysLockedDoor"truetrue);
            
AddTimer("Lock"float (2.0), "LockDoor");
        }
    if (
GetSwingDoorClosed("AwaysLockedDoor") == true)
        {
            
AddTimer("Lock"float (2.0), "LockDoor");
        }
;}

void LockDoor(string &in asTimer)
{
    
SetSwingDoorLocked("AwaysLockedDoor"truetrue);
    
PlaySoundAtEntity("""lock_door.snt""Player"float (0.0), false);
    
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"float (2.0), float (4.0), "");
;}

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

void TiredDone(string &in asParentstring &in asChildint alState)
{
    
StopPlayerLookAt();
    
CompleteQuest("Tired""Tired");
    
AddTimer("FadeOutTimer"float (0.5), "FadeOutFunc");
    
;}

void FadeOutFunc(string &in asTimer)
{
    
FadeOut(float (2.0));
    
AddTimer("FadeInTimer"float (2.5), "FadeInFunc");
;}

void FadeInFunc(string &in asTimer)
{
    
PlaySoundAtEntity("PlayerScare""BruteEnabled.snt""Player"float (5.0), bool (false));
    
FadeIn(float (4.0));
    
SetEntityActive("MysteriousKey"bool (true));
    
AddTimer("SoundQuest"float(5.0), "SoundQuest");
;}

void SoundQuest(string &in asTimer)
{
    
AddQuest("SoundQuest""SoundQuest");
;}
//AddUseItemCallback Scripts//
void AwaysLockedUnlock(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked("AwaysLockedDoor"bool (false), bool (true));
    
PlaySoundAtEntity("""unlock_door""Player"0false);
    
RemoveItem("MysteriousKey");
;}

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

//SetEntityPlayerLookAtCallback Scripts//
void Tim(string &in asEntityint alState)
{
    
SetMessage("Messages""Tim"float (0.6));
;}

//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.)// 

there ya go, what I want is, when the player enters a certain area in a room, the door to be closed, and the scare part to be run..
06-21-2015, 11:16 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#18
RE: Hi, its me again ;d

You don't need to check if the door is open or closed. SetSwingDoorClosed() will work whether or not the door is closed or not.

However:
PHP Code: (Select All)
AddTimer("Lock"float (2.0), "LockDoor"); 
Here is your problem. You don't need to define the time is a float with that keyword. Any floats are written just as the decimal, followed by the letter f.

So like this:
PHP Code: (Select All)
AddTimer("Lock"2.0f"LockDoor"); 

Furthermore, recheck your floats in your code. They follow the same format as your first timer; so you need to rewrite those particular parts.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 06-21-2015, 12:18 PM by Romulator.)
06-21-2015, 12:16 PM
Find
NotASkrub Offline
Junior Member

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

I did those changes, and yet, it doesnt do what it has to do in the script after the player enters certain script area..
06-21-2015, 01:28 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#20
RE: Hi, its me again ;d

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.

Trying is the first step to success.
(This post was last modified: 06-21-2015, 01:30 PM by FlawlessHappiness.)
06-21-2015, 01:30 PM
Find




Users browsing this thread: 1 Guest(s)