PDA

View Full Version : MMORPG Spawner Script.


EZ_Keyno Nokey
07-04-02, 02:34 PM
Hello,

For those that are making presistant worlds, this script is a really nice setup for spawning mobs. Comes with custom spawn list you can make, easy to setup.

The useage file isnt the greatest, but I'll give the info you need to understand it with no C scripting knowledge.

Ok, to use it. In the zip there is a mod with it working, can open the mod and examine it if you like. Also included the zip is the three scripts you need, just cut and past into the script editor to compile.

The scripts should have the same name as the text file, no extention. Scripting editor will take care of the extention. So the mmorpg_sdllist.txt file cut and paste into the editor should be saved as mmorpg_sdllist.

Next create a invisable placeable name it "XXX" spawner, where XXX is, thats the name of the creatures you will be spawning. now in the TAG of the invisable placeable put this info: goblin_4_40_60_00_05_a

Goblin is the creature list I used. The creature list can be custom mobs you create or the standard mobs in the toolset.

the rest of the info is as follows:
goblin=standard toolset creatures
4= number of mobs to be spawned
40=min delay to spawn next creature in seconds
60=max delay to spawn next creature in seconds
00=min distance to spawn the next creature from another spawn.
05=max distance to spawn the next creature.
a=Unique spawner label, (example, if you have more then on spawner in the same area, then the letter should read B, C for the third and D for the forth spawner in the area and so on.)

All these varibles can be whatever you wish.
All mobs in the spawner will have seperate timers apon death.

Next,
In the invisable placeable, goto the script tab and select the mmorpg_spawner script as the OnHeartbeat script.

Placeable is all setup. Now on to the creature list.

In the mmorpg_spawnlist script you will notice this:

if (strList == "goblin") { // goblin spawner
list_add_rear_string(OBJECT_SELF,"creature_list","33:NW_GOBLINA"); // (01-33 -> Goblin)
list_add_rear_string(OBJECT_SELF,"creature_list","66:NW_GOBLINB"); // (34-66 -> Goblin)
list_add_rear_string(OBJECT_SELF,"creature_list","98:NW_GOBWIZA"); // (34-98 -> GobShaman)
list_add_rear_string(OBJECT_SELF,"creature_list","99:NW_GOBLINBOSS"); // (99-100 -> GobChief)

Info is as follows:
strList == "goblin" ... is the referance to the goblin in your invisable placeable TAG line goblin_4_40_60_00_05_a.

33,66,98,99 before the NW_GOBLINA, NW_GOBLINB, NW_GOBWIZA, NW_GOBLINBOSS. THat is the Dice roll to determine what spawns, every spawn cycle.
1-33
34-66
67-98
99-100
and so on.

This can be changed to whatever you wish as long as it doesnt overlap.

NW_GOBLINA=Goblin (Regular)
NW_GOBLINB=Goblin (Regular)
NW_GOBWIZA=Goblin (Shaman)
NW_GOBLINBOSS=Goblin (Chieftain)

These are the Toolset Blueprint tags for these mobs. To find out the blueprint tag for a mob, create a standard mob of your choosing, edit it and look at it's standard TAG. thats the blueprint tag name.

Creature list is setup. Now if you want more then one spawner in one area, you can add on to the spawn list.. look at the spawnlist in the attached mob for the example. it has two spawners working off one spawnlist, with different mobs.

Heads up, some people have had problems getting the spawner to work the first time around, this is due to some odd bug in the toolset, a workaround to this is to change the debug=0 to 1 in the mmorpg_spawner script .. run the mob once and then change the debug=1 to 0 .. then things will work normaly after that. Debug line can be found towards the middle to bottom have of the script.

Hope thats covered everything for you, if you have questions, let me know.

Special Thanks goes to Nabo at the NWN scripting forum for writing this nice script.

Script and mob zip file.
www.users.qwest.net/~keyn...script.zip

Keyno

<edit>
Forgot to mention, you can create custom mobs for the spawner list aswell. Just create a custom mob, give it a unique TAG, dont place the mob in the area just leave it in your blueprint. Put the TAG name in the spawnlist and it will spawn like a normal mob .. Edited by: Keyno Nokey at: 7/4/02 3:36:59 pm

braincandy99
07-04-02, 03:46 PM
I have a similar but different method for doing the MMORPG respawn.

Create a new creature (or make a copy of an existing creature). Edit the creature however you like, but make sure that the Blueprint ResRef and the Tag names are <u>exactly</u> the same (all lower case)

In the OnDeath Script event use the following script:

//::**********************
//::MMORPG Style Respawner
//::By: Stephan Cam
//:: Error Correcting by SPIKE
//:: June 24, 2002
//::**********************
//:: Modified by Palor
//:: - Added generic strings
//:: to allow for use on
//:: all respawns
//:: June 26, 2002
//:: Modified by Torch
//:: - Changed the spawner to be a mob, this allows the creatures to fade away and treasure to appear
//::**********************

#include "NW_I0_GENERIC"

void VoidCreateObject(string sTemplate, location lLoc, int bUseAppearAnimation=TRUE);
void main()
{


float fSeconds = 600.0; //monster spawn time
string sTemplate = GetTag(OBJECT_SELF);
string sWayPointPrefix = "WP_";
string sCurrentWaypoint = sWayPointPrefix + sTemplate;
location lLoca = GetLocation(GetObjectByTag (sCurrentWaypoint));


if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1007));
}


