Jump to content

CK Help: How to force a spell to equip upon equipping an armor or weapon


Recommended Posts

I'm working on a mod. Basically, I'm trying to make it so if I equip an armor, shield, or sword- I want the item that is chosen to force a spell to be equipped in the other hand.

For example: if I equip a Steel Shield on my Left Hand, I want to have a specific spell force equipped to the Right Hand. No hotkeys, just straight cause/effect.

Does this require a script? I've never scripted before. How would I go about this?

Link to comment

I'm reading through this, so I'd have to create a script that would essentially:

1) Start with objectreference
2) work with the event "on equipped"

3) add the "Equip Spell" function
4) add event "on unequipped"

5) add "unequipspell" function


So would formatting this be 1 script?

 

Link to comment

Uploading Video for You ;D

1) even i had some problems with this script xD #ActorVsObject xD

2) I'm not sure u can handle so easy thing by yourself :D he he he xDD

 

Anywaa here is Script:
 

Spoiler

Scriptname QLG_SimpleScript_EquipSpellWithArmor extends ObjectReference  
{ Script equip selected spell to user hand when equip armor  }
;===- Base Info. -===;
 ;Created: 2020-06-26
 ;Update: 2020-06-26
 ;Author: TobiPL
 ;Unit: M.PC<2>
;===- Var. setup -==================================================;
	;===- Work Control -===;
	Bool Property OnlyPlayer Auto
	{ Set to True if Script should work only for Player }
	Bool Property RightHand Auto
	{ If True -> Spell will be equiped to Right Hand
	  If False -> Spell will be equiped to Left Hand }
	Bool Property PowerSpell Auto
	{ Check this if Spell is Power / LesserPower or Voice Power }
	;===- Variables -===;
	Spell Property SpellToEquip Auto
	{ What Spell You want to Equip }
;===============================================;
;===- Main Script -=============================;
;***********************************************;
Event OnEquipped( Actor QRef )
	If( OnlyPlayer )
		If( QRef != Game.GetPlayer() )
			Return	; OnlyPlayer but user is sm1 else, returning
		EndIf
	EndIf
	;-------------------------------------------;
	If( PowerSpell )
		QRef.EquipSpell( SpellToEquip, 2 )
	Else
		If( RightHand )
			QRef.EquipSpell( SpellToEquip, 1 )
				Else
			QRef.EquipSpell( SpellToEquip, 0 )
		EndIf
	EndIf
EndEvent
; The End

 

 

That will cost You 19,99$ :x...

Money Money ❤️ he he :D

 

Here is Video if u need help how to setup everything:

Spoiler

 

 

Example esp file: [Tobi] TestMod.esp

Script File: QLG_SimpleScript_EquipSpellWithArmor.psc

 

Discord: https://discord.gg/CDkcv22

Link to comment
16 hours ago, TobiaszPL said:

Uploading Video for You ;D

1) even i had some problems with this script xD #ActorVsObject xD

2) I'm not sure u can handle so easy thing by yourself :D he he he xDD

 

Anywaa here is Script:
 

  Reveal hidden contents


Scriptname QLG_SimpleScript_EquipSpellWithArmor extends ObjectReference  
{ Script equip selected spell to user hand when equip armor  }
;===- Base Info. -===;
 ;Created: 2020-06-26
 ;Update: 2020-06-26
 ;Author: TobiPL
 ;Unit: M.PC<2>
;===- Var. setup -==================================================;
	;===- Work Control -===;
	Bool Property OnlyPlayer Auto
	{ Set to True if Script should work only for Player }
	Bool Property RightHand Auto
	{ If True -> Spell will be equiped to Right Hand
	  If False -> Spell will be equiped to Left Hand }
	Bool Property PowerSpell Auto
	{ Check this if Spell is Power / LesserPower or Voice Power }
	;===- Variables -===;
	Spell Property SpellToEquip Auto
	{ What Spell You want to Equip }
;===============================================;
;===- Main Script -=============================;
;***********************************************;
Event OnEquipped( Actor QRef )
	If( OnlyPlayer )
		If( QRef != Game.GetPlayer() )
			Return	; OnlyPlayer but user is sm1 else, returning
		EndIf
	EndIf
	;-------------------------------------------;
	If( PowerSpell )
		QRef.EquipSpell( SpellToEquip, 2 )
	Else
		If( RightHand )
			QRef.EquipSpell( SpellToEquip, 1 )
				Else
			QRef.EquipSpell( SpellToEquip, 0 )
		EndIf
	EndIf
EndEvent
; The End

 

 

That will cost You 19,99$ :x...

Money Money ❤️ he he :D

 

Here is Video if u need help how to setup everything:

  Reveal hidden contents

 

 

Example esp file: [Tobi] TestMod.esp

Script File: QLG_SimpleScript_EquipSpellWithArmor.psc

 

Discord: https://discord.gg/CDkcv22

Awesome, looking this all over and am going to try to apply it! Thanks for all the information and sources

Link to comment

This really is a lot of work! Thanks for the time and effort you put into it. I'm trying to get the set up to work with the spells I want in game, but it's taking me a lot of time. If I can get it to work on my end, I'll post a clip here showing my progress. 

Thanks again!

Link to comment

@TobiaszPL  I'm looking this over and trying to tweak it to multiple armors. And I came across a new situation. So far I understand the scripts, the references, and how to set it up. Formatting is my biggest issue. But I want to add another layer. 

Let's say I have a Sword. I want to use this script to have a spell force equipped when I equip the sword. This script example above accomplishes that. But the new string would be:

I equip a Sword (Sword of Spells or some name). Equipping the Sword pulls up a menu, which then allows the player to select a spell which is then force equipped to the free hand. How would I have an item make a menu appear? (Similar to activating a world object that brings up options?)

Link to comment

@DremoraDream

Egh... Yes, you need to create Message... 

Bfff... Maybe if i will find some Time i write new Script for You, Tomorrow my mom visit me so i will not have time for that

and Friday im in work ( 12 hours ( 19:00 -> 7:00 ) )

 

Wait for me ( probably Saturday ) and i will give You new Script

or try to make Script by your own :)...

 

Its not that hard ^_^

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use