Spawning a random group within a random group with NESS (change the thread name to fit the solution)
Quilistan
Member Posts: 186
Let me start by saying I can script, but I typically have NO IDEA what I am doing when I do it. With Lots of trial and error a get stuff done
So I have been wanting for a long while to enable the NESS Spawn System to handle Random Encounters. Loudent helped me do one for NWN2, but I have long lost that PW module. Not to mention it was a complex and clunky (though it was also pretty darn cool).
In NWNee using variables on spawn waypoints, I have been successful in getting this to work over server resets. The spawn script selects the Tag of the spawn point from strings on the waypoint its self, and then runs the spawn.
The issue is that the NESS system will "lock in" the creature type chosen on the first spawn and won't release it, so that the server MUST be reset for it to randomize it's choice again.
Is it possible to "reset an area to default" via scripting?
I do understand that this would also reset some things within the system as far as timers and what not. With a delay on the area reset, I think it would work fine though.
any help would be great!
So I have been wanting for a long while to enable the NESS Spawn System to handle Random Encounters. Loudent helped me do one for NWN2, but I have long lost that PW module. Not to mention it was a complex and clunky (though it was also pretty darn cool).
In NWNee using variables on spawn waypoints, I have been successful in getting this to work over server resets. The spawn script selects the Tag of the spawn point from strings on the waypoint its self, and then runs the spawn.
The issue is that the NESS system will "lock in" the creature type chosen on the first spawn and won't release it, so that the server MUST be reset for it to randomize it's choice again.
Is it possible to "reset an area to default" via scripting?
I do understand that this would also reset some things within the system as far as timers and what not. With a delay on the area reset, I think it would work fine though.
any help would be great!
Post edited by Quilistan on
0
Comments
Would you be willing to send me an example?
It was a long while ago, but I remember having an issue with spawn groups and what I was trying to do.
My example spawns five random critters the following group out of eigth defined the script "spawn_cfg_group":
case 1: select all spawns from "group_orc" tables,
case 2: select all spawns from "group_bandit" tables,
case 3: select all spawns from "group_bugbear" tables
then being able to clear or reset after a period of time, to create a randomness of enemy type for that area. One time you travel there you get orc, the next bandits, making travel a bit more unpredictable.
With a large amount of help from Loudent2, I had something similar figured out in NWN2, but do to a HD crash I lost most of that work. We had to used multiple flags to do it, I remember that.
I am trying to piece it back together in my head. Any idea are appreciated, or it this possible with any new functions/script stuff that Beamdog has added? I am NOT a programmer, I stumble around a lot to get the scripting done that I need. So help is much appreciated.
What lines of script onEnter onExit are needed to set a Spawn Point active or inactive?
// Huge Pine
if (sTemplate == "HugePine")
{
if (nMonth < 3 || nMonth == 12)
switch(d2(1))
{
case 1:sRetTemplate = "zep_pinetr13"; break;
}
else if (nMonth >= 3 && nMonth < 12)
//case 2:
switch(d2(1))
{
case 1:
sRetTemplate = "zep_pinetr12";
break;
}
}
What this does is for the the months 3-11, the green pine tree is spawned in. In months 1,2, and 12 the snowy pine is spawned. This can be done with creatures and items as well. It is also possible to use nDay in stead of nMonth to get different spawns on different days.
Yeah, your snippet will spawn the right tree for the right season. You are using a switch/case without a second case, which could be deleted...
The right tweak for him could be...
How do I verify the waypoint is in the area? or get the waypoint from a specific area?
Then on the spawn waypoint I set variable strings with the blueprints
BaseTag1 string goblin
BaseTag2 string orc
BaseTag3 string bandit
BaseTag4 string kobold
onExit Script:
I think currently the onExit is grabbing a waypoint from a different area that has the same blueprint. I need to be able to verify it is the way point in the specific area.
I am trying this with single creatures at the moment, but I think if it works it will work with groups.
hopefully in embedded the script correctly......
Instead I would add the area tag/resref to the tag, so you could get the right one. If more than one is placed in this specific area, then add another string, like '_a' for the first, and so on.
I tested it with unique blueprints just to make sure, but I fear that NESS won't let go of the tag once it has fired. If one could get NESS to recheck the tag of the spawn point it would work. I am not sure if that is possible.
I'll look into the scripts again in the evening (actually it is four o'clock here in my time zone).
Edit:
As I described earlier, I would rather add some code to the spawn_cfg_group.nss. I didn't tested it, but I think that should do the trick?
I had to add the SetLocalInt(oSpawn, "Turn", d4(1)); otherwise it was doing nothing. I was also trying the delay deleting the Int to see if that helped, here it didn't.
In this one it is picking from ONE group only like I would like, but it picks the same group EVERY single time over a server reset. It can be random between server resets (although it really does like to roll a 3, lol )
any ideas?
And I hadn't thought about a second problem that could occour (you already found them)...
If you change your code from the first snippet it should work now as you want.
Question: Does this spawn them in a sequential pattern? or random? if it is random I am failing to understand how? (I like random because I play on my server, and random keeps me guessing instead of knowing patterns.)
1 round was 3 kobolds
2 round was 2 kobolds 2 minotaur (I would like this to not happen)
3 round was 4 minotaur
4 round was 3 minotaur (I had a previous one dominated)
5 round was 3 minotaur (I had a previous one dominated)
6 round was 4 minotaur
7 round was 4 minotaur
seems to get stuck or something?
Though I have only done 1 small test, it is the first one to work completely correct.
Edit: I tested with 2 spawn points in the same area, and they are working perfect also.
SP_IS1_SG_SN04_SA_SD03_CD90T1R7
spawning all 4 of the same group
and spawning each group randomly, so getting all Orcs, or goblins, or minotaur, or kobold!
Is there anything wrong with doing it this way, or is something not needed?
I would at least delete this line:
DelayCommand(30.1, DeleteLocalInt(oSpawn, "Group"));
You are setting Group already to 0. So you leave the variable on the spawnpoint, but reset it.
I just took a character and traveled one of the Trade Routes on my PW (Balarand). I had 3 random encounters: Gnolls (archer, witch, and fighters) attacked me near a ruined watch tower, and later on I ran into a pack of wolves ( 3 regular, 2 Dire, and 1 Pack Leader). Next, I was then waylaid by bandits (archers, footmen, and sorcerers). All perfectly handled by NESS!
The next time I travel the road it will be completely different!
With more intricate Dice rolls like d100(), I should be able add some rare encounters.
Needless to say I am excited..... Once again thank you!
Sorry how did you get placables to work within a Spawn Group?