Frictional Games Forum (read-only)
[SCRIPT] A question of variables - 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] A question of variables (/thread-18065.html)



A question of variables - The chaser - 08-31-2012

Hi, forum.
Maybe I'm being heavy with all my questions, but it's just that i didn't find what i was searching, and i think that in this forum someone will know it.

How can i make this:
If you carry a hammer, wooden planks appear when crossing a script area.
If you don't (the most interesting for me) there are no wooden planks and a monster chases you.
I think it's something like:

void ASDF
{
if (HasItem)== Hammer)
{
SetEntityActive("wooden", true);
}
else
{
SetEntityActive("servant_2", true);
}
}

it says "expected expression value"
If I knew this my map should be fixed.


RE: A question of variables - GoranGaming - 08-31-2012

if(HasItem("Hammer")){
blablabla
}else{
blablabla
}


RE: A question of variables - FlawlessHappiness - 08-31-2012

Isn't it:

if(HasItem("Hammer") == true)
{

}


RE: A question of variables - GoranGaming - 08-31-2012

Oh, yes I think so


RE: A question of variables - shadowZgamerZ - 08-31-2012

The way to do this:

void OnEnter
{
AddEntityCollideCallback("Player", "AREANAME", "FUNCTIONNAME", true, 1);
}

void FUNCTIONNAME(string &in asParent, string &in aChild, int alState)
{
if(HasItem("hammer") == true)
{
SetEntityActive("wooden", true);
}
else
{
SetEntityActive("servant_2, true);
}

NOTE: Function will reactivate itself if Player reenters the map, or put the script under OnStart(). Than, script will be activated when player visits the map for its first time only.