OBSE weapon switching help?

Post » Mon Sep 16, 2013 11:43 am

http://oblivion.nexusmods.com/mods/26200//? uses a few OBSE functions to switch a weapon out when it is unsheathed, and switch it back when sheathed. Unfortunately, the structure of this script means that it only works for the player, and not for NPCs. I would really like to change this, or at least have a duplicate of these weapons that NPCs could use, however, I really don't have the knowledge. I don't imagine it would be as simple as changing the player.XXX entries to something else.

This is the script for the unsheathed weapon (0000JediSaberR1H):

scn SwitchSabersOnSoundR1short soundstate1short doOncefloat fQuestDelayTimeshort curkeyshort nosoundBegin GameMode	set fQuestDelayTime to .05	if ( player.GetEquipped 0000JediSaberR1H == 0 )    		return	endif	if ( curkey && IsKeyPressed curkey )    		set nosound to 1	else    		set curkey to 0    		set nosound to 0	endif	if ( IsKeyPressed 1 == 1 && nosound == 0 )    		playSound AndrewsaberswingX    		set curkey to 1	endif	if ( player.IsWeaponOut == 1 && soundstate1 == 0 )    		PlaySound Andrewsaberequip    		set soundstate1 to 1	endif	if ( player.IsWeaponOut == 0 && soundstate1 == 1 )    		PlaySound Andrewsaberunequip    		set soundstate1 to 0	endifEndbegin gamemode	if ( player.isWeaponout == 0 && doonce ==  0 )     ;if saber sheathed and hilt not present 		player.additemNS 0000JediSaberHR1H 1        ;add hilt		set doonce to 1                                                  ;set as present		return	endifendbegin gameMode	if ( player.isWeaponout == 1 )     ;if saber is drawn		set doonce to 0                       ;set as hilt not present	endifend

This is the script for the sheathed weapon (0000JediSaberHR1H):

scn EquipHiltWhenUhaveMeR1begin OnAdd player                                       ;when added to pc inv.                        player.equipitemNS 0000JediSaberHR1H   ;equip hiltendBegin Gamemode                                                                if ( player.GetEquipped 0000JediSaberHR1H ) && ( player.isWeaponout == 1 )  ;if hilt equiped and drawn                                        player.equipitemNS 0000JediSaberR1H    ;Equip saber to pc    return      endifendbegin gameMode    if player.GetEquipped 0000JediSaberR1H   ;if saber equiped    removeME       ;remove hiltendifendbegin OnUnequip	RemoveMeend

Any help would be greatly appreciated.

User avatar
Emma Copeland
 
Posts: 3383
Joined: Sat Jul 01, 2006 12:37 am

Return to IV - Oblivion