Frictional Games Forum (read-only)
[SCRIPT] Script area does not activate - 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] Script area does not activate (/thread-13895.html)

Pages: 1 2 3


Script area does not activate - Peldan - 03-10-2012

Hello guys.
See, I've got a really simple problem. It's weird how it won't work!

My script area doesn't activate when the Player collides with it.

Here's the code:
PHP Code:
void OnStart()
{    
AddEntityCollideCallback("Player", "ScriptArea_1", "SpawnBrute", true, 1);
AddEntityCollideCallback("brute", "BruteDeSpawn", "DeSpawnBrute", true, 1);    
AddEntityCollideCallback("Player", "brutescare", "BruteWalk", true, 1);
}
void SpawnBrute(string &in asParent, string &in asChild, int alState)
{    
AddDebugMessage("Scriptarea works", true);    
SetEntityActive("brute", true);    
PlaySoundAtEntity("", "notice.snt", "brute", 0, false);    
PlayMusic("search_brute.ogg", true, 0.8f, 0, 0, true);    
SetMessage("SetMessage", "SM_Malo", 0);    
AddEnemyPatrolNode("brute", "PathNodeArea_1", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_2", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_3", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_4", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_5", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_6", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_7", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_8", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_9", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_10", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_11", 0.1f, "");
}
void DeSpawnBrute(string &in asParent, string &in asChild, int alState)
{    
SetEntityActive("brute", false);    
StopMusic(1.0f, 0);    
SetMessage("SetMessage", "SM_MaloGone", 0);
}
void BruteWalk(string &in asParent, string &in asChild, int alState)
{    
SetEntityActive("bruteoutside", true);    
PlaySoundAtEntity("", "notice.snt", "bruteoutside", 0, false);
PlayMusic("search_brute.ogg", true, 0.8f, 0, 0, true);    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_12", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_13", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_14", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_15", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_16", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_17", 0.1f, "");
}
void OnEnter(){
}
void OnLeave(){
} 


The script is named ScriptArea_1 and is correctly placed. Here's a pic:
[Image: tEjvW.jpg]



RE: Script area does not activate - Stepper321 - 03-10-2012


I recommend doing everything with callback on enter Smile


PHP Code:
void OnStart(){

}
void OnEnter()
{    
AddEntityCollideCallback("Player", "ScriptArea_1", "SpawnBrute", true, 1);
AddEntityCollideCallback("brute", "BruteDeSpawn", "DeSpawnBrute", true, 1);    
AddEntityCollideCallback("Player", "brutescare", "BruteWalk", true, 1);
}
void SpawnBrute(string &in asParent, string &in asChild, int alState)
{    
AddDebugMessage("Scriptarea works", true);    
SetEntityActive("brute", true);    
PlaySoundAtEntity("", "notice.snt", "brute", 0, false);    
PlayMusic("search_brute.ogg", true, 0.8f, 0, 0, true);    
SetMessage("SetMessage", "SM_Malo", 0);    
AddEnemyPatrolNode("brute", "PathNodeArea_1", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_2", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_3", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_4", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_5", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_6", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_7", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_8", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_9", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_10", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_11", 0.1f, "");
}
void DeSpawnBrute(string &in asParent, string &in asChild, int alState)
{    
SetEntityActive("brute", false);    
StopMusic(1.0f, 0);    
SetMessage("SetMessage", "SM_MaloGone", 0);
}
void BruteWalk(string &in asParent, string &in asChild, int alState)
{    
SetEntityActive("bruteoutside", true);    
PlaySoundAtEntity("", "notice.snt", "bruteoutside", 0, false);
PlayMusic("search_brute.ogg", true, 0.8f, 0, 0, true);    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_12", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_13", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_14", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_15", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_16", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_17", 0.1f, "");
}
void OnEnter(){
}
void OnLeave(){
} 



RE: Script area does not activate - ingedoom - 03-10-2012

Have u added the brute as entity?? (under the enemy tab)


And did you rename it "brute"??


RE: Script area does not activate - flamez3 - 03-10-2012

Do any other scripts work?
(03-10-2012, 12:45 PM)Stepper321 Wrote: I recommend doing everything with callback on enter Smile


