Frictional Games Forum (read-only)
Help script not working. - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Help script not working. (/thread-7096.html)

Pages: 1 2


Help script not working. - slamer80 - 03-28-2011

//===========================================
// Starter's Script File!
//===========================================

//===========================================
// This runs when the map first starts


void OnStart()
{

AddEntityCollideCallback("Player" , "Scriptarea_2" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_Brute_2" , true);
}


{

AddEntityCollideCallback("Player" , "Scriptarea_3" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_Brute_3" , true);
}


When i enter the map, the game crashes? What am i doing wrong?


RE: Help script not working. - MrBigzy - 03-28-2011

Two problems: you call MonsterFunc1 twice (make the other MonsterFunc2 or something), and AddEntityCollideCallback("Player" , "Scriptarea_3" , "MonsterFunc1" , true , 1); is not in a function, also it should be something else since you shouldn't call the function twice.


RE: Help script not working. - slamer80 - 03-28-2011

Can you show me how it should be done?

I want 2 brutes to be spawned in 2 area triggers, 1 brute each area. If its possible?


RE: Help script not working. - MrBigzy - 03-28-2011

Code:
void OnStart()
{

AddEntityCollideCallback("Player" , "Scriptarea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("Player" , "Scriptarea_2" , "MonsterFunc2" , true , 1);
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_Brute_2" , true);
}

void MonsterFunc2(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_Brute_3" , true);
}

Like that. Makes sure your areas and brutes are named properly though.


RE: Help script not working. - slamer80 - 03-28-2011

Both of the brute got activated in area trigger 1. But i need a trigger to each one, example: Areatrigger 1, activates brute 1, and areatrigger 2, activates brute2. like that i want it, can you do that?


RE: Help script not working. - MrBigzy - 03-29-2011

Err, that means both those areas were in the same place, or both brutes were in the same place. The script makes one spawn when you enter Scriptarea_1 and the other spawn when you enter Scriptarea_2, so it's up to you to place the area and the brutes where you need them to be.


RE: Help script not working. - slamer80 - 03-29-2011

(03-29-2011, 12:02 AM)MrBigzy Wrote: Err, that means both those areas were in the same place, or both brutes were in the same place. The script makes one spawn when you enter Scriptarea_1 and the other spawn when you enter Scriptarea_2, so it's up to you to place the area and the brutes where you need them to be.

Yes, but they are seperate. When i enter area 2, nothing happens. After when i enter area 1 they both spawn at the same time, in 2 different locations.

I first entered area 2, THEN area 1.


RE: Help script not working. - MrBigzy - 03-29-2011

Won't matter what order you enter them. But the problem has something to do with the naming, unless you put the script in wrong. Can you post your script?


RE: Help script not working. - slamer80 - 03-30-2011

void OnStart()
{

AddEntityCollideCallback("Player" , "Scriptarea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("Player" , "Scriptarea_2" , "MonsterFunc2" , true , 1);
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_Brute_2" , true);
SetEntityActive("servant_Brute_1" , true);
}

[Image: unavngivetfc.png]


RE: Help script not working. - MrBigzy - 03-30-2011

You didn't put in the script I had. Both the SetEntityActives are in 1 function...