Cocomunches
Junior Member
Posts: 36
Threads: 6
Joined: Apr 2012
Reputation:
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.
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.
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!
|
|
04-26-2012, 07:46 AM |
|
heyitsrobert97
Member
Posts: 68
Threads: 29
Joined: Jan 2012
Reputation:
0
|
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 post was last modified: 04-26-2012, 08:01 AM by heyitsrobert97.)
|
|
04-26-2012, 07:59 AM |
|
Cocomunches
Junior Member
Posts: 36
Threads: 6
Joined: Apr 2012
Reputation:
1
|
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.
|
|
04-26-2012, 08:01 AM |
|
TeamSD
Member
Posts: 51
Threads: 3
Joined: Apr 2012
Reputation:
2
|
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 |
|
Cocomunches
Junior Member
Posts: 36
Threads: 6
Joined: Apr 2012
Reputation:
1
|
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 |
|
TeamSD
Member
Posts: 51
Threads: 3
Joined: Apr 2012
Reputation:
2
|
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.
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 |
|
Dutton
Member
Posts: 121
Threads: 3
Joined: Apr 2012
Reputation:
2
|
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
(This post was last modified: 04-26-2012, 08:28 AM by Dutton.)
|
|
04-26-2012, 08:17 AM |
|
Cocomunches
Junior Member
Posts: 36
Threads: 6
Joined: Apr 2012
Reputation:
1
|
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 |
|
Dutton
Member
Posts: 121
Threads: 3
Joined: Apr 2012
Reputation:
2
|
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
|
|
04-26-2012, 08:30 AM |
|
Cocomunches
Junior Member
Posts: 36
Threads: 6
Joined: Apr 2012
Reputation:
1
|
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 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.
|
|
04-26-2012, 08:33 AM |
|
|