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 Spawning and Pathing Question
rybray Offline
Junior Member

Posts: 31
Threads: 9
Joined: Aug 2011
Reputation: 1
#1
Monster Spawning and Pathing Question

First I want to thank the forum for bein' so helpful, I have posted many questions in the past days and really appreciate the advice.

I have my code set up so that when I pick up a key, a monster should spawn. The monster "servant_grunt_1" is set as inactive in the editor, and I think I have the code right, as he follows the commands to look for me along the nodes and dissipates into smoke when he comes too close. The problem is, search_grunt_ogg is playing before I pick up the key. I tried disabling him in the OnStart function, but that didn't work. Is there a script function equivalent that I could not find?

-Also, just a side question, I put path nodes in the spawn monster function, but also wanted to test the ShowEnemyPlayerPosition function. I tried it with and without the pathnode activations in the monster spawn function, and both times no monster spawned. Whats up with that?


void OnStart()
{FadeOut(0);
AddTimer("IntroTimer", 1, "Intro");
AddEntityCollideCallback("Player", "Door_Script", "DoorOpen", true, 1);
AddEntityCollideCallback("Player", "script_memento", "Memento", true, 1);
AddEntityCollideCallback("Player", "memento_complete", "FinishMemento", true, 1);
AddEntityCollideCallback("servant_grunt_1", "hallu_script", "SetHallu", true, 1);
SetEntityPlayerInteractCallback("key_of_death", "SpawnMonster", true);
StartPlayerLookAt("AreaLookAt", 0.1f, 0.1f, "");
AddTimer("donelook", 10.0f, "TimerDoneLookAt");
}

void SetHallu(string &in asParent, string &in asChild, int alState)
{
SetEnemyIsHallucination("servant_grunt_1", true);
}

void SpawnMonster(string &in asEntity)
{
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", 4, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 4, "");
}
08-13-2011, 03:29 AM
Find
Phoroneus Offline
Member

Posts: 141
Threads: 12
Joined: Feb 2011
Reputation: 0
#2
RE: Monster Spawning and Pathing Question

All pathnodes will be recognized by all monsters (except Infected enemies converted from Penumbra, who don't follow pathnodes last I checked). You only need to activate the ends of the path, as long as you have a bunch of nodes between the monster and his destination (usually a triangular, square, or hexagonal grid does the trick, and lets him navigate around any obstacles you drop in his way). I'd set the monster's properties in the level editor (inactive, hallucination, etc) and skip the lines of code, then give it a try.

Add a debug message to SpawnMonster:
AddDebugMessage(<message>, false);
(the "false" will let it continue to be triggered in case something is accidentally setting it off - setting "true" will only allow one instance of the message to appear on the screen at a time) and see when or if it goes off. If it's triggered before you even touch the keys, look for any other references to it in your code.

Without seeing the rest of the .hps, I'm not sure whether anything else is set to trigger it. Redundant "inactive" states have occasionally canceled each other out in my experience, though, so do that first (remove the "set inactive" line from your .hps and just set the entity inactive in the level editor).

If you're going to ShowEnemyPlayerPosition, you may need to wait until the monster has been spawned for a moment before activating it. I'm not positive on that one (I haven't had any difficulties with it yet).

[Image: at_9365860.png]

Follow Harvest.
08-14-2011, 05:46 AM
Find
rybray Offline
Junior Member

Posts: 31
Threads: 9
Joined: Aug 2011
Reputation: 1
#3
RE: Monster Spawning and Pathing Question

Thanks for the tip on ShowEnemyPlayerPosition (and I didn't know you could set enemies to be hallucinations in the editor). I tried using the debug message, but for whatever reason it wouldn't show up. I checked the sounds playing box before I interacted with the spawn_monster entity but the the grunt search sound is playing... which is strange since he doesn't exist til I pick the key up. I am going to continue searching the web for a solution.
Sorry for making a double post but... just out of curiosity I deleted all the script that related to the monster at all... and I removed the monster from the editor completely... and the grunt_search music is still playing! I am totally stumped. I don't have any scripts regarding music or any music entities in the map editor, I have specified none whatsoever and yet I am getting music for a monster that isn't even in the map. What would you suggest I do, besides cry myself to sleep?
(This post was last modified: 08-14-2011, 06:03 PM by rybray.)
08-14-2011, 05:44 PM
Find




Users browsing this thread: 1 Guest(s)