Frictional Games Forum (read-only)
Help me script this!!! - 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: Help me script this!!! (/thread-11609.html)



Help me script this!!! - FreshKorruption - 12-01-2011

Alright so here is the position I am in. I have it so when you pick up a key two monsters appear on each side of the room (I can do that). But when they appear, I want them to stand still and make the character spin towards one, then to the other, then spin around quickly towards the hallway. Basically, spin towards one enemy, the other, than turn around. I want to make it so they don't attack you until the player gains control again.


RE: Help me script this!!! - flamez3 - 12-02-2011

My best guess is to just deactivate triggers in the entities tab of the monster, (this makes him not re-act to anything). And when the player regains control activate new monsters that chase him (don't check the deactivate triggers).


RE: Help me script this!!! - GreyFox - 12-02-2011

Lets Name your stuff real quick

Charles1&Charles2(Left Side, they don't need these names)
Frank1&Frank2(Right Side)
Key1

Now for Charles1 and Frank1, do as Flamez3 said and check Deactivate Triggers, Then Make a Second (of the same Monster) in the same spot, but name it Charles2, or Frank2 (or whatever you want it to be called) and Make sure Deactivate triggers isn't checked. and make them inactive.

make A script box in the hallway where you want to look I named it Hall1 (in the script)

Now if you want to alter the speeds, and or Add Sounds, Etc then Go ahead, but this Should work.

Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
SetEntityPlayerInteractCallback("Key", "Scare1", true);
}

void Scare1(string &in asEntity)
{
    StartPlayerLookAt("Charles1", 5, 10, "");
    AddTimer("LookAtFrank1", 1.2, "LookAtFrank1");
    SetPlayerActive(false);
}

void LookAtFrank1(string &in asTimer)
{
    StartPlayerLookAt("Frank1", 5, 10, "");
    AddTimer("LookAtHall", .8, "LookAtHall");
}

void LookAtHall(string &in asTimer)
{
    StartPlayerLookAt("Hall1", 8, 10, "");
    AddTimer("GainControl" 0.2, "GainControl");
}

void GainControl(string &in asTimer)
{
    SetEntityActive("Charles1", false);
    SetEntityActive("Frank1", false);
    SetEntityActive("Charles2", true);
    SetEntityActive("Frank2", true);
    SetPlayerActive(true);
}

-Grey Fox







RE: Help me script this!!! - flamez3 - 12-02-2011

(12-02-2011, 03:33 AM)GreyFox Wrote: Lets Name your stuff real quick

Charles1&Charles2(Left Side, they don't need these names)
Frank1&Frank2(Right Side)
Key1

Now for Charles1 and Frank1, do as Flamez3 said and check Deactivate Triggers, Then Make a Second (of the same Monster) in the same spot, but name it Charles2, or Frank2 (or whatever you want it to be called) and Make sure Deactivate triggers isn't checked. and make them inactive.

make A script box in the hallway where you want to look I named it Hall1 (in the script)

Now if you want to alter the speeds, and or Add Sounds, Etc then Go ahead, but this Should work.

Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
SetEntityPlayerInteractCallback("Key", "Scare1", true);
}

void Scare1(string &in asEntity)
{
    StartPlayerLookAt("Charles1", 5, 10, "");
    AddTimer("LookAtFrank1", 1.2, "LookAtFrank1");
    SetPlayerActive(false);
}

void LookAtFrank1(string &in asTimer)
{
    StartPlayerLookAt("Frank1", 5, 10, "");
    AddTimer("LookAtHall", .8, "LookAtHall");
}

void LookAtHall(string &in asTimer)
{
    StartPlayerLookAt("Hall1", 8, 10, "");
    AddTimer("GainControl" 0.2, "GainControl");
}

void GainControl(string &in asTimer)
{
    SetEntityActive("Charles1", false);
    SetEntityActive("Frank1", false);
    SetEntityActive("Charles2", true);
    SetEntityActive("Frank2", true);
    SetPlayerActive(true);
}

-Grey Fox
You put it alot better than I did Smile




RE: Help me script this!!! - GreyFox - 12-02-2011

I had the Time, Lol and wanted to do it.

I'm better at scripting if someone kinda directs me what they want (IE working with a team.)


-Grey Fox



RE: Help me script this!!! - FreshKorruption - 12-13-2011

(12-02-2011, 03:33 AM)GreyFox Wrote: Lets Name your stuff real quick

Charles1&Charles2(Left Side, they don't need these names)
Frank1&Frank2(Right Side)
Key1

Now for Charles1 and Frank1, do as Flamez3 said and check Deactivate Triggers, Then Make a Second (of the same Monster) in the same spot, but name it Charles2, or Frank2 (or whatever you want it to be called) and Make sure Deactivate triggers isn't checked. and make them inactive.

make A script box in the hallway where you want to look I named it Hall1 (in the script)

Now if you want to alter the speeds, and or Add Sounds, Etc then Go ahead, but this Should work.

Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
SetEntityPlayerInteractCallback("Key", "Scare1", true);
}

void Scare1(string &in asEntity)
{
    StartPlayerLookAt("Charles1", 5, 10, "");
    AddTimer("LookAtFrank1", 1.2, "LookAtFrank1");
    SetPlayerActive(false);
}

void LookAtFrank1(string &in asTimer)
{
    StartPlayerLookAt("Frank1", 5, 10, "");
    AddTimer("LookAtHall", .8, "LookAtHall");
}

void LookAtHall(string &in asTimer)
{
    StartPlayerLookAt("Hall1", 8, 10, "");
    AddTimer("GainControl" 0.2, "GainControl");
}

void GainControl(string &in asTimer)
{
    SetEntityActive("Charles1", false);
    SetEntityActive("Frank1", false);
    SetEntityActive("Charles2", true);
    SetEntityActive("Frank2", true);
    SetPlayerActive(true);
}

-Grey Fox
Thanks it worked perfectly. My only issue is that it won't stop looking at hall1 after it looks at the grunts.





RE: Help me script this!!! - ggstarfoxxie - 12-13-2011

Try this:

void GainControl(string &in asTimer)
{
SetEntityActive("Charles1", false);
SetEntityActive("Frank1", false);
SetEntityActive("Charles2", true);
SetEntityActive("Frank2", true);
SetPlayerActive(true);
StopPlayerLookAt();
}



RE: Help me script this!!! - GreyFox - 12-13-2011

My Bad, In my Mind I though I put that in there. Do what GGstarfoxxie said and it should be good.

Good Luck and Thanks Foxxie
-Grey Fox