Jump to content

Recommended Posts

Posted (edited)

Okay, so I'm making some custom skills with custom spells based on those skills. Basically, I need a level requirement for each spell, but, I'm not quite sure how to force unequip the spell if the requirements aren't met. I've tried several different methods to no avail. Any help on the topic would be appreciated.

 

Here's one of the methods I've tried -

Event OnSpellEquip(Spell akSpell)

	Int cMag = RS_GV_MagicLvl.GetValue() as Int

	If (PlayerRef.GetEquippedItemType(1) == 9)
		EquippedSpell = PlayerRef.GetEquippedSpell(1)
		
		If cMag < rMag
			PlayerRef.UnequipSpell(EquippedSpell, 1)
		EndIf
		
	EndIf

EndEvent

Another one I've tried

Event OnEquipped(Actor akActor)

	Int cMag = RS_GV_MagicLvl.GetValue() as Int

	Spell eSpell = PlayerRef.GetEquippedSpell(1)

	If akActor == PlayerRef
	
		If cMag < rMag
			PlayerRef.UnequipSpell(eSpell, 1)
		EndIf
	EndIf
	
EndEvent
Edited by Rizalgar
Posted

Skill level requirement. A custom skill added via Global variables. So, basically if GlobalVariable doesn't equal X, unequip spell

Posted (edited)

I've gotten it to work with weapon equips using this script

 

 

  Reveal hidden contents

 

 

I just can't get it to work with spell equips

Edited by Rizalgar
Posted (edited)

Bump

 

I'm getting beyond frustrated. I can't get this to work. I can't even get it to detect when the player equips the spell. Anyone?

 

My latest attempt, attached to a start game enabled quest,

Event OnEquipped(Actor akActor)

	Spell WindStrike = RS_Spell_WindStrike
	Debug.Notification("Wind strike equipped")
	If akActor == PlayerRef
		If (PlayerRef.GetEquippedItemType(1) == 9)
			Spell eSpell = PlayerRef.GetEquippedSpell(1)
			If eSpell == WindStrike
				GSR("WindStrike", None, 10, 1, 0, 0, 0, 0, 0)
			EndIf
		Else
			Debug.MessageBox("Error determing equip")
		EndIf
	EndIf
	
EndEvent

Edit

 

For anyone who ever has the same idea in mind, note that after hours of trial and error I couldn't find a way to unequip a spell on equip if requirements weren't met. I found it 100x times easier and less stressful to take the easy cheap route of having a dummy spell do the checks and then unequip it if it doesn't pass, then cast the actual spell if it does. If someone does find a way though, be sure to hit me up.

Edited by Rizalgar
Posted

I want to say I tried that, in many different forms, including

 

  Reveal hidden contents

 

as well as calling the event without the Spell eSpell, to no avail. Maybe I'm just not setting up the triggering for it properly?

 

I have also tried it as

 

 

  Reveal hidden contents

 

Posted

I'm gonna toss out more options for you to try.

 

-Condition Functions

GetEquippedItemType

You already know the script version

 

isWeaponMagicOut - checks if a weapon or spell is equipped

Script Version: https://www.creationkit.com/index.php?title=IsWeaponDrawn_-_Actor

 

You're probably better off using a condition and place it in an ability that is on the player, so that it checks every second for spells being equipped. Then you can use OnEffectStart event to check what kind of spell is equipped.

Posted

Mm, condition functions are new to me. Pretty much if I can't do it entirely in script, I'm at a loss. I'll see if I can't figure it out with that. Thanks, Rasikko

Posted (edited)

Huzzah! Breakthrough. All works now! For any googlers coming across this, this is how you can force unequip a spell if you don't meet requirements.

 

Attach this to an ability given to the player, with the spell condition IsWeaponMagicOut == 1

 

 

  Reveal hidden contents

 

 

Then, attach this script to a start enabled, always running quest

 

 

  Reveal hidden contents

 

Edited by Rizalgar
  • Recently Browsing   0 members

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