Jump to content

Preventative Dual Wielding Script Help


Rizalgar

Recommended Posts

Okay, I'm at it again. This time with a little bit different take on requirements for weapon/spell equips. In particular, this time around, preventing the ability to dual wield. Now, it's halfway working. In the sense that, if I have no weapons equipped, and try to equip a weapon in the left hand, it will unequip. However, if I have a weapon already equipped, it will bypass that part of the script. It's most likely oversight on my part, but I can't seem to find the issue. In my spell version, I controlled via a constantly active ability, with a conditional trigger. I'd like to go a different route though. So, here's the script, point me towards my ignorance!

 

 

{WIP}

 

 

Scriptname saoFrameworkEquips extends ObjectReference
{Framework handling weapon equips based on class}

GlobalVariable Property SAO_GV_DamMax Auto
GlobalVariable Property SAO_GV_DamMin Auto

GlobalVariable Property SAO_GV_Class Auto

GlobalVariable Property SAO_GV_HasDualWield Auto

GlobalVariable Property SAO_GV_StatLock Auto

Int Property rClass Auto
Int Property dMax Auto
Int Property dMin Auto

bool bCrashLock = False

Event OnEquipped(Actor player)

	If player == Game.GetPlayer()
		If SAO_GV_HasDualWield.GetValue() == 0 && SAO_GV_Class.GetValue() == 1
			bCrashLock == True
			Weapon lh = player.GetEquippedWeapon(true)
			player.UnequipItem(lh, true, true)
			Debug.Notification("You have not unlocked dual wielding yet!")
		EndIf
	EndIf
	
EndEvent

Event OnUnequipped(Actor player)

	If bCrashLock == True 
		;
	Else
		If SAO_GV_StatLock.GetValue() != 0
			Debug.MessageBox("Equip error of some sort")
		Else
			ApplyDamage(False)
		EndIf
	EndIf

EndEvent

Function ApplyDamage(bool bApply)

	SAO_GV_StatLock.SetValue(1)

	If bApply == True
		SAO_GV_DamMin.SetValue((SAO_GV_DamMin.GetValue()) + dMin)
		SAO_GV_DamMax.SetValue((SAO_GV_DamMax.GetValue()) + dMax)
	ElseIf bApply == False
		SAO_GV_DamMax.SetValue(0)
		SAO_GV_DamMin.SetValue(0)
	Else
		SAO_GV_DamMax.SetValue((SAO_GV_DamMax.GetValue()) - dMax)
		SAO_GV_DamMin.SetValue((SAO_GV_DamMin.GetValue()) - dMin)
	EndIf
	
	SAO_GV_StatLock.SetValue(0)
	
EndFunction

 

 

Link to comment
Share on other sites

Hmm, sounds like I may have to go with the ability check then. That, or a background quest. I'll give it a shot and see what I come up with, thanks Ishara

 

Edit - Runs just fine and works as intended with the ability check script. Sure there is a way to do it with an OnInit RegisterForUpdate OnUpdate block with my original script but I got work in 15 minutes so that can wait. Thanks again, Ishara, always comin through for me :)

Edited by Rizalgar
Link to comment
Share on other sites

  • Recently Browsing   0 members

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