Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 2 Votes - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Enemy Patroling and Disapearing: Help!
Author Message
Cocomunches Offline
Junior Member

Posts: 36
Joined: Apr 2012
Reputation: 1
Post: #1
Enemy Patroling and Disapearing: Help!

So I am pretty darn new to making Custom Stories, and I am surprised I have gotten this far and advanced into the scripting and all, but I do need some help here. Tongue

I have made a room with the following script to make a monster spawn and look for you. It works fine, but the only problem is that it just stands around. Confused

Now please don't be harsh, I am new to all of this and I could use some help!

The script for the level so far:

////////////////////////////
// Run when entering map
void OnStart()
{
SetEntityCallbackFunc("scareactive2", "OnPickup");
}
////////////////////////////
//
void OnPickup (string &in asEntity, string &in type)
{
SetEntityActive ("Monster_Grunt", true);
ShowEnemyPlayerPosition ("monster_grunt");
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}



This works fine, just need a way to make him go away.



Please, if anyone could help me out here on how I can make my monster patrol around and then disappear off to somewhere after some time. I'v tried to set pathnodes around and script it, but it never ends well and I am no expert so I can't tell what I am doing wrong here, please help out if you can! Big Grin
04-26-2012 07:46 AM
Find all posts by this user Quote this message in a reply
heyitsrobert97 Offline
Member

Posts: 68
Joined: Jan 2012
Reputation: 0
Post: #2
RE: Enemy Patroling and Disapearing: Help!

(04-26-2012 07:46 AM)Cocomunches Wrote:  ////////////////////////////
// Run when entering map
void OnStart()
{
SetEntityPlayerInteractCallback("scareactive2", "OnPickup", true);
}

void OnPickup(string &in asEntity)

{
SetEntityActive ("Monster_Grunt", true);
ShowEnemyPlayerPosition ("Monster_Grunt");

AddTimer("monsterstart", 90.0f, "byegrunt");

}

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

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

}
Remember to change the 90.0f on the timer to how long before the grunt disappears and remember its in seconds so 1.30

And You Don't Need the //////////// on anything but you can have them on the start bits only eg:
////////////////////////////
// Run when leaving map
void OnLeave()

Not Between Scripts

{
SetEntityPlayerInteractCallback("scareactive2", "OnPickup", true);
}
//////////////
void OnPickup(string &in asEntity)

This Darn House! , Four Doors, Youtube
(This post was last modified: 04-26-2012 08:01 AM by heyitsrobert97.)
04-26-2012 07:59 AM
Find all posts by this user Quote this message in a reply
Cocomunches Offline
Junior Member

Posts: 36
Joined: Apr 2012
Reputation: 1
Post: #3
RE: Enemy Patroling and Disapearing: Help!

(04-26-2012 07:59 AM)heyitsrobert97 Wrote:  
(04-26-2012 07:46 AM)Cocomunches Wrote:  ////////////////////////////
// Run when entering map
void OnStart()
{
SetEntityPlayerInteractCallback("scareactive2", "OnPickup", true);
}

void OnPickup(string &in asEntity)

{
SetEntityActive ("Monster_Grunt", true);
ShowEnemyPlayerPosition ("Monster_Grunt");

AddTimer("monsterstart", 90.0f, "byegrunt");

}

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

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

}
Remember to change the 90.0f on the timer to how long before the grunt disappears and remember its in seconds so 1.30

And You Don't Need the //////////// on anything but you can have them on the start bits only eg:
////////////////////////////
// Run when leaving map
void OnLeave()

Not Between Scripts

{
SetEntityPlayerInteractCallback("scareactive2", "OnPickup", true);
}
//////////////
void OnPickup(string &in asEntity)
I'll try it out right away! Let me see how this works. Big Grin
04-26-2012 08:01 AM
Find all posts by this user Quote this message in a reply
TeamSD Offline
Member

Posts: 51
Joined: Apr 2012
Reputation: 2
Post: #4
RE: Enemy Patroling and Disapearing: Help!

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.

04-26-2012 08:03 AM
Find all posts by this user Quote this message in a reply
Cocomunches Offline
Junior Member

Posts: 36
Joined: Apr 2012
Reputation: 1
Post: #5
RE: Enemy Patroling and Disapearing: Help!

