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
Path nodes ain't showing up!
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#1
Path nodes ain't showing up!

There's a grunt active, but the path nodes aren't showing up!

I'm not doing the "SetEntityActive" method, but instead I'm using the CreateEntity method because I need the grunt to keep coming from there indefinitely, not just once and then disappear. I'm using the "fade to smoke" thing to kill it, but it needs to keep coming back, and when I do "set entity active" on one that's been faded to smoke, it reappears right where it died, not where it started.

Is there any way to get it to use the pathnodes I've meticulously placed around the map???
05-30-2011, 08:56 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#2
RE: Path nodes ain't showing up!

Code please?

It is sometimes hard to make up a script from nothing... :/

05-30-2011, 10:21 PM
Find
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#3
RE: Path nodes ain't showing up!

The code isn't the problem. I can see the monster standing there, so that is working fine. In debug mode with "Show Entity Info" enabled, the path nodes normally show up when an enemy is present. They don't here, and the enemy doesn't move (state stays at "idle"). To me, this says there's something wrong with spawning an enemy via the CreateEntityAtArea function, as opposed to the SetEntityActive function. Is there any way to fix this?

If not, does anybody have any ideas as to how I can fix this? Here's the situation: I have a sort of labyrinth that is illuminated by gas torches. The gas only stays on for so long after you've pulled the lever. The monster, for whatever reason, is repelled by the light from these gas torches, and disintegrates when they're lit. Now suppose you're running through the maze, and the lights go out, now you've got to run back because the monster is coming after you now! So you run, run, run, and finally reach the lever, just as the monster reaches you. You turn around, pull the lever, and poof, the monster is gone. HERE IS THE PROBLEM: How do I spawn a new monster at the end of the maze? Simply doing SetEntityActive makes the monster appear where it disappeared, and that's obviously no good. Unless I've missed something, there doesn't appear to be any way of teleporting the monster back to the starting position.
05-31-2011, 01:40 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: Path nodes ain't showing up!

Simply place a new monster at the end of the maze and then set him unactive. When the player reaches near the end of the maze, you set the second monster active.

Simply give the monster some crazy path and then keep on calling this command:

ShowEnemyPlayerPosition("MonsterName");

05-31-2011, 04:05 AM
Find
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#5
RE: Path nodes ain't showing up!

But the monster needs to be able to disappear and reset for an indefinite number of times.

The monster is activated when the lights go out. It then runs through the maze towards the player, wherever they may be. In the event the player manages to switch the lights on before the monster can kill them, the monster disappears in a cloud of smoke. Then, the gas lights should run for a little bit before shutting off again, allowing the monster to appear again, at the end of the maze. How to do this??? If I just do SetEntityActive on the one that got smokeified, it appears where it died, not at the beginning.
05-31-2011, 04:45 AM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#6
RE: Path nodes ain't showing up!

So when doing the "CreateEntityAtArea" the enemy isn't assigned pathnodes? Might want to look out for entity naming conflicts, and checking you are assigning the right enemy the pathnodes (this will happen if enemies have the same entity name, or if your generation of unique names is not giving you the correct result). If you were to post the function from your script using this method It would be possible for us to check the code for either of the above two bugs, and others.

CreateEntityAtArea should work, so a little more information is needed.
(This post was last modified: 05-31-2011, 11:46 AM by Apjjm.)
05-31-2011, 11:45 AM
Find
laser50 Offline
Member

Posts: 242
Threads: 22
Joined: Apr 2011
Reputation: 0
#7
RE: Path nodes ain't showing up!

(05-31-2011, 04:05 AM)Kyle Wrote: ShowEnemyPlayerPosition("MonsterName");

What does that do?

05-31-2011, 12:37 PM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#8
RE: Path nodes ain't showing up!

(05-31-2011, 12:37 PM)laser50 Wrote:
(05-31-2011, 04:05 AM)Kyle Wrote: ShowEnemyPlayerPosition("MonsterName");

What does that do?
Makes the enemy "see" the player irrespective of where the player and enemy is. This can be used to force the enemy to chase after the player, e.g if the player has done some puzzle that makes a large amount of noise.
05-31-2011, 02:18 PM
Find
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#9
RE: Path nodes ain't showing up!

Here's the code:

