Frictional Games Forum (read-only)
No script working on my custom story *SOLVED* - 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: No script working on my custom story *SOLVED* (/thread-15997.html)



No script working on my custom story *SOLVED* - modoscar - 06-09-2012

No script i've tried works when i try them on my custom map and i have looked everywhere without finding any answers.
Example of a script: An inactive monster should become active when some oil gets picked up,

"monster_oil" is the item that should activate the monster servant_brute_1, (they have the same name in the script and in the map)


void OnStart()
{

SetEntityPlayerInteractCallback("monster_oil", "Spawn_Monster", true);

}

void Spawn_Monster(string &in entity)
{

SetEntityActive("servant_brute_1", true);

}

My .map and .hps file has the same name. And is in the "maps" file. All help is appreciated!


RE: No script working on my custom story - Datguy5 - 06-09-2012

Try this:

void OnStart()
{

SetEntityCallbackFunc("monster_oil", "OnPickup");

}


void OnPickup(string &in asEntity, string &in type)
{

SetEntityActive("servant_brute_1", true);

}

I hope this explains something.

void SetEntityCallbackFunc(string& asName, string& asCallback);
Calls a function when the player interacts with a certain entity.
Callback
syntax: void MyFunc(string &in asEntity, string &in
type)

Type depends on entity type and includes: “OnPickup”,
“Break”, “OnIgnite”, etc


RE: No script working on my custom story - modoscar - 06-09-2012

(06-09-2012, 05:30 PM)Datguy5 Wrote: Try this:

void OnStart()
{

SetEntityCallbackFunc("monster_oil", "OnPickup");

}


void OnPickup(string &in asEntity, string &in type)
{

SetEntityActive("servant_brute_1", true);

}

I hope this explains something.

void SetEntityCallbackFunc(string& asName, string& asCallback);
Calls a function when the player interacts with a certain entity.
Callback
syntax: void MyFunc(string &in asEntity, string &in
type)

Type depends on entity type and includes: “OnPickup”,
“Break”, “OnIgnite”, etc
I tried that and still nothing happens when i pickup the oil, i dont think it's script that there's something wrong with. Its like the game ignores the script, i've tried several basic scripts, like spawning with a lantern in the inventory and even that wont work.

:EDIT: I had forgotten to save as "all types" and i changed that and i just SH*T myself cause ur script worked and i got punched in the face! Thanks! Big Grin


RE: No script working on my custom story *SOLVED* - Datguy5 - 06-09-2012

Np,glad i could help Smile