Help With Bomb Script

Post » Thu Jun 21, 2012 5:24 am

Hey can someone please help me? :)

I am making a bomb spell that when you hit a target it spawns a bomb next to them.
In 5 seconds it is supposed to explode and the bomb is removed.

How do I cast the spell or make the effect happen on the bomb I summoned?

I have tried .cast but the reference type only works if I have player in it but I don't want the spell to originate from the player because the bomb is supposed to be allowed to be used remotely. (when the player is in another room)


Here is the code if it helps:



Scriptname PhenderixBombScript extends ActiveMagicEffect

float property howLong auto
Spell property explosionSpell auto
ObjectReference property bomb auto
ObjectReference property resetPoint auto


Event OnEffectStart(Actor akTarget, Actor akCaster)

Form blockForm = Game.GetForm(0x0003E225)
float xOriginal = akCaster.x
float yOriginal = akCaster.y
float zOriginal = akCaster.z

ObjectReference blockPlaced = akTarget.PlaceAtMe(blockForm)
Debug.MessageBox("Bomb placed.")

Utility.wait(howLong)
explosionSpell .cast(blockPlaced, blockPlaced) ;THIS IS THE PROBLEM LINE, nothing happens. If I change the first blockplaced to the player then it works but the player has to have line of site. (I am using an empty projectile)
Debug.MessageBox("Bomb has exploded.")
blockPlaced.moveTo(resetPoint)

EndEvent



Thanks,
phenderix
User avatar
aisha jamil
 
Posts: 3436
Joined: Sun Jul 02, 2006 11:54 am

Post » Thu Jun 21, 2012 11:15 am

Try it with only one blockPlaced. It should fire the spell, and if it is a self targeted spell like I think it is, it should work.

The other option is to go to your blockForm and attach a script to it that causes it to fill an alias OnLoad. Then go to the alias, and put a script that OnUpdate casts explosionspell on self. Then make a detonator spell that updates the appropriate alias.
User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Thu Jun 21, 2012 1:45 pm

Thanks for the help! The only one blockPlaced works!

Now for some reason the explosion doesn't do any damage - trying to figure out why XD
User avatar
Lynne Hinton
 
Posts: 3388
Joined: Wed Nov 15, 2006 4:24 am

Post » Thu Jun 21, 2012 9:51 am

Glad to help, I actually used your spell mod in my Mage run through. The ice spells were way OP but a lot of fun.
User avatar
Paula Ramos
 
Posts: 3384
Joined: Sun Jul 16, 2006 5:43 am


Return to V - Skyrim