RedMser
Junior Member
Posts: 40
Threads: 12
Joined: Mar 2012
Reputation:
1
|
Patrol Nodes don't work on spawned enemy
Again here with a problem! So I am making a scripted survival map and it doesn't seem me to add patrol nodes to a n enemy that I spawn with a function. Here is the script part:
....................... CreateEntityAtArea("servant_grunt", "servant_grunt.ent", "ScriptArea_2", false); CreateParticleSystemAtEntity("", "ps_ghost_release.ps", "ScriptArea_2", false); switch(GetLocalVarInt("var_room")) { case 1: AddDebugMessage("Going to Room 1", false); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_1", RandFloat(1,2), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_2", RandFloat(1,2), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_17", RandFloat(1,2), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_16", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_15", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_10", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_75", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_54", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_48", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_49", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_51", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_52", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_53", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_51", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_49", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_50", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_47", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_45", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_46", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_54", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_48", RandFloat(3,8), ""); AddEnemyPatrolNode("servant_grunt", "PathNodeArea_75", RandFloat(3,8), ""); break;.............
The dots is continuing script that isn't relevant.
So it shows me the debug message it just doesn't go to the patrol nodes.
Someone knows what is up with that?
|
|
04-10-2012, 08:13 PM |
|
Putmalk
Senior Member
Posts: 290
Threads: 13
Joined: Apr 2012
Reputation:
15
|
RE: Patrol Nodes don't work on spawned enemy
Can you please format the code so that it is readable? Right now I'm not going to attempt to read it, it's all over the place.
|
|
04-10-2012, 08:19 PM |
|
RedMser
Junior Member
Posts: 40
Threads: 12
Joined: Mar 2012
Reputation:
1
|
RE: Patrol Nodes don't work on spawned enemy
Oh sorry, didn't see that. Damn, code.
CreateEntityAtArea("servant_grunt", "servant_grunt.ent", "ScriptArea_2", false);
CreateParticleSystemAtEntity("", "ps_ghost_release.ps", "ScriptArea_2", false);
switch(GetLocalVarInt("var_room")) {
case 1:
AddDebugMessage("Going to Room 1", false);
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_1", RandFloat(1,2), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_2", RandFloat(1,2), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_17", RandFloat(1,2), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_16", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_15", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_10", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_75", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_54", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_48", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_49", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_51", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_52", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_53", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_51", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_49", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_50", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_47", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_45", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_46", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_54", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_48", RandFloat(3,8), "");
AddEnemyPatrolNode("servant_grunt", "PathNodeArea_75", RandFloat(3,8), "");
break;
I hope that snippet is enough, but if needed, I submit the whole code.
|
|
04-10-2012, 08:28 PM |
|
Putmalk
Senior Member
Posts: 290
Threads: 13
Joined: Apr 2012
Reputation:
15
|
RE: Patrol Nodes don't work on spawned enemy
The whole code would be nice, as there might be an error there, too.
Actually, you said the debug message was showing, so nevermind.
1. Is there a mapcache, if so, delete it.
2. Is the grunt called "servant_grunt"?
3. Are the pathnodes correctly named?
I guess the servant is called grunt, I see you generated it via CreateEntityAtArea.
Maybe that may be an answer, try creating an enemy in the editor, setting Active off, and then using "SetEntityActive("servant_grunt", true);" in the script.
(This post was last modified: 04-10-2012, 08:34 PM by Putmalk.)
|
|
04-10-2012, 08:30 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Patrol Nodes don't work on spawned enemy
Path nodes don't work on dynamically created monsters.
|
|
04-10-2012, 08:59 PM |
|
RedMser
Junior Member
Posts: 40
Threads: 12
Joined: Mar 2012
Reputation:
1
|
RE: Patrol Nodes don't work on spawned enemy
I can't make it like that because I am making a survival map, so I need infinite enemies (it's randomly generating in later rounds). I removed the map cache and checked all names. What I could try is adding a timer to the patrol node adding... Ok it didn't work. Also, if he sees me, he can move, so he isn't stuck in the floor. Any other ideas, I really need this.
EDIT: Ok just after post I see you posted something, ok. Then I will just add a shitload of inactive monsters. Still thanks.
(This post was last modified: 04-10-2012, 09:01 PM by RedMser.)
|
|
04-10-2012, 09:01 PM |
|
Putmalk
Senior Member
Posts: 290
Threads: 13
Joined: Apr 2012
Reputation:
15
|
RE: Patrol Nodes don't work on spawned enemy
How does this work? Is it like waves and stuff? Or one continuous wave that gets increasingly harder and harder.
If it's by wave, then you do some tricky stuff. First, you can have a start area that after every round, the player fades to black, teleports to the start area, and then you can reset the positions of monsters (ResetProp MAY work for this, else you can just set them to path to the starting area). During this "intermission" when the monsters reset their places, you can randomly activate items that the player can pick up in his starting area, with different positions each time (might I suggest RandInt for this).
What I mean by that is like, presuming you have 100 "disabled" tinderboxes.
for(int i=0;i<100,i++)
ResetProp("tinderbox_"+i);
do
{
int maxitems = 0;
for(int i=0;i<100;i++)
{
activeitem = RandInt(1,100);
if(activeitem > 75)
{
maxitems++;
SetEntityActive("tinderbox_"+i, true);
}
}
}
} while(maxitems < 4);
I don't know if that would work, but the point is that every wave, if you call a function with that, it would reset the position of the tinderboxes in the starting area, and roll a random dice out of 100, and generate four random tinderboxes like that (assuming they were named "tinderbox_1", ...etc.). Also I wrote that in C++, angelscript may had do while loops differently.
|
|
04-10-2012, 09:31 PM |
|
RedMser
Junior Member
Posts: 40
Threads: 12
Joined: Mar 2012
Reputation:
1
|
RE: Patrol Nodes don't work on spawned enemy
It is like 10 waves programmed at first, and then infinitly does a random amount of monsters (like 1 grunt and 2 brutes). I might try that with reseting their postition, but maybe later. I am a bit tired right now. I will tell whenever it worked or not.
|
|
04-10-2012, 10:12 PM |
|
RedMser
Junior Member
Posts: 40
Threads: 12
Joined: Mar 2012
Reputation:
1
|
RE: Patrol Nodes don't work on spawned enemy
OK, I tried. He doesn't seem to reset his position. I will make 20 of any kind of monsters. I don't really care. But anyway, how could someone survive 20 monsters of ALL 3 KINDS? Still thanks for all help
|
|
04-11-2012, 02:37 PM |
|
|