{
SetIsDestroyable(TRUE);
AssignCommand(GetObjectByTag("SpawnWalk"), DelayCommand(fSeconds, VoidCreateObject(sTemplate,lLoca, TRUE)));
}

}

void VoidCreateObject(string sTemplate, location lLoca, int bUseAppearAnimation=TRUE)
{
CreateObject(OBJECT_TYPE_CREATURE, sTemplate,lLoca,TRUE);
}

//****************

Now, in some area, doesn't need to be accessable by players, so you can use a 1x2 area, create a mob, give it the tag "SpawnWalk"

Finally, Place your mob with this modified script somewhere in your game. Create a waypoint that is called "WP_tagname" (replace tagname with your monster's tag/blueprint name) and place it anywhere in your world. This is the point where the mob will respawn.

You can create walking points using the standard WP_tagname_## and the mob will walk around just like any other mob.

Change the fSeconds value to various times, save scripts for each time.

EZ_Keyno Nokey
07-05-02, 08:25 PM
Braincandy,

Your method involves creating a creature for each encounter.
Which for some encounters would work great. The above script and instructions is for creating 1-100+ spawns in a single file without creating each creature before hand.. this is great for popluating a zone in one swoop.

It just pulls the mobs from the Toolset database and inserts them for you. Of course you can create custom mobs and include them on the spawn list for those rare named spawns etc. But it has cut down my mob building time in half.

The only draw back atm in the script is it doesnt include Day/Night spawn timers .. which the writer of the script is working on.

Btw, Thank you for your script .. I use it for selective mobs.

Keyno

braincandy99
07-06-02, 01:03 PM
Yeah, I guess from what I've found at least in the Local character server world, the regular monsters just don't cut it in terms of difficulty. Most of my boss mobs have a challenge rating of > 60 and some of these decked out level 20s can churn through em with reasonable safety.

Doesn't your script use the OnHeartbeat event? I looked at similar scripts and I find using that event to be worrisome (without any sufficient testing to back up my feeling) for large modules. That event triggers every 6 seconds, and if you have a lot of different encounters running off that event, I think that can be taxing on a cpu.

I didn't originate the script I posted. I made the modification of it to use a separate creature to cause the spawn. That was for the sole purpose of fixing a slight bug with loot dropping monsters.

At the point I had seen the script you posted (or one similar, forget which I saw first) I had already committed a good amount of time to my module and had been using the script I posted successfully for a few revisions.

I find that for the most part, I have to have custom creatures, both for difficulty reasons and for loot dropping. Plus, in order to even have a reasonable amount of loot dropping you need to change their on spawn script's GenerateNPCTreasure conditions, which unless you want to modify the original NWN script, requires a new script, meaning you need to have custom monsters to take advantage of it (I don't think you can change the script a standard monster uses on the call to create them).

I think your script would be great for outdoor "epic battle" encounters though, just tied to a trigger rather than the onheartbeat event. I may end up using it for that.

Torch

&lt;EDIT> You can check out the module I mentioned and this script in action in the post I made below giving the server connection details Edited by: Braincandy999 at: 7/6/02 2:09:32 pm

EZ_Keyno Nokey
07-06-02, 02:16 PM
Braincandy,

