Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function Not Calling, But Debug Message Shows Up
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#1
Function Not Calling, But Debug Message Shows Up

Okay, here is my issue:

I have a global variable script for note pick ups. It's the same script used in multiple maps. So far, it works in the first two, but not in the third. I've copied everything over exactly as it is in the others, but the functions just will not call, however the debug message does show up, so now I am majorly confused.

Why will the script work fine in the other two maps, but not this one?

I thought, maybe because this map has music already playing in the background and the others don't, but even then, wouldn't the AddPlayerSanity still call? But nothing happens except the debug message.

void NotePickUp(string &in asEntity, string &in type)
{
    AddGlobalVarInt("Notes", 1);  
  
    if(GetGlobalVarInt("Notes") == 20)
    {
        SetEntityActive("blueboy", true);
    }
    
    PlayMusic("myuu_nightmares_loop", true, 0.5f, 0.0f, 1, false);
    
    AddTimer("stoploop", 1.5f, "EndLoop");
    
    AddPlayerSanity(25);
    AddDebugMessage("DeBug", true);
}

void EndLoop(string &in asTimer)
{
    StopMusic(1.5f, 1);
}

06-18-2017, 06:39 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Function Not Calling, But Debug Message Shows Up

If the debug message calls, then the function calls.

Is it possible the AddPlayerSanity function isn't calling because the player is at maximum sanity?

Trying is the first step to success.
06-18-2017, 08:33 PM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#3
RE: Function Not Calling, But Debug Message Shows Up

So what happened was I forgot to check the initial script calling for that background music to play. For some crazy reason, I had the priority set to 10!

But still the AddPlayerSanity doesn't seem to always work, but that just might be something on my end, so for now I'll leave it as is until it comes time for playtesting, and see if it is just my end that's being weird.

06-19-2017, 05:45 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: Function Not Calling, But Debug Message Shows Up

You can try to do something like GiveSanityDamage without effects so that the player's sanity is reduced slightly before you give them the sanity boost, because like Flawless says, the effect won't show up if the player is already at max sanity.

(This post was last modified: 06-19-2017, 07:52 AM by Mudbill.)
06-19-2017, 07:51 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#5
RE: Function Not Calling, But Debug Message Shows Up

Before the AddPlayerSanity (trying to up sanity by 25), the player had "a slight headache". I'm not sure how much sanity damage that is in terms of points.

06-19-2017, 03:44 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: Function Not Calling, But Debug Message Shows Up

If you use the in-game debug menu you can enable player stats. It's probably one of the "Show _____ info".

This should display text in the upper left corner, and you should be able to locate "Sanity" in there. The number represented should be between 0 and 100, possibly with a lot of decimals.

Trying is the first step to success.
06-19-2017, 04:54 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#7
RE: Function Not Calling, But Debug Message Shows Up

(06-19-2017, 03:44 PM)AGP Wrote: Before the AddPlayerSanity (trying to up sanity by 25), the player had "a slight headache". I'm not sure how much sanity damage that is in terms of points.

>  0  < 25 ...
>= 25 < 50 Head is pounding and hands shaking
>= 50 < 75 A slight headache
>= 75      Crystal Clear

Should be these values :3

Discord: Romulator#0001
[Image: 3f6f01a904.png]
06-20-2017, 07:03 AM
Find




Users browsing this thread: 2 Guest(s)