Server Totals
Mikona - (11)
Le'Or - (0)
Ferrell - (0)
Elysia - (0)
M'Chek - (0)
Deglos - (0)
Wilderness - (0)
Visimontium - (0)
Underdark - (0)
Total players: 11
  • Elysia updates
    Album name: DM Events
    Uploaded by: Ronan
    Uploaded: Fri Jun 05, 2015 3:13 am

Links Menu

Spawning creatures with buffs

Moderators: Nighthawk4, Dungeon Masters

Spawning creatures with buffs

PostAuthor: Dirk Cutlass » Tue Jun 08, 2004 8:47 am

In a test mod, I want to spawn in some creatures (actually they could be static spawns) with buffs already applied, e.g. Improved Invis, Stoneskin, etc. How do I do this? The AI seems too stupid to use these spells even though they are in their spell-books. Can I make them cast these spells when they spawn? Its only a test mod, anything quick and dirty will do.

User avatar
Dirk Cutlass
Elder Sage
Posts: 4703
Joined: Mon Jan 27, 2003 9:42 am
Location: GMT

PostAuthor: Flakey » Tue Jun 08, 2004 8:51 am

you can log on as a dm and cast the spells that way.
Minds are like parachutes, they have to be open to work.
User avatar
Apprentice Scholar
Posts: 788
Joined: Sun Jun 22, 2003 8:22 pm
Location: Drifting

PostAuthor: Pekarion » Tue Jun 08, 2004 8:58 am

that's cheatz and haxx :p you have to have that golden opportunity when they don't have anything thrown on yet, and sneak them in the back =d
Ice-T on D&D:
"Dungeons & Dragons is some of the most crazy, deep, deep, deep nerd shit ever invented. Every word you're saying is made up. Motherfuckers talk like Yoda.".
User avatar
Posts: 1767
Joined: Tue May 13, 2003 2:03 pm
Location: Norway
Timezone: GMT+1

PostAuthor: Deider » Tue Jun 08, 2004 9:14 am

This is possible. Hopefully someone more qualified than I will answer, but in the meantime, I think it involves making a custom OnSpawn script.

My suggestion would be to search the Bioware forum, especially the one for builders. This may even be in their FAQ.

*remembers to heed his own advice, since Deider's been wanting to do this for the Wi- er, for no particular reason :twisted: *
User avatar
Uber Posting Whor3
Posts: 8014
Images: 3
Joined: Sun May 11, 2003 12:33 pm
Location: California
Timezone: GMT -8

PostAuthor: CPU » Tue Jun 08, 2004 4:16 pm

Rockhome has some (nasty and painful) NPC mages that you can hear the casting start as soon as they spawn in, further down the road. You might want to check with Ferus. It's his world. He (unfortunately) knows how this is done.
User avatar
Team Member; Retired with Honors
Posts: 5163
Joined: Sat Apr 05, 2003 4:27 pm
Location: NY. USA (-4GMT)

PostAuthor: dougnoel » Tue Jun 08, 2004 5:52 pm

There are two ways to do this. Both require editing the OnSpawn script and/or UserDefined script for the creature(s) in question. The first way is to add the effects directly to the creatures. For an example of this, take a look at the default OnSpawn script for HotU. At the bottom you'll find some commented out code for applying the ghost effect to creatures.
The above Bioware tutorial might help with that.

The second is just to queue up some actions for the creatures to cast spells on themselves. This does not necessarily require them to know the spells, and is how I would approach it. Also, you can add some AI in if you want the creatures to say, cast buffs on their non-wizard friends/cannon fodder as well. This just requires use of the AssignCommand() function.

For more information on how to use UserDefined events, take a look at the HotU OnSpawn script - it's actually pretty well commented. If you would like some actual coding help (you too Deider), send me a PM and let me know exactly what you're trying to accomplish and I'll send you some code.


Team Member; Retired with Honors
Posts: 6265
Joined: Fri May 14, 2004 4:59 pm
Location: VA (GMT -4)

PostAuthor: gentry » Tue Jun 08, 2004 7:46 pm

Actually, with HotU Bioware added "Post-spawn" and "Pre-Spawn" to the OnSpawn commands. You just need to set the proper variable on the creature, and then create a UDE script for it, spelling the creature in it's Prespawn event. At least, that's my understanding, I haven't actually done it yet.

Read this for a complete explanation of this (and a bunch of new HotU scripting features: ... 8&forum=47
User avatar
Prince of Bloated Discourse
Posts: 245
Joined: Thu Jul 10, 2003 9:11 pm

PostAuthor: Mistcaller » Tue Jun 08, 2004 7:54 pm

Make a custom OnSpawn script like this:

Code: Select all
#include "x0_i0_anims"
#include "x2_inc_switches"

void main()
    ExecuteScript("nw_c2_default9", OBJECT_SELF);

This script will make the NPC start "casting" a certain order of spells when spawned. The mage will not change that order, even if attacked.
This wont automatically place the spell effects on the NPC, but rather it will force him cast them.
If you want to create the former you'll need a different and more complex custom script.
User avatar
Team Member; Retired with Honors
Posts: 5481
Joined: Sun Feb 09, 2003 3:42 pm
Location: Athens, Greece (GMT +2)

PostAuthor: dougnoel » Wed Jun 09, 2004 1:25 pm

Mistcaller wrote:Make a custom OnSpawn script like this:

Code: Select all
#include "x0_i0_anims"
#include "x2_inc_switches"

void main()
    ExecuteScript("nw_c2_default9", OBJECT_SELF);

Well neat! Yeah, definitely more than two ways. I realized you could also put calls into the OnEnter scripts for the area or module and send buff commands that way. But Mistcaller's way is much easier. :-) After reading Mistcaller's post, I looked up SetSpawnInCondition() on NWNLexicon and found a bunch of neat flags you can use: You can also see a list of them in the script editor if you click on the Variable Tab and type in NW_FLAG in the search text box. Not sure why they are in the variables list instead of constants list, as the lexicon seems to indicate they're used as constants. Regardless, there's a number of fun things you can do when spawning in creatures now with HotU. Cool.

Team Member; Retired with Honors
Posts: 6265
Joined: Fri May 14, 2004 4:59 pm
Location: VA (GMT -4)

Return to NWN Scripting

Who is online

Registered users: Bing [Bot]