Jump to content

Skyrim spell Script


codeyhanson

Recommended Posts

Ok so Im trying to make a spell where every time you cast it it will take 5 health away I have made a script that sort of works but its not what I want here it is

 

Scriptname test2 extends activemagiceffect

Event OnEffectStart(Actor Any , Actor Caster)

caster.damageav("health", 5)

endEvent

 

now what it does is when you hit someone with the spell it will take 5 health but when you miss or just cast in the air it does noting

 

also tryd this but cant get this to work at all

 

Scriptname TEST1 extends ObjectReference

Event OnSpellCast(Actor Castor)

Spell spellCast = Spell as Spell

if spellCast && spellCast ==FireballSpell

caster.damageav("health", 5)

endEvent

Link to comment
Share on other sites

Scriptname TEST1 extends ObjectReference

Spell Property FireballSpell auto

Event OnSpellCast(Spell SpellCast)
If SpellCast == FireballSpell 
	DamageAV("health", 5)
EndIf
EndEvent

 

You have to put this script on the player or NPC that will cast the spell.

Link to comment
Share on other sites

Scriptname TEST1 extends ObjectReference

Spell Property FireballSpell auto

Event OnSpellCast(Spell SpellCast)
If SpellCast == FireballSpell 
	DamageAV("health", 5)
EndIf
EndEvent

 

You have to put this script on the player or NPC that will cast the spell.

And how would you put the Script on the player when you cast just that spell the name of the real spell under magic effects is Bloodspike

Link to comment
Share on other sites

Scriptname TEST1 extends ObjectReference

Spell Property FireballSpell auto

Event OnSpellCast(Spell SpellCast)
If SpellCast == FireballSpell 
	DamageAV("health", 5)
EndIf
EndEvent

 

You have to put this script on the player or NPC that will cast the spell.

And how would you put the Script on the player when you cast just that spell the name of the real spell under magic effects is Bloodspike

Also I get an error for DamageAV("health", 5) when trying to save that seems to only work on ActiveMagicEffect

Link to comment
Share on other sites

Oops. Try changing the script to extend Actor instead of ObjectReference, or, change "DamageAV" to "Game.GetPlayer().DamageAV".

Alright that last part worked here is the new script

 

Scriptname Blood2 extends ObjectReference

SPELL Property SpellBloodSpike Auto

 

Event OnSpellCast(Form akSpell)

Spell spellCast = akSpell as Spell

if spellCast && spellCast == SpellBloodSpike

Game.GetPlayer().DamageAV("health", 5)

endIf

endEvent

 

now do I just put this one the Magic Effect or Do I have to put this on an actor such as the player and if I do have to put it on the player how would i do that I pretty new.

Link to comment
Share on other sites

The script needs to go on an NPC or the player.

 

It should work "as is" if you put it directly on the player's Actor form. However I'm not sure if there would be a compatability problem if another mod also tried to put a script directly onto the player (I haven't tested for that situation).

 

The other way is to create a quest alias for the player, then attach a script to the alias. But in this case, I suspect that the script might need to extend ReferenceAlias (I'm not 100% sure about this). If it does, then the script might need to be modified a little. So if your script doesn't work on the alias, you could try this:

 

Scriptname Blood2 extends ReferenceAlias

SPELL Property SpellBloodSpike Auto
ReferenceAlias Property Player auto

Event OnSpellCast(Form akSpell)
Spell spellCast = akSpell as Spell
if spellCast && spellCast == SpellBloodSpike
	Player.GetActorRef().DamageAV("health", 5)
endIf
EndEvent

 

To create a player alias:

 

1) Create a new Quest form under "Character", "Quest" in the Object Window tree in the CK (just right-click and select "new").

2) In the Data tab, put in an ID for your quest. Tick "start game enabled".

3) In the Alias tab, create a "New Reference Alias" and call it "Player". Tick "Allow Reserved". For the Fill Type, choose "Specific Reference" and click the "Select Forced Reference" button. Under "Cell" choose "any", and "Ref" should default to PlayerRef(Player). If not, pick it from the drop-list.

 

http://www.creationkit.com/images/3/3d/DASPlayerAlias-1.png

 

Now you might have to close the quest form, save the mod, then reopen the quest form. Edit the player alias in the Quest Alias tab again and you should be able to attach your script to it. Don't forget to fill the Properties afterwards. Now close the quest tab, save the mod and test it out in-game.

Edited by steve40
Link to comment
Share on other sites

The script needs to go on an NPC or the player.

 

It should work "as is" if you put it directly on the player's Actor form. However I'm not sure if there would be a compatability problem if another mod also tried to put a script directly onto the player (I haven't tested for that situation).

 

The other way is to create a quest alias for the player, then attach a script to the alias. But in this case, I suspect that the script might need to extend ReferenceAlias (I'm not 100% sure about this). If it does, then the script might need to be modified a little. So if your script doesn't work on the alias, you could try this:

 

Scriptname Blood2 extends ReferenceAlias

SPELL Property SpellBloodSpike Auto
ReferenceAlias Property Player auto

Event OnSpellCast(Form akSpell)
Spell spellCast = akSpell as Spell
if spellCast && spellCast == SpellBloodSpike
	Player.GetActorRef().DamageAV("health", 5)
endIf
EndEvent

 

To create a player alias:

 

1) Create a new Quest form under "Character", "Quest" in the Object Window tree in the CK (just right-click and select "new").

2) In the Data tab, put in an ID for your quest. Tick "start game enabled".

3) In the Alias tab, create a "New Reference Alias" and call it "Player". Tick "Allow Reserved". For the Fill Type, choose "Specific Reference" and click the "Select Forced Reference" button. Under "Cell" choose "any", and "Ref" should default to PlayerRef(Player). If not, pick it from the drop-list.

 

http://www.creationkit.com/images/3/3d/DASPlayerAlias-1.png

 

Now you might have to close the quest form, save the mod, then reopen the quest form. Edit the player alias in the Quest Alias tab again and you should be able to attach your script to it. Don't forget to fill the Properties afterwards. Now close the quest tab, save the mod and test it out in-game.

Ok last 2 ?'s One player's Actor form where is it, 2 Allow Reserved is grayed out for me

Link to comment
Share on other sites

1) Click on the Actor list in the CK then type "player" in the filter field in the top-left corner of the window. Alternatively, use the "Edit->Find Text" menu option and search for "player".

2) if it is greyed out, don't worry about it, it's not essential :)

Edited by steve40
Link to comment
Share on other sites

1) Click on the Actor list in the CK then type "player" in the filter field in the top-left corner of the window. Alternatively, use the "Edit->Find Text" menu option and search for "player".

2) if it is greyed out, don't worry about it, it's not essential :)

Thank you It now works

Link to comment
Share on other sites

  • Recently Browsing   0 members

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