Frictional Games Forum (read-only)
Global function works now! No more help necessary! - 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: Global function works now! No more help necessary! (/thread-12034.html)



Global function works now! No more help necessary! - Statyk - 12-23-2011

**
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...


RE: Global function not working quite right - Unearthlybrutal - 12-23-2011

As far as I know, doors cannot be deactivated


RE: Global function not working quite right - Statyk - 12-23-2011

(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.


RE: Global function not working quite right - Unearthlybrutal - 12-23-2011

(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


RE: Global function works now! MUAHAHAHAHAHAHAHAAAAA XD - Your Computer - 12-23-2011

(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?


RE: Global function works now! MUAHAHAHAHAHAHAHAAAAA XD - Statyk - 12-23-2011

I figured the title basically says it was fixed =\

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