Weapon Scripting

Post » Fri May 27, 2011 12:40 pm

I'm trying to attach this script
SCN AA0SamuraiSwordScriptRef MeRef WhoRef ShieldShort CShort MLong KEYBegin OnAddset Who to Getcontainerset Me to GetBaseObjectset Shield to Who.GetEquippedObject 13endBegin OnEquipsetWeaponType 0set Who to Getcontainer	If Shield != 0	Who.UnequipItem Shield	endifset C to 1endbegin MenuMode 1set Shield to Who.GetEquippedObject 13	If Shield != 0 && Who.GetEquipped Me	Who.UnequipItem Shield	endifSetWeaponType 1set M to 1endBegin OnUnEquipsetWeaponType 0set C to 0endBegin OnDropset c to 0endBegin GameModeif Who.GetEquipped Me && C == 0	SetWeaponType 0		If Shield != 0		Who.UnequipItem Shield		endif	set C to 1endifif M == 1 && Who.IsWeaponOut == 0	setWeaponType 0	set M to 0endifIf C == 1 && Who.IsWeaponOut	set KEY to GetControl 8	SetWeaponType 1	set C to 2elseIf C == 2 && IsKeyPressed2 KEY	setWeaponType 0elseIf C == 2 && Who.IsWeaponOut == 0	setWeaponType 0	Message " "	Message " "	Who.UnequipItem Me	Who.equipItem Me	set c to 1endifIf Who.GetEquipped Me == 0 && C == 1	setWeaponType 0	set C to 0endifend
to a katana, and I'm having some issues with it. I've tried using the script editor in the CS to create a new script, but once saved, I can't find the script anywhere in the list of scripts to add to it. It does show up in the list of what I can open in the script editor, but not in the list of what scripts can be attached to the weapon. I'm using the command-line argument to load OBSE with the CS, so I'm sure that's not it. Any help? I'm trying to use it as an object script.
User avatar
Curveballs On Phoenix
 
Posts: 3365
Joined: Sun Jul 01, 2007 4:43 am

Post » Fri May 27, 2011 4:40 pm

It sounds like your Script type might be wrong-- Script Type needs to be Object to be attached to things like weapons. There should be a box in the Script Window that says "Object", "Quest" or "Effect"-- just click and change it.

If it already says it, try changing to a different type, and back again-- I've had the CS do odd things like not save it properly for some reason, so maybe it hit you?
User avatar
R.I.P
 
Posts: 3370
Joined: Sat Dec 01, 2007 8:11 pm

Post » Fri May 27, 2011 10:13 am

Strangely, I never have that problem, but I do know that the CS does weird things. *remembers warning messages and shudders*

By the way, that script looks really impressive. What does the sword do?
User avatar
Cassie Boyle
 
Posts: 3468
Joined: Sun Nov 05, 2006 9:33 am

Post » Fri May 27, 2011 5:48 pm

Your calls to SetWeaponType need to be fixed, plus some of your script functions seem redundant.

SCN AA0SamuraiSwordScriptRef MeRef WhoRef ShieldRef MeObjectShort CShort MLong KEYbegin MenuMode 1	if (Who == 0)		set Who to GetContainer		return	endif	if (Me == 0)		set Me to this		return	endif	if (MeObject == 0)		set MeObject to Who.GetEquippedObject 16		return	endif	set Shield to Who.GetEquippedObject 13	If Shield != 0 && Who.GetEquipped Me		Who.UnequipItem Shield	endif	SetWeaponType 1 MeObject 	set M to 1endBegin OnUnEquip	setWeaponType 0 MeObject 	set C to 0endBegin OnDrop	set c to 0endBegin GameMode	if (Who == 0)		set Who to GetContainer		return	endif	if (Me == 0)		set Me to this		return	endif	if (MeObject == 0)		set MeObject to Who.GetEquippedObject 16		return	endif	if Who.GetEquipped Me && C == 0		SetWeaponType 0 MeObject 		If Shield != 0			Who.UnequipItem Shield		endif		set C to 1	endif	if M == 1 && Who.IsWeaponOut == 0		setWeaponType 0 MeObject 		set M to 0	endif	If C == 1 && Who.IsWeaponOut		set KEY to GetControl 8		SetWeaponType 1 MeObject 		set C to 2	elseIf C == 2 && IsKeyPressed2 KEY		setWeaponType 0 MeObject 	elseIf C == 2 && Who.IsWeaponOut == 0		setWeaponType 0 MeObject 		Message " "		Message " "		Who.UnequipItem Me		Who.equipItem Me		set c to 1	endif	If Who.GetEquipped Me == 0 && C == 1		setWeaponType 0 MeObject 		set C to 0	endifend

User avatar
Russell Davies
 
Posts: 3429
Joined: Wed Nov 07, 2007 5:01 am


Return to IV - Oblivion