(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.
Ah, I'll be sure to try it out. I thought you had to script it all, hehe.

But I did put some around and I didn't see him moving around.


Alright, so

////////////////////////////

// Run when entering map

void OnStart()

{

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

}



void OnPickup(string &in asEntity)


{

SetEntityActive ("Monster_Grunt", true);

ShowEnemyPlayerPosition ("Monster_Grunt");


AddTimer("monsterstart", 90.0f, "byegrunt");


}



void byegrunt(string &in asTimer)

{

SetEntityActive ("Monster_Grunt", false);

}



////////////////////////////

// Run when leaving map

void OnLeave()

{



}

Works!

Now all I need to know is how to make the monster follow the paths! so if anyone could help with this, I'd appreciate it.
(This post was last modified: 04-26-2012 08:13 AM by Cocomunches.)
04-26-2012 08:05 AM
Find all posts by this user Quote this message in a reply
TeamSD Offline
Member

Posts: 51
Joined: Apr 2012
Reputation: 2
Post: #6
RE: Enemy Patroling and Disapearing: Help!

(04-26-2012 08:05 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.
Ah, I'll be sure to try it out. I thought you had to script it all, hehe.

But I did put some around and I didn't see him moving around.
Yeah, Im not 100% sure will it work in this case. It has been a while since I last used it.Smile

Timer is a simple way to do this. I just found it myself that it can make the monster disappear in weird situations, like in front of your face.

04-26-2012 08:14 AM
Find all posts by this user Quote this message in a reply
Dutton Offline
Member

Posts: 121
Joined: Apr 2012
Reputation: 2
Post: #7
RE: Enemy Patroling and Disapearing: Help!

Scripted pathnodes for a grunt to look for you is the most effective way. If you use the ShowEnemyPlayerPosition, the monster will find you no matter where you are, for example. hiding in a clothset is useless. Therefore a set of pathnodes scripted in the HPS file should be the most effective way.

EDIT: You could eventually check this link out:
http://wiki.frictionalgames.com/hpl2/tut...rpathnodes

[Image: 15isy6C]
(This post was last modified: 04-26-2012 08:28 AM by Dutton.)
04-26-2012 08:17 AM
Find all posts by this user Quote this message in a reply
Cocomunches Offline
Junior Member

Posts: 36
Joined: Apr 2012
Reputation: 1
Post: #8
RE: Enemy Patroling and Disapearing: Help!

(04-26-2012 08:17 AM)Dutton Wrote:  Scripted pathnodes for a grunt to look for you is the most effective way. If you use the ShowEnemyPlayerPosition, the monster will find you no matter where you are, for example. hiding in a clothset is useless. Therefore a set of pathnodes scripted in the HPS file should be the most effective way.
Would you mind giving me an example of the script and what to do? I've tried before and it never really worked out.
04-26-2012 08:26 AM
Find all posts by this user Quote this message in a reply
Dutton Offline
Member

Posts: 121
Joined: Apr 2012
Reputation: 2
Post: #9
RE: Enemy Patroling and Disapearing: Help!

(04-26-2012 08:26 AM)Cocomunches Wrote:  
(04-26-2012 08:17 AM)Dutton Wrote:  Scripted pathnodes for a grunt to look for you is the most effective way. If you use the ShowEnemyPlayerPosition, the monster will find you no matter where you are, for example. hiding in a clothset is useless. Therefore a set of pathnodes scripted in the HPS file should be the most effective way.
Would you mind giving me an example of the script and what to do? I've tried before and it never really worked out.
I edited my previous reply with a link to a tutorial for the monster path nodes. check em out and tell me if you need further help Smile

[Image: 15isy6C]
04-26-2012 08:30 AM
Find all posts by this user Quote this message in a reply
Cocomunches Offline
Junior Member

Posts: 36
Joined: Apr 2012
Reputation: 1
Post: #10
RE: Enemy Patroling and Disapearing: Help!

(04-26-2012 08:30 AM)Dutton Wrote:  
(04-26-2012 08:26 AM)Cocomunches Wrote:  
(04-26-2012 08:17 AM)Dutton Wrote:  Scripted pathnodes for a grunt to look for you is the most effective way. If you use the ShowEnemyPlayerPosition, the monster will find you no matter where you are, for example. hiding in a clothset is useless. Therefore a set of pathnodes scripted in the HPS file should be the most effective way.
Would you mind giving me an example of the script and what to do? I've tried before and it never really worked out.
I edited my previous reply with a link to a tutorial for the monster path nodes. check em out and tell me if you need further help Smile
Yes, I've tried that before and it didn't really work out too well haha. I am not exactly sure where to put what and such. I always get loads of errors. Tongue
04-26-2012 08:33 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)