Frictional Games Forum (read-only)

Full Version: Global function works now! No more help necessary!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
**
THE ISSUE IS FIXED, BUT IF YOU WOULD LIKE TO SEE HOW IT WAS FIXED, IT IS IN MY LAST RESPONSE.
**



So I'm trying a simple little global function, where a player walks into an area in one map, and it opens (removes) a door in another. The games runs, so there are no typo errors, only problem is, the door does not get removed. Yet, when I set the "SetGlobalVarInt" to 1, the door is permanently missing >> I feel so close to getting this working, yet it's not. I feel I need the if function in a separate command function... Could someone help me out here?
_____________________________________________________


global.hps
___________________

void OnGameStart()
{
SetGlobalVarInt("openlivingdoor", 1);

}



map1.hps
___________________

void OnEnter()
{
GetGlobalVarInt("openlivingdoor");
{
if(GetGlobalVarInt("openlivingdoor") == 1)
{
SetEntityActive("mansion_5", false);
}
if(GetGlobalVarInt("openlivingdoor") == 0)
{

}
}
}


map2.hps
_______________


void "hiddenname"_func(string &in asParent, string &in asChild, int alState)
{
AddGlobalVarInt("openlivingdoor", 1);
}

____________________________________________________

I hid the name of the last function because it could contain spoilers. But believe me that it is typed correctly. It is also the working function name for a script area collision with the player.

Some other details:

- The SetGlobalVarInt, when set to "1", the door remains open forever (door is set inactive)
- When it is set to "2", the door is there, but when given the command "AddGlobalVarInt("openlivingdoor", 1);", it does not disappear...
As far as I know, doors cannot be deactivated
(12-23-2011, 07:29 PM)Unearthlybrutal Wrote: [ -> ]As far as I know, doors cannot be deactivated
Of course they can. It's a swing door. If the door is disappearing on certain integers but NOT disappearing on others... It can be set inactive.

I also set it inactive in Sciophobia, so that's not the issue.
(12-23-2011, 07:33 PM)Statyk Wrote: [ -> ]
(12-23-2011, 07:29 PM)Unearthlybrutal Wrote: [ -> ]As far as I know, doors cannot be deactivated
Of course they can. It's a swing door. If the door is disappearing on certain integers but NOT disappearing on others... It can be set inactive.

I also set it inactive in Sciophobia, so that's not the issue.
I've tried a couple of times to set the door active and inactive with scripts and always failed, then I gave up.
I tried it with mansion doors, I don't know if it works with other doors Undecided
(12-23-2011, 07:04 PM)Statyk Wrote: [ -> ]- When it is set to "2", the door is there, but when given the command "AddGlobalVarInt("openlivingdoor", 1);", it does not disappear...

According to what little code you posted, at that point openlivingdoor would equal 3. So it is working as should be expected. Or am i not understanding your statement here? If you meant something else, then i would like a bigger traceback from your code; that is, showing a function that is obviously for a collision callback yet not informing us when that callback gets called is a way of leaving us in the dark. Likewise, if that AddGlobalVarInt from the collision callback is within conditional statements.

Edit: A change in title, but no other information about the issue being solved?
I figured the title basically says it was fixed =\

But no, I changed the "SetGlobalVarInt" to 0 and it works fine. =]