Aller au contenu

Photo

Endless Spawning (Battles)


  • Veuillez vous connecter pour répondre
13 réponses à ce sujet

#1
Megaloptus

Megaloptus
  • Members
  • 6 messages
How do I make a spawn point that spawns x number of x npc, every x seconds for x amount of time or an infinite amount of time? Also, once the npc(s) spawn, how can I make them move to a location or post? Most of this stuff is seen in the kobold demo module made by Bioware, but even after looking through the scripts I cannot figure out how to do this on my own.

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
kevL

kevL
  • Members
  • 4 070 messages
first you need something that starts the ball rolling, an "event"

what do you want that to be?

#3
Dann-J

Dann-J
  • Members
  • 3 161 messages
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.

#4
ColorsFade

ColorsFade
  • Members
  • 1 271 messages

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
kevL

kevL
  • Members
  • 4 070 messages
up to OP, i figure. I agree it's nice to have a distinctive regulator-object. ofc it can be done on any of several object and events. A guy might even want to do it on the two opposing commanders to specify win conditions ... if dead-> stop

#6
Megaloptus

Megaloptus
  • Members
  • 6 messages
There was no specific event that I wanted to kick it off with yet, I just wanted to experiment and create one that starts whenever you load up the module. I appreciate everyone's help infinitely. Although some of this sounds perplexing to me. What DannJ said I can somewhat understand how that would work, but I have no idea how to do it.

#7
Megaloptus

Megaloptus
  • Members
  • 6 messages

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_*

Guest_Iveforgotmypassword_*
  • Guests
I'm not sure but if you make your creature that you're going to spawn and give them an individual tag then right click them and select create waypoint then move the waypoint to where you want them to move to when they spawn they might walk there. I've never done it but it could work and is very simple.

#9
kevL

kevL
  • Members
  • 4 070 messages
i'm interested in this; mass battle was one of the first things i set up in NwN.

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).

Megaloptus wrote...
I just wanted to experiment and create one that starts whenever you load up the module.

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.

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
Tchos

Tchos
  • Members
  • 5 072 messages
I think you might like to try the Legends Spawn plugin.  It's user-friendly and has video tutorials for spawning creatures in the way you describe.

http://www.nwn2legen...s-spawn-plugin/

#11
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
First of all, to keep it simple, just write a script that spawns a new wave of enemies, no more than a dozen or so. Then all you have to do is call that script with ExecuteScript from whatever timer or trigger you set up.

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
Megaloptus

Megaloptus
  • Members
  • 6 messages
I've made a horrible horrible mistake. This was meant for the NwN1 toolset D: i'm sorry for wasting everyone's time, I'll have to repost this in the correct forum. And if anyone can tailor their instructions to the NwN1 Toolset, it'd be much appreciated.

#13
kevL

kevL
  • Members
  • 4 070 messages
that's ok, but the toolsets are too different.

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
Megaloptus

Megaloptus
  • Members
  • 6 messages
I appreciate the help so much, I've never seen such quick responses on a forum before. Ill keep this thread handy in case I start using the nwn2 toolset. Right now nwn1 toolset is way easier to use for me.