Frictional Games Forum (read-only)
[SCRIPT] Hi, its me again ;d - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Hi, its me again ;d (/thread-30136.html)

Pages: 1 2 3


RE: Hi, its me again ;d - Mudbill - 06-20-2015

PHP Code:
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.


RE: Hi, its me again ;d - NotASkrub - 06-20-2015

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:
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:
SetSwingDoorLocked("door1"falsefalse);
SetSwingDoorClosed("door1"falsefalse); 
-
PHP Code:
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..


RE: Hi, its me again ;d - FlawlessHappiness - 06-20-2015

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.


RE: Hi, its me again ;d - NotASkrub - 06-20-2015

(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..


RE: Hi, its me again ;d - NotASkrub - 06-20-2015

Sorry for bump, but I need the help about the problem listed above..


RE: Hi, its me again ;d - FlawlessHappiness - 06-21-2015

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


RE: Hi, its me again ;d - NotASkrub - 06-21-2015

(06-21-2015, 01:28 AM)FlawlessHappiness Wrote: Show how you've set up the script right now.
Spoiler below!
PHP Code:
//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..


RE: Hi, its me again ;d - Romulator - 06-21-2015

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:
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:
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.


RE: Hi, its me again ;d - NotASkrub - 06-21-2015

I did those changes, and yet, it doesnt do what it has to do in the script after the player enters certain script area..


RE: Hi, its me again ;d - FlawlessHappiness - 06-21-2015

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.