The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Monster disappears after loop
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#1
Monster disappears after loop

Now, let me say that I'm sure this is really simple and I have just done something silly in my code :3

Quite simply, there is a long corridor with a few rooms on each side allowing you to hide if you are quick enough to get inbetween each one. In this corridor, I have 12 pathnodes for 1 monster, which I want to continuously walk up and down the corridor.

I can get him to the 12th, then back to the 1st, but when he gets back to the 12th, he disappears.

This is my code:
void OnStart()
    {
        AddEntityCollideCallback("Player", "ScriptArea_1", "monsterspawn", true, 1);
    }
void monsterspawn(string &in asParent, string &in asChild, int alState)
    {
    SetEntityActive("servant_grunt_1", true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 4, "");
    for (int i = 1; i < 13; i++)
            {
                AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_"+i, 0, "");
            }
    }

Of course, I'm nowhere near finished on my CS, this is the first level xP but its not my first, and I'm always looking for improvement.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 03-02-2013, 11:24 AM by Romulator.)
03-01-2013, 03:46 PM
Find


Messages In This Thread
Monster disappears after loop - by Romulator - 03-01-2013, 03:46 PM
RE: Monster disappears after loop - by ghostelom - 03-01-2013, 03:49 PM
RE: Monster disappears after loop - by Romulator - 03-01-2013, 03:51 PM
RE: Monster disappears after loop - by Adrianis - 03-01-2013, 08:02 PM
RE: Monster disappears after loop - by Romulator - 03-02-2013, 03:30 AM



Users browsing this thread: 1 Guest(s)