I had about 10 friends connect to my server last night, in hopes for testing out encounters and, you are so right about the trivialness the challenge. So resorted to using custom mobs for everything. As for CPU load for the script, got the first crack at testing that aswell last night. Have to say it's a well written script, 10 zones populated and server didnt even miss a beat, noticed no server lag whatsoever.

Now I know what DAOC and EQ designers went through trying to balance a world.

PS. Couldnt reach your server yesterday, been dying to take a peek. going to try again today.

Keyno

EZ_Tweil
07-11-02, 10:32 PM
I looked at both your scripts and tried yours Torch line for line. However it would never work for me. Anyways here is what I wrote, trying to get it to work:

//Spawn the next one
float fSeconds = 10.0; //monster spawn time

ActionWait(fSeconds);

//Get the Creature Type
string sTemplate = GetTag(OBJECT_SELF);

//Find the Creature's Spawn Point
string sWayPointPrefix = "SP_";
string sCurrentWaypoint = sWayPointPrefix + sTemplate;
location llocation = GetLocation(GetObjectByTag (sCurrentWaypoint));

//Now create the creature
//int intDice = Random(100); Random numbers

object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, sTemplate, llocation, FALSE);

if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
{

}


When I leave the code like above the monters spawn instantly, soon as one of those types dies another spawns at the spawn point. Also, if I put the object inside the last if nothing ever happens.

When I tried your script Torch nothing re-spawned =(

Any help would be awesome! The Napping Druid
Tweil Firestorm
Solusek Ro

braincandy99
07-11-02, 10:46 PM
the first bit of trouble I had with the script (which I did not originate, just modified) was that both the Tag of the monster (on the general tab of its properties) and the blueprint resref (on the advanced tab of its properties) have to be identical, meaning all lower case.

That is the only reason I can think of that would make the script I use not work. Without pictures there's no way for me to show it exactly.

The last if-statement is only executed if the onspawn script has it uncommented. by default it is commented.

Torch

EZ_Tweil
07-12-02, 07:10 AM
The creature does spawn though, instantly at its spawn point. The ActionWait() command does not cause any pause though. The Napping Druid
Tweil Firestorm
Solusek Ro

EZ_Keyno Nokey
07-12-02, 12:04 PM
MMORPG style multiple creature area spawner 1.1
----- ----- ----- ----- ----- ----- ----- -----
Copyright (c) 2002 by Nabo
Released : 10.07.2002

Features in 1.0:
- spawns and handles multiple creatures at the same time with just one spawn point
- creature spawn list with percentages of spawn probability (see mmorpg_spawnlist.nss for details)
- spawns creatures within a circle defined by maxdistance and mindistance with the spawn point as the center
- maximum and minimum delays between death and spawn
- spawn engine and creature lists in different files for easy updating

New Features in 1.1:
- define spawn effect per creature list
- day or night spawning (script can also kill creatures when current time is not within spawn time)
- set a standard faction per creature list
- set default facing per creature list (face next player / face north,east,south,west / face random direction)


What to do with this?
- fill your complete mmorpg graveyard with just one spawn point
- create a mmorpg city and place two spawn points with different factions in it to simulate two factions battling each other

Usage:
- Place an invisible object into an area
- Choose mmorpg_spawner as Heartbeat Event for the invisible object
- Create the TAG for the invisible object:
-> CreatureList _ NumberOfCreatures _ MinDelay_MaxDelay _ MinDistance _ Maxdistance _ UniqueCounter
e.g. : skeletons_05_10_20_00_15_a
this would create a spawner with:
- Creature list "skeletons" from mmorpg_spawnlist.nss will be used
- 5 Creatures will be spawned
- Minimum delay between death and new spawn is 10 seconds
- Maximum delay between death and new spawn is 20 seconds
- Minimum distance from spawn point is 0 (calculated by GetDistanceBetweenLocations() )
- Maximum distance from spawn point is 15 (calculated by GetDistanceBetweenLocations() )
- Unique TAG counter is "a" (this means nothing except that each TAG must be unique)
so the next spawner of the same type should have the tag:
skeletons_05_10_20_00_15_b

Mail bugs or comments to nabo@subnatural.de (german or english please).

included in zip file:
- .erf import file for scripts
- readme.txt
- mmorpg spawner test module

Download it here
http://www.subnatural.de/nabo/mmorpg_spawner_1.1.zip

Keyno