Jump to content

WTF


senterpat

Recommended Posts

Ah I see what you mean about calling it twice, would this break the script or merely be wasteful/inefficient? So this is the script I've come up with at the moment, accounting for if the player moves as well:

 

if (player.issneaking && doonce == 0)
set pos1 to player.getpos X
set pos2 to player.getpos Y
set pos3 to player.getpos Z
set doonce to 1
set timer to 10
endif
if (timer == 0 && pos1 == player.getpos X && pos2 == player.getpos Y && pos3 == player.getpos z && doonce == 1)
player.cios myspell
else
set timer to (timer - getsecondspassed)	
endif
	if (pos1 != player.getpos X || pos2 != player.getpos Y || pos3 != player.getpos Z)
	set doonce to 0
	endif

Edited by senterpat
Link to comment
Share on other sites

starting to look good.

Yea TES4 info is typicaly valid for FONV, unless the FONV geck page says otherwise.

I wrote modfusion for FONV using mainly TES4 file documents, they are 90% the same.

You also have 'set timer to (timer - getsecondspassed)' in that script twice.

You should have something like:

 

if (doonce == 1)
set timer to (timer - getsecondspassed)
dostuff
else if (doonce == 0)
getsecondspassed
set timer to 10
set doonce to 1
endif

 

 

Note: I don't think 'else if' works properly (it seems to act like endif/if), meaing if you swap doonce == 0 and 1's positions both blocks will get called in the same execution.

 

Also note how I call getsecondspassed once for no reason other then to initilize it, and setup timer in doonce == 0

 

You wouldn't use

else if (doonce == 0)

which may compile, but it's a syntax error. The 'if' should be on a new line.

 

else
if (doonce == 0)

 

You could use

 

if (doonce == 0)
;do stage 0 stuff
elseif (doonce == 1)
;do more stuff
elseif (doonce == 2)
;do yet more
elseif (doonce == 3)	;do nothing if 3
elseif (doonce == 4)
;final stage stuff
else
;Do this if doonce is none of the above
endif

 

You can have pretty much unlimited elseif's chained and it works fine (except for performance, perhaps).

Link to comment
Share on other sites

Ah I see what you mean about calling it twice, would this break the script or merely be wasteful/inefficient? So this is the script I've come up with at the moment, accounting for if the player moves as well:

 

if (player.issneaking && doonce == 0)
set pos1 to player.getpos X
set pos2 to player.getpos Y
set pos3 to player.getpos Z
set doonce to 1
set timer to 10
endif
if (timer == 0 && pos1 == player.getpos X && pos2 == player.getpos Y && pos3 == player.getpos z && doonce == 1)
player.cios myspell
else
set timer to (timer - getsecondspassed)   
endif
   	if (pos1 != player.getpos X || pos2 != player.getpos Y || pos3 != player.getpos Z)
   	set doonce to 0
   	endif

 

 

From what you are trying to do, the script should probably be on a token in the player's inventory, or easier a quest script with maybe a .5 or 1 second delay. For the pos check, the script doesn't need to check pos every frame. It just needs to check if the pos has changed after 10 seconds. If the player inched forward a bit, then back, it's probably near impossible that the pos numbers would be the same - I'm guessing.

 

For the timer, don't use

if timer == 0

It may go negative without ever hitting zero, so use if timer < 0

You should also break the timer out of the IF statement.

 

if (player.issneaking && doonce == 0)
   set pos1 to player.getpos X
   set pos2 to player.getpos Y
   set pos3 to player.getpos Z
   set doonce to 1
   set timer to 10
endif

if (timer < 0)
   if (pos1 == player.getpos X && pos2 == player.getpos Y && pos3 == player.getpos z && doonce == 1)
       player.cios myspell
       set doonce to 2
 else
   	set doonce to 0
   endif
else
   set timer to (timer - getsecondspassed)   
endif

if player.IsSpelltarget myspell == 0 && doonce == 2
   set doonce to 0
endif

Link to comment
Share on other sites

  • Recently Browsing   0 members

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