Spawning creatures with buffs
Moderator: Event DM
- Dirk Cutlass
- Elder Sage
- Posts: 4691
- Joined: Mon Jan 27, 2003 9:42 am
- Location: GMT
Spawning creatures with buffs
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.
Thanks.
that's cheatz and haxx
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)
- Deider
- Demigod of Posts
- Posts: 13259
- Joined: Sun May 11, 2003 12:33 pm
- Timezone: GMT -8
- Location: California
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
*
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

-
- Team Member; Retired with Honors
- Posts: 6261
- Joined: Fri May 14, 2004 4:59 pm
- Location: VA (GMT -4)
- Contact:
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
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
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
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
- Mistcaller
- Team Member; Retired with Honors
- Posts: 5477
- Joined: Sun Feb 09, 2003 3:42 pm
- Location: Athens, Greece (GMT +2)
Make a custom OnSpawn script like this:
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.
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 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.
-
- Team Member; Retired with Honors
- Posts: 6261
- Joined: Fri May 14, 2004 4:59 pm
- Location: VA (GMT -4)
- Contact:
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.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); }
