Frictional Games Forum (read-only)

Full Version: ifstate
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can anyone tell me something about ifstate coding. because it seems to me very usefull in some points. but i havent really an idea how the script works. Just a few examples would be allready great Smile
recently had a problem with that aswell
Spoiler below!

void OnStart()
{
SetEntityPlayerInteractCallback("CastleGate", "StartMap", false);
}

///CHANGEMAP
void StartMap(string &in asEntity)
{
if (HasItem("lantern") == true)
{
ChangeMap("01CastleBasement.map", "PlayerStartArea_1", "", "");
}
else
{
SetMessage("Messages", "FindItems", 4.0f);
}
}

When player interacts with "CastleGate" it then start the function StartMap. IF the player have the item "lantern" = true, then it changes map... ELSE it displays a message on screen telling you to find the items.

thats how it works in my case, but you can just switch the script around to suit what you had in mind.

Thanks Big Grin
They're calling it "a type of coding" now? Huh (It's only the nuts and bolts of every program ever.)
Yea I would have could it just "ifstate" instead of "ifstead coding". Because its no preticiliar type of coding. It is indeed something thats in every language software. But I just didnt remember the use of it anymore. I have a while ago used it in "website building part : JavaScripting". But its such a while ago that i kinda forgot Tongue