NVSE scripting questions

Post » Fri May 04, 2012 6:35 am

So here are the two scripts I am attempting to revise due to the spammed message I get whilst sneaking. This script is taken from XFO Epic Skills. I love the mod and the idea behind this particular effect but these scripts often render the game unplayable if they don't cause FNV to crash entirely.

scn aaDoorCheckScript

ref dolor
ref dolor2
int optionsup
int buttonpressedX
int msgvar1
int showmenu
int chance1
int lskill

Begin GameMode

if player.getav lockpick > 100 && player.issneaking == 1

set dolor to GetCrosshairRef

set lskill to player.getav lockpick
set chance1 to 25 + ( ( lskill - 100 ) / 2 )
if chance1 < 25
set chance1 to 25
elseif chance1 > 75
set chance1 to 75
endif

set msgvar1 to chance1

if dolor.getlocklevel == 255 && dolor != dolor2
set dolor2 to dolor
set showmenu to 1
endif

if showmenu == 1
showmessage aaEpicUnlockMSG msgvar1
set optionsup to 1
set showmenu to 0
endif

if optionsup == 1
set buttonpressedX to getbuttonpressed
if buttonpressedX == 0
if getrandompercent < chance1
dolor2.unlock
showmessage aaSuccess
dolor2.ListAddRef aaDoorsUnlocked
else
showmessage aaFailure
dolor2.ListAddRef aaDoorsUnlocked
endif
set optionsup to 0
elseif buttonpressedX == 1
set optionsup to 0
endif
endif

endif
End

scn aaDoorLockScript

ref dolor
ref dolor2
int optionsup
int buttonpressedX
int msgvar1
int showmenu
int chance1
int lskill
int day1
int day2
int doOnce
int tries

Begin GameMode

set day1 to GameDaysPassed

if player.getav lockpick > 100 && player.issneaking == 1

set dolor to GetCrosshairRef

set lskill to player.getav lockpick

set lskill to (lskill - 100)

if lskill > 99
set lskill to 99
elseif lskill < 0
set lskill to 0
endif

if day2 != day1
set tries to 1
endif

if doOnce != 2
set tries to 1
set doOnce to 2
endif

if dolor.getlocked == 0 && dolor != dolor2 && tries != 0
set dolor2 to dolor
set showmenu to 1
endif

if showmenu == 1
showmessage aaEpicLockMSG
set optionsup to 1
set showmenu to 0
endif

if optionsup == 1
set buttonpressedX to getbuttonpressed
if buttonpressedX == 0
dolor2.lock lskill
set tries to 0
elseif buttonpressedX == 1
set optionsup to 0
endif
endif


endif

set day2 to day1

End

To my knowledge these scripts are saying that whenever a game is loaded these scripts are running and that when they are running anything the crosshair is over will cause aaEpicLockMSG to appear.


GetCrosshairRef - Returns the reference under the crosshair - i.e., the reference that would be activated if the player pressed the Activate button. Will return non-activatable items (like tables and trees) as long as they are within activation distance. Otherwise returns zero

.

What I am attempting to implement here is when ever an object is activated and not when I am simply looking directly at it within activation range. I was thinking OnActivate block would do the trick but the geck is not allowing me to save the script when making the appropriate changes (at least what I think would be appropriate as I am das new player in terms of scripting). Any pointers would be greatly appreciated.
User avatar
Stace
 
Posts: 3455
Joined: Sun Jun 18, 2006 2:52 pm

Post » Fri May 04, 2012 4:08 am

apparently there's already a fix.... just had to do a little more digging. Sorry you guys
User avatar
Robert Jackson
 
Posts: 3385
Joined: Tue Nov 20, 2007 12:39 am


Return to Fallout: New Vegas