[Help] Need some help with simple scripting.

Post » Tue Jun 19, 2012 1:53 pm

after an initial test, the weapon swapping is not very fluid, it plays draw animations for both weapons, so if you were to swap out the 2-hand for a 1-hand, it animates the 1-hand sword draw unfortunately.


I expected that much ... we better wait for SKSE functions and make something like this

SCN AA0SamuraiSwordScript
Ref Me
Ref Who
Ref Shield
Short C
Short M
Long KEY
Begin OnAdd
set Who to Getcontainer
set Me to GetBaseObject
set Shield to Who.GetEquippedObject 13
end
Begin OnEquip
setWeaponType 0
set Who to Getcontainer
If Shield != 0
Who.UnequipItem Shield
endif
set C to 1
end
begin MenuMode 1
set Shield to Who.GetEquippedObject 13
If Shield != 0 && Who.GetEquipped Me
Who.UnequipItem Shield
endif
SetWeaponType 1
set M to 1
end
Begin OnUnEquip
setWeaponType 0
set C to 0
end
Begin OnDrop
set c to 0
end
Begin GameMode
if Who.GetEquipped Me && C == 0
SetWeaponType 0
If Shield != 0
Who.UnequipItem Shield
endif
set C to 1
endif
if M == 1 && Who.IsWeaponOut == 0
setWeaponType 0
set M to 0
endif
If C == 1 && Who.IsWeaponOut
set KEY to GetControl 8
SetWeaponType 1
set C to 2
elseIf C == 2 && IsKeyPressed2 KEY
setWeaponType 0
elseIf C == 2 && Who.IsWeaponOut == 0
setWeaponType 0
Message " "
Message " "
Who.UnequipItem Me
Who.equipItem Me
set c to 1
endif
If Who.GetEquipped Me == 0 && C == 1
setWeaponType 0
set C to 0
endif
end

but i'm still annoyed by the fact that i couldn't get something simple like that to work

if it is not to much trouble ... could you post your solution here with the script etc

thanks
Alex
User avatar
Darren
 
Posts: 3354
Joined: Wed Jun 06, 2007 2:33 pm

Post » Tue Jun 19, 2012 4:44 pm

this is very crude and maybe not the best way to do it, but just for test purposes:


attached to 2-hand:

Scriptname Katana2Script extends ObjectReferenceWEAPON Property Katana1  AutoWEAPON Property Katana2  AutoEvent OnEquipped (Actor akActor)while akActor.isEquipped(Katana2)  if akActor.isWeaponDrawn()   akActor.equipItem(Katana1)  endIfendWhileEndEvent






attached to 1-hand:


Scriptname Katana1script extends ObjectReferenceWEAPON Property Katana1  AutoWEAPON Property Katana2  Autoint loop = 0Event OnEquipped (Actor akActor)while loop == 0if akActor.isEquipped(Katana1) && !akActor.isWeaponDrawn()akActor.EquipItem(Katana2)endIfendwhileEndEvent





initiate the test by equipping the 2-hand sword so it appears on the players back, then draw weapon.

it switches to the 1hand sword with a very awkward animation transition


currently the switching back to 2-hand on the back doesnt fire because of the bug of the onequipped not firing during force-equips that i mentioned before, but you get the idea


sorry if it's not really much help, but manipulating the combat animations is a real pain. it would be great if there was an easy way to call partial animations like only the first part of the sword draw when it reaches behind the shoulder, and play the 1-hand combat anim idle from the point after it has already drawn
User avatar
Tanika O'Connell
 
Posts: 3412
Joined: Fri Jan 26, 2007 1:34 am

Post » Tue Jun 19, 2012 11:58 pm

ah ok.

this is great because i'm actually working on something that is similar as well (when weapon is drawn it is a one-handed dual wield ninja sword, and when sheathed it is a double scabbard in X-formation on the back)

...

the main problem with this is that by swapping meshes using a remove and add, you will not be able to temper the weapon as the stats will reset each time it is added back into the inventory. you also need to take into account the possibilities of other weapons being equipped, or if while you have the 1-hand katana equipped, the player switches to a bow (which forces the 1-hand to unequip), then unequips the bow (which forces the 1-hand back into the hand, but it wont fire the onequipped part of the script again, thus breaking the loop and it will not sheath onto the players back)
instead of doing all that, would it be possible to make a custom quiver? since those already hang out on your back, then your script wouldn't need to remove the weapons all the time. Instead it would just need to check weather the weapons were equipped, and equip your custom double sheath arrow thingy.
User avatar
Natalie Taylor
 
Posts: 3301
Joined: Mon Sep 11, 2006 7:54 pm

Post » Tue Jun 19, 2012 10:18 pm

that could be done as well, but the main thing wuold be getting that 2-handed weapon draw animation so that the arm reaches over the shoulder to make it look like its unsheathing the sword from the back, instead of crossing over to unsheath from the hip (which would look really silly with that scabbard placement).
User avatar
c.o.s.m.o
 
Posts: 3419
Joined: Sat Aug 12, 2006 9:21 am

Previous

Return to V - Skyrim