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


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

Posts: 435
Joined: Dec 2012
Reputation: 23
Post: #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 all posts by this user Quote this message in a reply
FlawlessHappiness Offline
Posting Freak

Posts: 3,982
Joined: Mar 2012
Reputation: 171
Post: #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?

Being happy is the first step to success.
06-18-2017 08:33 PM
Find all posts by this user Quote this message in a reply
AGP Offline
Senior Member

Posts: 435
Joined: Dec 2012
Reputation: 23
Post: #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 all posts by this user Quote this message in a reply
Mudbill Offline
Posting Freak

Posts: 3,525
Joined: Apr 2013
Reputation: 166
Post: #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 all posts by this user Quote this message in a reply
AGP Offline
Senior Member

Posts: 435
Joined: Dec 2012
Reputation: 23
Post: #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 all posts by this user Quote this message in a reply
FlawlessHappiness Offline
Posting Freak

Posts: 3,982
Joined: Mar 2012
Reputation: 171
Post: #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.

Being happy is the first step to success.
06-19-2017 04:54 PM
Find all posts by this user Quote this message in a reply
Romulator Offline
G'day mate! :3

Posts: 3,446
Joined: Jan 2013
Reputation: 190
Post: #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#4942
06-20-2017 07:03 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)