Jump to content

Problem with Script with Magic


Videniofthesith

Recommended Posts

Alright, I will explain better.

 

In my mod you are sent to a cave filled with creatures called the fear (ID aaafear)

The quest NPC gives you a spell (aaaLightUpTheDarkness) to use on them and tells you they are resistant to everything but Light ( Think the movie Pitch Black and/or Gremlins)

 

All the spell does, a magic spell, is cast the magic Light. That is it. Nothing else.

Only I wanted it to have a script effect to cause Fire damage as well, possibly using that attronach to show them burning. Even more so I ONLY wanted to have that spell effect the aaafear creatures, so say if you casted the spell at a horse, it would cause the magic effect Light, but not cause any damage. That is it.

 

A light spell that hurts the creatures aaafear

 

But NOT

 

a Horse/goblin/guard/imp/etc/etc/etc

 

Also I will be leaving for work here in a few hours, I will check this when I get back.

Edited by Videniofthesith
Link to comment
Share on other sites

Ok, well here's an idea -- untested, and just an idea. First you must create two custom spells. One that causes fire damage (suggest 1 damage per second) on self. Next, a spell that casts light on self (suggest not too great -- you only want it to look like the target is lit, not everything around it). Lets call the spells aaaburndamage and aaalight. Now you can create your NPC spell that uses a script like this:

 

 


ScriptName aaaLightUpTheDarknessScript

float effecttime
float timer
Short targetref
short doonce

set effecttime to 30  ;; [or however long you want the effect to last]

Begin ScriptEffectStart
set timer to effecttime
set targetref to getself
If targetref == aaafear
	targetref.addspell abatronachflameeffect
	targetref.addspell aaaburndamage
	targetref.addspell aaalight
Else
	targetref.addspell aaalight
   	Return
EndIf
End

Begin ScriptEffectUpdate

if ( timer > effecttime )
	targetref.kill
	Return
endif

if ( targetref.getdead == 1 ) && ( timer < ( effecttime-2 ) )            	
   	set timer to ( effecttime-2 )
endif

if ( timer > 0.1 ) && ( doonce == 0 )
   	targetref.pms effectAtronachFlame 1        	
   	set doonce to 1
endif

set timer to timer + GetSecondsPassed    	

if ( timer > ( effecttime-2 ) ) && ( doonce == 1 )
   	targetref.kill        	
   	set doonce to 2
endif

if ( doonce == 2 )	
   	set fade to fade - 0.03
   	targetref.saa fade
endif
   	

End


Begin ScriptEffectFinish
If targetref == aaafear
	targetref.removespell abatronachflameeffect
	targetref.removespell aaaburndamage
	targetref.removespell aaalight
Else
	targetref.removespell aaalight
EndIf
End

End

 

Link to comment
Share on other sites

i think i know how this can be done (it's one of the oldest ways i can remember)

 

i remember that when i first started reading about mods and such, i read about items called tokens, that are hidden unplayable items that certain NPCs\creatures\containers have, that allows certain things to happen to them (can't think of a batter way to explain this)

 

now, you may not know how to create a token like this (and i don't know either), but my idea is based on this

basically, you will need to create a new item, an unplayable item, unique to your mod, and add it to all the instances of this specific type of creature you are targeting

then, in the spell, you need to write

 

if (ID.GetItemCount ItemID > 0)

 

then add the fire spell to that creature (though for some reason, i can't find a way to add the effect to the creature, without forcing the player to cast another spell, but my memory of scripting isn't all to good)

 

you will still need to find a script that will add the fire effect to your target, but this may be able to solve your problem with identifying the target, and making sure this happens only on your creatures (i looked at other functions, but i didn't see one that allows you to check the type of creature, at least in a usable way for you)

 

hope this helps

Link to comment
Share on other sites

I will try both of these out as soon as I get back from work! I honesty believe this has solved my problem, now if I can only figure out why my npc says the greeting, then shows the first topic, but doesn't show the second topic, even though I said AddTopic (ID) in the result script. Back to the tutorial page! After work that is lol. Thanks for all your help. I am sure you will be seeing other of my help posts soon, like how in the HELL do I add a timer onto my 2nd quest, so that after 48 hours after quest one ends, you get quest 2. Grrr, the enjoys of modding.
Link to comment
Share on other sites

Well I copied and pasted everythin like show, changing the name of the spells accordingly, but after trying to save it says line 11 is an invalid reference and says only object and varitable references are allowed are allowed in this context. AH! This is why I hate scripting.
Link to comment
Share on other sites

Yes, you were to substitute the aaafear for the formID or reference of your creature (I don't know what it is). I should have mentioned that. Like I said, the script was written as an idea with no testing.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...