Frictional Games Forum (read-only)
Interesting question, would this work? - 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: Interesting question, would this work? (/thread-9168.html)



Interesting question, would this work? - SLAMnesia - 07-16-2011

I have an item "glass_container" that I would like to have usable on more than one entity in a level. heres the script:
void OnStart ()
{
AddUseItemCallback("", "glass_jar", "thing1", "Funk01", false);
}

void Funk01(string &in asItem, string &in asEntity)
{
RemoveItem("glass_jar");
//other stuff
}

How do I get more than one entity named "thing1" for this to work? Or, do I need to make a bunch of callbacks like:
{
AddUseItemCallback("", "glass_jar", "thing1", "Funk01", false);
AddUseItemCallback("", "glass_jar", "thing2", "Funk03", false);
AddUseItemCallback("", "glass_jar", "thing3", "Funk03", false);
}
for each entity I want usable? halp!


RE: Interesting question, would this work? - Tanshaydar - 07-16-2011

If every function does same thing, just call same function. If every function does different thing, you can create different functions or in one function like this:

if(asEntity == "thing1")
{
do this;
return;
}

if(asEntity == "thing2")
{
do this;
return;
}

if(asEntity == "thing3")
{
do this;
return;
}

etc.


RE: Interesting question, would this work? - DamnNoHtml - 07-16-2011

Wouldn't putting return in a void function cause an error? Wait nvm, I'm thinking of that in reverse.


RE: Interesting question, would this work? - SLAMnesia - 07-16-2011

i dont think this is related to the original question, but I cant use the glass_container on an area :\


RE: Interesting question, would this work? - nemesis567 - 07-16-2011

He's not returning anything, if he placed return 1; or similar it'd give an error.