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


Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Enemy Patroling and Disapearing: Help!
Cocomunches Offline
Junior Member

Posts: 36
Threads: 6
Joined: Apr 2012
Reputation: 1
#19
RE: Enemy Patroling and Disapearing: Help!

(04-27-2012, 08:18 AM)TeamSD Wrote:
(04-27-2012, 08:02 AM)Cocomunches Wrote:
(04-27-2012, 07:56 AM)TeamSD Wrote:
(04-27-2012, 07:38 AM)Cocomunches Wrote:
(04-26-2012, 08:03 AM)TeamSD Wrote: This is just a brief help. Basically you could set unscripted pathnodes to the room where you trigger the monster/player hides. When monster arrives to the room it starts to look for the player from the place you were during activating the trigger. After herpderbing a while, monster just stands there unless there is a pathnode nearby.

Place some pathnodes out of the room and to the end of all these pathnodes set up a area where the monster disappears. For example
SetEntityActive("Monster_Grunt", false);

Note that pathnodes can work without scripting. I recall using this method in one of my earliest custom stories.
Try it out. Hope it works.
So how do path nodes work WITHOUT scripting then? I'd like to halfass it before I take time scripting, haha.
I'll save some time and link you to this thread.

http://www.frictionalgames.com/forum/thread-8794.html

It might give you the right idea what im trying to tell you. Big Grin
I am sorry, but it's not quite painting the picture of what I am suppose to do.
Basically enemies behaviour goes like this.

If you only have one (scripted) path that enemy follows he does that untilt it reaches the last one. Then it just stands there.

If the enemy sees the player in middle of that path it starts to chase the player. If player succeeds to hide, monster does not know what to do next. Probably it will just stand there or try to go through pillars or some furniture. It has no path. This is where unscripted pathnodes come to play. It takes the nearest one and starts to follow them. This avoids the situation where player is hiding in a closet and grunt is just chilling around basically making it impossible to proceed. This is a sign on bad monster setting.

So what you should do IMO is;

Script one path that the enemy follows mainly and put some unscripted pathnodes for it to find a way back to that path (in case it looses the track). So I really recommend you script some pathnodes, you just don't have to script them all.

Explaining things is never easy to me.
Perfect explanation, thank you very much! I will try it out now.


(04-26-2012, 08:34 AM)Dutton Wrote: Like what? can you be more specific?
So I tried scripting some nodes and once again unsuccessful. Now once again, let me remind you I am terrible at this and hope I don't look like too much of an idiot.

Quote: ////////////////////////////
// Run when entering map
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFuncton", True, 1);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_1", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_2", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_3", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_4", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_5", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_6", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_7", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_8", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_9", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_10", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_11", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_12", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_13", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_14", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_15", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_16", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_17", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_18", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_19", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_20", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_21", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_22", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_23", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_24", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_25", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_26", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_27", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_28", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_29", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_30", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_31", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_32", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_33", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_34", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_35", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_36", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_37", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_38", 0, "");
}

{
SetEntityPlayerInteractCallback("scareactive2", "OnPickup", true);
}

void OnPickup(string &in asEntity)
{
SetEntityActive ("Monster_Grunt", true);
ShowEnemyPlayerPosition ("Monster_Grunt");
AddTimer("monsterstart", 60.0f, "byegrunt");
}

void byegrunt(string &in asTimer)
{
SetEntityActive ("Monster_Grunt", false);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
I get the Following error and it usually leads to more and more:

Quote: FATAL ERROR: Could not load script file
'custom_stories/Lost/maps/C:/Promgram Files (x86)/Amnesia - The Dark
Descent/redist/custom_stories/Lost/Prison.hps'!
ExecuteString (1,1): Err :No matching Signatures to 'Onenter()'
Main (50,1) : ERR : Unexpected token '{'
Hope I can fix this somehow :V

I am really bad at this.

(This post was last modified: 04-27-2012, 09:19 AM by Cocomunches.)
04-27-2012, 08:21 AM
Find


Messages In This Thread
RE: Enemy Patroling and Disapearing: Help! - by Cocomunches - 04-27-2012, 08:21 AM



Users browsing this thread: 3 Guest(s)