Endless Spawning (Battles)
#1
Posté 29 mai 2013 - 04:00
I am not an experienced scripter at all and have been attempting to use the Script Generator to complete this task but i had trouble figuring out how to spawn multiples of something for a long period of time. Basically I want encounters, but without needing a trigger and the ability for the spawned NPCs to move to a location.
This is all for the ability to create endless battles between NPCs, which would be quite amusing. Thanks for any help that can be offered.
#2
Posté 29 mai 2013 - 04:24
what do you want that to be?
#3
Posté 29 mai 2013 - 05:43
Another way would be to use some of the functions in the ginc_group include file. Trigger the first encounter in some way, add those encounter creatures to a custom group, then have their OnDeath scripts check whether the group has been completely killed. When it has, trigger the encounter again for a second group. That would continue infinitely, unless the OnDeath script checked for a variable somewhere that stops the process.
#4
Posté 29 mai 2013 - 07:41
DannJ wrote...
An Ipoint with a heartbeat script that continuously triggers an encounter trigger would do the trick. Your time intervals would have to be multiples of six seconds though.
That would probably be the most effective way to do it.
DannJ wrote...
Another way would be to use some of the functions in the ginc_group include file. Trigger the first encounter in some way, add those encounter creatures to a custom group, then have their OnDeath scripts check whether the group has been completely killed. When it has, trigger the encounter again for a second group. That would continue infinitely, unless the OnDeath script checked for a variable somewhere that stops the process.
I do this for one of my encounters. You're faced with a bunch of enemies, but only some of them attack initially. When one of the attackers dies, the next guy "waiting" begins attacking. It works pretty well.
Judging from the OP's comments though, I think an iPoint would be the best route.
#5
Posté 29 mai 2013 - 08:10
#6
Posté 30 mai 2013 - 07:02
#7
Posté 30 mai 2013 - 07:06
DannJ wrote...
An Ipoint with a heartbeat script that continuously triggers an encounter trigger would do the trick. Your time intervals would have to be multiples of six seconds though.
Another way would be to use some of the functions in the ginc_group include file. Trigger the first encounter in some way, add those encounter creatures to a custom group, then have their OnDeath scripts check whether the group has been completely killed. When it has, trigger the encounter again for a second group. That would continue infinitely, unless the OnDeath script checked for a variable somewhere that stops the process.
For an easier reference as to what I'm not understanding, I bolded what confuses me.
Modifié par Megaloptus, 30 mai 2013 - 07:07 .
#8
Guest_Iveforgotmypassword_*
Posté 30 mai 2013 - 07:49
Guest_Iveforgotmypassword_*
#9
Posté 30 mai 2013 - 07:50
An Ipoint is a placeable object like a table, so it can do all the things a placeable can like run a heartbeat script -- but it's invisible and doesn't interfere with movement. It looks very like a waypoint when placed in the toolset.
"Groups" are a semi-advanced subsystem in NwN2. Creatures can be assigned to a Group, and when the group is eliminated more scripts can run ... A simpler alternative is spawn->delay->spawn->delay etc.
Is your intention just a single-area type module? (it can be expanded later if you want).
At face value that means you're looking for the onClientEnter event of the area. There's also an onClientEnter event for the module, but that's best left for other things. I suggest trying to minimize or narrow the scope to only what's needed.Megaloptus wrote...
I just wanted to experiment and create one that starts whenever you load up the module.
An alternative is to use the Ipoint's heartbeat event, which will begin firing at basically the same time as the area's onClientEnter. ( personally i'd be tempted to initialize things with the onClientEnter, and use the area's heartbeat to handle the ongoing spawns )
maybe someone will weigh in with pros & cons..
Question: what 'rules' do you want to govern the spawns? Have groups that when they all die new ones are created ( more scripting and I'm sure Lilac's won't handle it unless it's been updated for NwN2 ), or spawn in a new combatant each time a previous one falls? ( You really should script-from-scratch for this regardless )
#10
Posté 30 mai 2013 - 09:30
http://www.nwn2legen...s-spawn-plugin/
#11
Posté 30 mai 2013 - 12:25
Ultimately, you want your trigger mechanism to do two things, respond to the player, and not overwhelm the system with ungodly hordes of errantly spawned mooks.
The first wave of enemies is easy. If they're defending, you can just spawn them in by calling the spawn script from the Area On-enter (I like to use this instead of on-client enter, because there's no noticeable lag). For attacking enemies, if you can't rig up a conversation to get things going, then a simple trigger painted down would work as well. It's alright to surprise a player, but just try to do it when they're actually playing the game, and not dozing off waiting for a new area to load.
For subsequent waves, I like to just write a death script for the bad guys that fires off another wave when the number of hostiles drops below a certain number. Basically, you loop through all the creatures with a given tag in the area (GetObjectByTag("Tag", nTh)) and count how many are still alive. If you want the waves to arrive more regularly, then just use ExecuteScript multiple times with a delay built in, for up to, say, enough waves to put 40-50 bad guys on the screen. After that, you really want to make sure the player has managed to kill a few before you spawn more.
To be really slick with respawns, though, you need to learn how to use the ScriptHidden functions. Spawning a bunch of enemies at one time will cause a noticeable pause in the game for the player, but if you spawn them in slowly, and set them to script hidden, then the player won't notice. When the time comes, unhide the badguys, and the wave will go forward. A very simple way to do this (check out the Fort Moultrie area and Esquive scripts in the Danaan Unvanquished below for examples) is to just copy or spawn a replacement for each creature when they die, script-hidden. When the population of living and unhidden bad guys drops, then you unhide all the hidden creatures, and the battle continues.
#12
Posté 30 mai 2013 - 05:38
#13
Posté 30 mai 2013 - 06:54
no groups, onCenter, Ipoints, plugins, or scripthidden...
But you can still spawn the combatants with an area's onEnter script and then check their numbers and respawn more with the area's heartbeat
- your OP is really good. suggest copy to NwN1 forum
#14
Posté 30 mai 2013 - 07:29





Retour en haut