PHP Code:
void OnStart(){

}
void OnEnter()
{    
AddEntityCollideCallback("Player", "ScriptArea_1", "SpawnBrute", true, 1);
AddEntityCollideCallback("brute", "BruteDeSpawn", "DeSpawnBrute", true, 1);    
AddEntityCollideCallback("Player", "brutescare", "BruteWalk", true, 1);
}
void SpawnBrute(string &in asParent, string &in asChild, int alState)
{    
AddDebugMessage("Scriptarea works", true);    
SetEntityActive("brute", true);    
PlaySoundAtEntity("", "notice.snt", "brute", 0, false);    
PlayMusic("search_brute.ogg", true, 0.8f, 0, 0, true);    
SetMessage("SetMessage", "SM_Malo", 0);    
AddEnemyPatrolNode("brute", "PathNodeArea_1", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_2", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_3", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_4", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_5", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_6", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_7", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_8", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_9", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_10", 0.1f, "");    
AddEnemyPatrolNode("brute", "PathNodeArea_11", 0.1f, "");
}
void DeSpawnBrute(string &in asParent, string &in asChild, int alState)
{    
SetEntityActive("brute", false);    
StopMusic(1.0f, 0);    
SetMessage("SetMessage", "SM_MaloGone", 0);
}
void BruteWalk(string &in asParent, string &in asChild, int alState)
{    
SetEntityActive("bruteoutside", true);    
PlaySoundAtEntity("", "notice.snt", "bruteoutside", 0, false);
PlayMusic("search_brute.ogg", true, 0.8f, 0, 0, true);    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_12", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_13", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_14", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_15", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_16", 0.1f, "");    
AddEnemyPatrolNode("bruteoutside", "PathNodeArea_17", 0.1f, "");
}
void OnEnter(){
}
void OnLeave(){
} 
Thast honestley, would not change a thing/




RE: Script area does not activate - Peldan - 03-10-2012

(03-10-2012, 12:50 PM)pingo2 Wrote: Have u added the brute as entity?? (under the enemy tab)


And did you rename it "brute"??
Yep. Added it and placed it as inactive behind a door, and then used pathnodes. The problem isn't the enemy, though. I don't even get a debug message showing that I entered the script area.


And flamez3, let me check. I will create a new one and post again in a couple of mins.


EDIT: Nope, doesn't seem like other scripts work.


RE: Script area does not activate - Stepper321 - 03-10-2012

(03-10-2012, 12:51 PM)flamez3 Wrote: Do any other scripts work?
(03-10-2012, 12:45 PM)Stepper321 Wrote: I recommend doing everything with callback on enter Smile





PHP Code:
void OnStart(){



}

void OnEnter()

{    

AddEntityCollideCallback("Player", "ScriptArea_1", "SpawnBrute", true, 1);

AddEntityCollideCallback("brute", "BruteDeSpawn", "DeSpawnBrute", true, 1);    

AddEntityCollideCallback("Player", "brutescare", "BruteWalk", true, 1);

}

void SpawnBrute(string &in asParent, string &in asChild, int alState)

{    

AddDebugMessage("Scriptarea works", true);    

SetEntityActive("brute", true);    

PlaySoundAtEntity("", "notice.snt", "brute", 0, false);    

PlayMusic("search_brute.ogg", true, 0.8f, 0, 0, true);    

SetMessage("SetMessage", "SM_Malo", 0);    

AddEnemyPatrolNode("brute", "PathNodeArea_1", 0.1f, "");    

AddEnemyPatrolNode("brute", "PathNodeArea_2", 0.1f, "");    

AddEnemyPatrolNode("brute", "PathNodeArea_3", 0.1f, "");    

AddEnemyPatrolNode("brute", "PathNodeArea_4", 0.1f, "");    

AddEnemyPatrolNode("brute", "PathNodeArea_5", 0.1f, "");    

AddEnemyPatrolNode("brute", "PathNodeArea_6", 0.1f, "");    

AddEnemyPatrolNode("brute", "PathNodeArea_7", 0.1f, "");    

AddEnemyPatrolNode("brute", "PathNodeArea_8", 0.1f, "");    

AddEnemyPatrolNode("brute", "PathNodeArea_9", 0.1f, "");    

AddEnemyPatrolNode("brute", "PathNodeArea_10", 0.1f, "");    

AddEnemyPatrolNode("brute", "PathNodeArea_11", 0.1f, "");

}

void DeSpawnBrute(string &in asParent, string &in asChild, int alState)

{    

SetEntityActive("brute", false);    

StopMusic(1.0f, 0);    

SetMessage("SetMessage", "SM_MaloGone", 0);

}

void BruteWalk(string &in asParent, string &in asChild, int alState)

{    

SetEntityActive("bruteoutside", true);    

PlaySoundAtEntity("", "notice.snt", "bruteoutside", 0, false);

PlayMusic("search_brute.ogg", true, 0.8f, 0, 0, true);    

AddEnemyPatrolNode("bruteoutside", "PathNodeArea_12", 0.1f, "");    

AddEnemyPatrolNode("bruteoutside", "PathNodeArea_13", 0.1f, "");    

AddEnemyPatrolNode("bruteoutside", "PathNodeArea_14", 0.1f, "");    

AddEnemyPatrolNode("bruteoutside", "PathNodeArea_15", 0.1f, "");    

AddEnemyPatrolNode("bruteoutside", "PathNodeArea_16", 0.1f, "");    

AddEnemyPatrolNode("bruteoutside", "PathNodeArea_17", 0.1f, "");

}

void OnEnter(){

}

void OnLeave(){

} 
Thast honestley, would not change a thing/
It did for me.


(03-10-2012, 01:01 PM)Peldan Wrote:
(03-10-2012, 12:50 PM)pingo2 Wrote: Have u added the brute as entity?? (under the enemy tab)


And did you rename it "brute"??
Yep. Added it and placed it as inactive behind a door, and then used pathnodes. The problem isn't the enemy, though. I don't even get a debug message showing that I entered the script area.


And flamez3, let me check. I will create a new one and post again in a couple of mins.


EDIT: Nope, doesn't seem like other scripts work.
What is the name of the map and hps?




RE: Script area does not activate - Peldan - 03-10-2012

(03-10-2012, 01:21 PM)Stepper321 Wrote: What is the name of the map and hps?
second.hps and second.map


RE: Script area does not activate - flamez3 - 03-10-2012

Are you sure they are in the same folder?


RE: Script area does not activate - Peldan - 03-10-2012

(03-10-2012, 01:39 PM)flamez3 Wrote: Are you sure they are in the same folder?
Yep.


RE: Script area does not activate - flamez3 - 03-10-2012

Can you give me the layout of your folders?