void GasDepleted( string asTimer )
{
    SetLocalVarInt("gasOn",0);
    for(int i = 1; i <= 45; i++)
    {
        SetLampLit("gasTorch_" + i, false, true);
        FadeLightTo("gasLight_" + i, 0.0f, 0.0f, 0.0f, 1.0f, -1, 0.5f);
        SetLightFlickerActive("gasLight_" + i, false);
    }
    
    //Spawn the monster
    //SetEntityActive("mazeGrunt", true);\
    AddLocalVarInt("monsterId", 1);
    switch(GetLocalVarInt("targetArea"))
    {
        case 1:
            CreateEntityAtArea("mg" + GetLocalVarInt("monsterId"),"servant_grunt_noSound.ent","gruntSpawn",false);
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_51", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_54", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_58", 0.0f, "");
        break;
        
        case 2:
            CreateEntityAtArea("mg" + GetLocalVarInt("monsterId"),"servant_grunt_noSound.ent","gruntSpawn",false);
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_51", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_54", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_58", 0.0f, "");
        break;
        
        case 3:
            CreateEntityAtArea("mg" + GetLocalVarInt("monsterId"),"servant_grunt_noSound.ent","gruntSpawn",false);
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_120", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_51", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_54", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_58", 0.0f, "");
        break;
        
        case 4:
            CreateEntityAtArea("mg" + GetLocalVarInt("monsterId"),"servant_grunt_noSound.ent","gruntSpawn",false);
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_120", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_114", 0.0f, "");
        break;
        
        case 5:
            CreateEntityAtArea("mg" + GetLocalVarInt("monsterId"),"servant_grunt_noSound.ent","gruntSpawn",false);
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_114", 0.0f, "");
        break;
        
        case 6:
            CreateEntityAtArea("mg" + GetLocalVarInt("monsterId"),"servant_grunt_noSound.ent","gruntSpawn",false);
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_206", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_152", 0.0f, "");
        break;
        
        case 7:
            CreateEntityAtArea("mg" + GetLocalVarInt("monsterId"),"servant_grunt_noSound.ent","gruntSpawn",false);
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_152", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_120", 0.0f, "");
        break;
        
        case 8:
            CreateEntityAtArea("mg" + GetLocalVarInt("monsterId"),"servant_grunt_noSound.ent","gruntSpawn",false);
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_206", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_152", 0.0f, "");
        break;
        
        case 9:
            CreateEntityAtArea("mg" + GetLocalVarInt("monsterId"),"servant_grunt_noSound.ent","gruntSpawnAlt",false);
            ShowEnemyPlayerPosition("mg" + GetLocalVarInt("monsterId"));
        break;
        
        default:
            CreateEntityAtArea("mg" + GetLocalVarInt("monsterId"),"servant_grunt_noSound.ent","gruntSpawn",false);
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_11", 0.0f, "");
            AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_25", 0.0f, "");
        break;
    }
    
    AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_11", 0.0f, "");
    AddEnemyPatrolNode("mg" + GetLocalVarInt("monsterId"), "PathNodeArea_25", 0.0f, "");
}
06-02-2011, 04:50 AM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#10
RE: Path nodes ain't showing up!

Okay, can't see anything immediately wrong, but we can do a few improvements to the code and add a statement to check we aren't overlooking something obvious first.
void GasDepleted( string asTimer )
{
    SetLocalVarInt("gasOn",0);
    for(int i = 1; i <= 45; i++)
    {
        SetLampLit("gasTorch_" + i, false, true);
        FadeLightTo("gasLight_" + i, 0.0f, 0.0f, 0.0f, 1.0f, -1, 0.5f);
        SetLightFlickerActive("gasLight_" + i, false);
    }
    
    //Spawn the monster
    //SetEntityActive("mazeGrunt", true);\
        int mID = GetLocalVarInt("monsterId");
        string monster = "mg" + mID;
        SetLocalVarInt("monsterId",mID+1);
       CreateEntityAtArea(monster,"servant_grunt_noSound.ent","gruntSpawn",false);
//Couple of Debug Messages to verify stuff went OK.
        AddDebugMessage(monster + " exists: " + GetEntityExists(monster),false);
        AddDebugMessage( "moving to case " + GetLocalVarInt("targetArea"),false );
    switch(GetLocalVarInt("targetArea"))
    {
        case 1:
            AddEnemyPatrolNode(monster, "PathNodeArea_51", 0.0f, "");
            AddEnemyPatrolNode(monster, "PathNodeArea_54", 0.0f, "");
            AddEnemyPatrolNode(monster, "PathNodeArea_58", 0.0f, "");
        break;  
        
        case 2:         
            AddEnemyPatrolNode(monster, "PathNodeArea_51", 0.0f, "");
            AddEnemyPatrolNode(monster, "PathNodeArea_54", 0.0f, "");
            AddEnemyPatrolNode(monster, "PathNodeArea_58", 0.0f, "");
        break;
        
        case 3:         
            AddEnemyPatrolNode(monster, "PathNodeArea_120", 0.0f, "");
            AddEnemyPatrolNode(monster, "PathNodeArea_51", 0.0f, "");
            AddEnemyPatrolNode(monster "PathNodeArea_54", 0.0f, "");
            AddEnemyPatrolNode(monster, "PathNodeArea_58", 0.0f, "");
        break;
        
        case 4:
            AddEnemyPatrolNode(monster, "PathNodeArea_120", 0.0f, "");
            AddEnemyPatrolNode(monster, "PathNodeArea_114", 0.0f, "");
        break;
        
        case 5:            
            AddEnemyPatrolNode(monster, "PathNodeArea_114", 0.0f, "");
        break;
        
        case 6:
            AddEnemyPatrolNode(monster, "PathNodeArea_206", 0.0f, "");
            AddEnemyPatrolNode(monster, "PathNodeArea_152", 0.0f, "");
        break;
        
        case 7:
            AddEnemyPatrolNode(monster, "PathNodeArea_152", 0.0f, "");
            AddEnemyPatrolNode(monster, "PathNodeArea_120", 0.0f, "");
        break;
        
        case 8:
            AddEnemyPatrolNode(monster, "PathNodeArea_206", 0.0f, "");
            AddEnemyPatrolNode(monster, "PathNodeArea_152", 0.0f, "");
        break;
        
        case 9:
            ShowEnemyPlayerPosition(monster);
        break;
        
    }
     //Removed the default case, as currently it duplicates the below//
    AddEnemyPatrolNode(monster, "PathNodeArea_11", 0.0f, "");
    AddEnemyPatrolNode(monster, "PathNodeArea_25", 0.0f, "");
}
Now we know each time this routine runs we know if the monster exists & what nodes should have been added - the next step is to check if they were. This can be done using the debug menu and some options to inspect the grunt's state (I believe this is something along the lines of "show entity info" - if not check the boxes until you find the option). In this mode IIRC you can view the nodes added / active.
Most likely, the nodes will have been added. It may be possible that your nodes are too far away / obstructed from the grunt, and adding some more (just one or two nearby to the grunt for now for testing purposes) may do the trick.
(This post was last modified: 06-02-2011, 02:24 PM by Apjjm.)
06-02-2011, 02:13 PM
Find




Users browsing this thread: 3 Guest(s)