Jump to content

Need help on a script


saamziel

Recommended Posts

im trying to make a auto healing weapon but i cant get it to work can anyone tell what im doing wrong thanks mucho

 

scn timerTestScript

float fEndTime

Begin OnEquip

; Initialisation
set fEndTime to getSecondsPassed - 1; 1 seconds from now

...

if getSecondsPassed > fEndTime; The timer has finished
	If player.GetWeaponHealthPerc < 99; do stuff
		player.ModWeaponHealthPerc 5
		set fEndtime to 1
	endif
endif

End

Link to comment
Share on other sites

Here's some solutions, although I haven't tested them myself ingame.

 

If you really want to use a timer, just for the sake of using one:

scn timerTestScript

float fEndTime

Begin GameMode;Begin OnEquip runs ONLY once thru the script, unless you use Label and Goto from FOSE. GameMode runs untill you unequip it.

set fEndTime to 1
if fEndTime > 0
	set fEndTime to fEndTime - GetSecondsPassed
elseif player.GetWeaponHealthPerc < 99
	player.ModWeaponHealthPerc 1;No need for higher percent as it will be at 100 after a few seconds wait anyway.
	set fEndtime to 1
endif
End

 

This is how I would do it personally:

scn timerTestScript

Begin GameMode;This is somewhat simpler way to do it, and does it realtime.

if player.GetWeaponHealthPerc < 99
	player.ModWeaponHealthPerc 1
endif
End

 

If you want to make an "indestructible" weapon, you can also just edit the weapon's health to 50000 or something.

 

I hope that helps :)

Link to comment
Share on other sites

This script only runs once, when you first equip the weapon. There is no loop to it, if you know what I mean. It has to begin on gamemode in order to recheck itself continuously, because gamemode is a condition that occurs constantly, whereas onequip is just a condition that occurs for a moment. Does that make sense?

 

Here's an example of a timer I used:

 

 

scn myscriptname

 

short task

float MITtimer

 

Begin onactivate player

If task == 0

playmagiceffectvisuals glowingonegloweffect

Set Task to 1

Set M1Timer to 3

Endif

end

 

Begin GameMode

If (Task)

If M1Timer > 0

Set M1Timer to M1Timer - GetSecondsPassed

Else

stopmagiceffectvisuals glowingonegloweffect

myDoorRef.activate player

Set task to 0

endif

Endif

end

 

 

I'm not an expert scripter myself. Someone helped me as well. Hope this helps.

 

Rob

Link to comment
Share on other sites

Try this:

 

 

scn timerTestScript

 

float fEndTime

 

Begin OnEquip

 

; Initialisation

set fEndTime to getSecondsPassed - 1; 1 seconds from now

 

end

 

Begin GameMode

 

if getSecondsPassed > fEndTime; The timer has finished

If player.GetWeaponHealthPerc < 99; do stuff

player.ModWeaponHealthPerc 5

set fEndtime to 1

endif

endif

 

End

Link to comment
Share on other sites

Sorry, like rjhelms84 corrected, you need the OnEquip section, as the script itself doesn't check what the item it is. My example will (as noted) end up healing all weapons in your inventory. That is the reason I use FOSE myself, as with it the control on everything is way easier to maintain.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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