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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Event: Player seeing monster will stop player moving.
Fearlessagent Offline
Junior Member

Posts: 12
Threads: 2
Joined: Jul 2012
Reputation: 1
#4
RE: Event: Player seeing monster will stop player moving.

Use This:

void OnStart()
    {
        AddEntityCollideCallback("Player", "scary_monster", "MonsterFunction", true, 1);
    }

void MonsterFunction(string &in asParent, string &in asChild, int alState)
    {
        SetEntityActive("servant_grunt_1", true);
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
        StartPlayerLookAt("servant_grunt_1", 6.0, 6.0, "");
        AddTimer("", 3.0f, "StopLook");
        SetPlayerActive(false);
        SetMessage("Messages", "Message4", 4);
    }

void StopLook(string &in asTimer)
    {
        StopPlayerLookAt();
    }

Both of your original callbacks were of the same interaction, the player colliding with the entity scary_monster. Since you set callback removal when it is triggered:

AddEntityCollideCallback("Player", "scary_monster", "MonsterFunction", true, 1);

it will only call the first, then immediately disable the callback for both. Not sure why it does this, but I had the same issue when I wanted to have a function activate multiple times since I had some conditional statements. The solution for me was setting the option I bolded to false.

You can fix your code easily like I did above by combining the two functions.
(This post was last modified: 07-07-2012, 05:50 AM by Fearlessagent.)
07-07-2012, 05:49 AM
Find


Messages In This Thread
RE: Event: Player seeing monster will stop player moving. - by Fearlessagent - 07-07-2012, 05:49 AM



Users browsing this thread: 1 Guest(s)