Spawning creatures with buffs

Moderator: Event DM

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

Spawning creatures with buffs

Post by 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.

Thanks.
User avatar
Flakey
Apprentice Scholar
Posts: 788
Joined: Sun Jun 22, 2003 8:22 pm
Location: Drifting

Post by 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
Pekarion
CCC
CCC
Posts: 2177
Joined: Tue May 13, 2003 2:03 pm
Timezone: GMT+1
Location: Norway

Post by 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
Bentren Dunbarrow (Crypt Enthusiast), Sanna Armsfeldt (Swordpoint), Ashanith Esban (Shadow Magic), Terry Murkhorn (Crime), Gravesend (Stoic Brute), Jorian (Lightning Bolt!), Kedar (Hapless Blackguard), Redwyn Ironhart (Decisive Toranite)
User avatar
Deider
Demigod of Posts
Posts: 13259
Joined: Sun May 11, 2003 12:33 pm
Timezone: GMT -8
Location: California

Post by 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
CPU
Team Member; Retired with Honors
Posts: 5161
Joined: Sat Apr 05, 2003 4:27 pm
Location: NY. USA (-4GMT)

Post by 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.
dougnoel
Team Member; Retired with Honors
Posts: 6261
Joined: Fri May 14, 2004 4:59 pm
Location: VA (GMT -4)
Contact:

Post by 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.
http://nwn.bioware.com/builders/sctutorial20.html
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.

Doug
User avatar
gentry
Prince of Bloated Discourse
Posts: 245
Joined: Thu Jul 10, 2003 9:11 pm
Contact:

Post by 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: http://nwn.bioware.com/forums/viewtopic ... 8&forum=47
User avatar
Mistcaller
Team Member; Retired with Honors
Posts: 5477
Joined: Sun Feb 09, 2003 3:42 pm
Location: Athens, Greece (GMT +2)

Post by 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() 
{ 
    SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY); 
    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.
dougnoel
Team Member; Retired with Honors
Posts: 6261
Joined: Fri May 14, 2004 4:59 pm
Location: VA (GMT -4)
Contact:

Post by 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() 
{ 
    SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY); 
    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: http://www.nwnlexicon.com/compiled/cons ... _FLAG.html 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.
Post Reply