Jump to content

Working on a recharge mod to learn Oblivion scripting.


Barak1001

Recommended Posts

I decided to take the time to actually learn Oblivion scripting this week. I'm currently running OBSE ver 0012. My question is can you use getCurrentCharge the way I've used it to set the current charge of an item for a recharging script? Also is this the way this script should actually be written or is there a way to neaten it up that I'm not seeing?

 

scn myScript

float 	timer
float	rechargeTimer
float	totalCharges
float	maxCharges
short	itemTotal
short	index
short 	init
ref	selectedItem

begin GameMode
; Has the timer been set up already?
if init == 0 

	;set the timer value, count down 25 seconds
	set timer to 10

	;Make sure we only set up the timer once!
	set init to 1

	;Add whatever you want to start at the beginning of the timer here
	...

;The timer was set up already, lets count down!
else

	; We still have some time left...
	if timer > 0
		set timer to timer - getSecondsPassed

	; ... or no, the time is up!
	else
		if index > itemTotal
			set init to 0
			set index to 0
		else
			set itemTotal to Actor.GetNumItems
			set selectedItem to ( player.GetInventoryObject index )
			set maxCharges to selectedItem.getObjectCharge
			set totalCharges to selectedItem.getCurrentCharge
			if totalCharges < maxCharges
				set totalCharges to totalCharges + 1
				set Index to Index + 1
			else
				set index to index + 1
			endif
		endif
	endif
endif
end

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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