Jump to content

scripting assistance


bioshards

Recommended Posts


ref rCont
short bEquipped

begin OnEquip

set rCont to GetContainer
set bEquipped to 1

end

begin OnUnequip

set bEquipped to 0

end

begin GameMode

if bEquipped == 0
elseif rCont.GetHealthPercentage < 0.4
set bEquipped to 0
DropMe
endif

end
Edited by jazzisparis
Link to comment
Share on other sites

Use GetEquipped as suggested by Hemingway. For the other thing, try setting Drops count parameter to 1.

ref Wearer

ref rMe

float fHealthPercent

float fTimer

 

Begin OnAdd

 

   let Wearer := GetContainer

   let rMe := GetSelf ; * if that doesn't work, use the name of the hat

 

End

 

Begin GameMode

 

    let fTimer += GetSecondsPassed

    if fTimer < 1 ; * run at most once per second

        return

    endif

    let fTimer := 0

    if Wearer.GetEquipped rMe != 1
        return
    endif

    let fHealthPercent := (Wearer.GetAV "Health") / Wearer.GetBaseHealth

 

    if fHealthPercent < 0.4

        Wearer.Drop rMe 1

    endif

 

End

You'll have to wait for the new NVSE :wink:.


Sounds exciting :wink:

Edited by Ladez
Link to comment
Share on other sites

Use GetEquipped as suggested by Hemingway. For the other thing, try setting Drops count parameter to 1.

...

 

Actually, I'd suggest going with jazzisparis' suggestion, its a lot neater. I thought I remembered DropMe and GetHealthPercentage being functions, but couldn't see them in NVSE... because they're in vanilla :pinch:

Link to comment
Share on other sites

jazz's script only works on the player

 

ref	rCont
short	bEquipped

begin OnEquip

	set rCont to GetContainer
	set bEquipped to 1

end

begin OnUnequip

	set bEquipped to 0

end

begin GameMode

	if bEquipped == 0
	elseif rCont.GetHealthPercentage < 0.4
		set bEquipped to 0
		DropMe
	endif

end

 

this script only works on the player, ill use hemingway's script but replace the last part with dropme and see if the result is satisfactory

Link to comment
Share on other sites

any idea what might be wrong with this script?

its not saving

scn AAAhemingway

ref Wearer

ref rMe

float fHealthPercent

float fTimer



Begin OnAdd



let Wearer := GetContainer

let rMe := GetSelf



End



Begin GameMode



let fTimer += GetSecondsPassed

if fTimer < 1

return

endif

let fTimer := 0

if Wearer.GetEquipped rMe != 1
return
endif

if Wearer.GetHealthPercentage < 0.7

DropMe

endif



End

Edited by bioshards
Link to comment
Share on other sites

  • Recently Browsing   0 members

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