Swarm of Insects

Post » Wed Jun 20, 2012 9:41 pm

I want to make a spell that creates a swarm of insects in a 30 foot radius around the caster, and basically prevents anyone else from using magic within the area. I have no idea how to do either of these things.

The silence effect I think there might be something for, as I think there is a silence illusion spell.

Here's what I've got so far with the swarm spell:
Scriptname DnDSwarmCurseScript extends activemagiceffect  import Critterimport Utilityint property iMaxCritterCount autoint property iCurrentCritterCount autoFormList Property CritterTypes autoActivator Property DnDSwarmBug autoint property fMaxPLayerDistance autoevent OnEffectStart(Actor akTarget, Actor akCaster); How many do we need to spawn?int icrittersToSpawn = iMaxCritterCount; Create that many crittersint i = 0;while (i < icrittersToSpawn); Create one critter at a time;SpawnCritteratRef(akCaster as ObjectReference)ObjectReference critterRef = akCaster.PlaceAtMe(Game.GetForm(0x020048AD), 1, false, false); Wait a bit before the next spawn;Wait(fFastSpawnInterval); Nexti = i + 1endWhileDebug.MessageBox("generation complete")endEvent; Spawns one Critter at a specific locationFunction SpawnCritterAtRef(ObjectReference arSpawnRef); Pick a random critter typeActivator critterType = CritterTypes.GetAt(RandomInt(0, CritterTypes.GetSize() - 1)) as Activator; Create the critter and cast it to the critter base classObjectReference critterRef = arSpawnRef.PlaceAtMe(critterType, 1, true, false);Critter thecritter = critterRef as Critter; Set initial variables on the critter; ;  Debug.TraceConditional("Spawner " + self + " is creating Critter " + thecritter, bPrintDebug);endFunction

Its some manipulated gamesas code. Unfortunately, I it doesn't seem to actually do anything in game. I've no idea why...
Maybe one of you can spot my error?
User avatar
Gaelle Courant
 
Posts: 3465
Joined: Fri Apr 06, 2007 11:06 pm

Post » Thu Jun 21, 2012 12:35 am

At first glance I think it is your PlaceAtMe function. The last parameter you have set to true which is telling it to set the object to disabled. Try either setting that parameter to false or have your script enable the critter at some point.
User avatar
Lauren Graves
 
Posts: 3343
Joined: Fri Aug 04, 2006 6:03 pm

Post » Wed Jun 20, 2012 11:57 pm

Thanks, but that didn't seem to do it. Setting it to false made no visible difference, although it is helpful in the long run.
User avatar
Breautiful
 
Posts: 3539
Joined: Tue Jan 16, 2007 6:51 am

Post » Thu Jun 21, 2012 12:24 am

Okay, I got this working, but it just makes a bee wherever the player is. Can I make it such that the bees start moving randomly very fast whenever they load?
User avatar
kirsty williams
 
Posts: 3509
Joined: Sun Oct 08, 2006 5:56 am

Post » Thu Jun 21, 2012 9:52 am

I figured it out, on the bee themselves I added this script:

Scriptname DnDBeeSwarmingScript extends ObjectReference int Property duration autoevent OnLoad()   int i = 0   int randomx = 0   int randomy = 0   int randomz = 0while i < duration   randomx = Utility.RandomInt(-50, 50)   randomy = Utility.RandomInt(-50, 50)   randomz = Utility.RandomInt(-50, 50)   randomx = randomx + self.GetPositionX() as int   randomy = randomy + self.GetPositionY() as int   randomz = randomz + self.GetPositionZ() as int   self.SplineTranslateTo(randomX, randomY, randomZ, 0, 0, 0, 5, 350)   Utility.Wait(1)   i = i + 1endwhileSelf.disable()endEvent
User avatar
Liv Brown
 
Posts: 3358
Joined: Wed Jan 31, 2007 11:44 pm


Return to V - Skyrim