Frictional Games Forum (read-only)

Full Version: Interesting question, would this work?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!
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.
Wouldn't putting return in a void function cause an error? Wait nvm, I'm thinking of that in reverse.
i dont think this is related to the original question, but I cant use the glass_container on an area :\
He's not returning anything, if he placed return 1; or similar it'd give an error.