JC LEON
Had time to get these working now. Video shows scripts resetting properly if player leaves area.
Also attached a simple re-texture for the computer entity when script is done. You will have to copy texture
into your folder and point the "alttexture" path to it.
First script simple reset if player leaves area with alttexture. Tested and works.
;AIScript
;Header
desc = Loading Progress Bar - Resets if player leaves area
;Script
:state=0:dimvar=hudwide,setvar=hudwide 0
:state=0:hudreset,hudx=50,hudy=80,hudsize=32,hudfont=Arial Black,hudred=255,hudgreen=0,hudblue=0,hudtext=Hack In Progress,hudname=hack,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=95,hudimagefine=gamecore\huds\loadingbar.tga,hudname=bar,hudhide=1,hudmake=display,state=1
:state=1,plrdistwithin=60:state=2
;DISPLAY THE TEXT
:state=2:fpgcrawtextsize=24,fpgcrawtextfont=Arial Black,fpgcrawtextr=255,fpgcrawtextg=0,fpgcrawtextb=0,fpgcrawtextx=50,fpgcrawtexty=80,fpgcrawtext=PRESS ENTER TO HACK,state=3
:state=3:fpgcrawtextsize=24,fpgcrawtextfont=Arial Black,fpgcrawtextr=255,fpgcrawtextg=0,fpgcrawtextb=0,fpgcrawtextx=50,fpgcrawtexty=80,fpgcrawtext=PRESS ENTER TO HACK
:state=3,plrdistfurther=60:state=0
:state=3,scancodekeypressed=28:hudshow=bar,state=4
:state=4,varless=hudwide 90:addvar=hudwide 5,hudshow=hack,state=6
:state=4,vargreater=hudwide 89:activateifused=1,hudunshow=hack,alttexture=1,state=10
;DISPLAY THE TEXT
:state=10:fpgcrawtextsize=32,fpgcrawtextfont=Arial Black,fpgcrawtextr=255,fpgcrawtextg=0,fpgcrawtextb=0,fpgcrawtextx=50,fpgcrawtexty=80,fpgcrawtext=HACK COMPLETE,state=11
:state=11:fpgcrawtextsize=32,fpgcrawtextfont=Arial Black,fpgcrawtextr=255,fpgcrawtextg=0,fpgcrawtextb=0,fpgcrawtextx=50,fpgcrawtexty=80,fpgcrawtext=HACK COMPLETE
;NO REPEAT
;WAIT UNTIL PLAYER LEAVES THE ZONE OR ENTITY
:state=11,plrdistfurther=60:hudunshow=bar,state=12
:state=13:hudunshow=bar,hudunshow=hack,setvar=hudwide 0,state=0
:state=6,plrdistfurther=60:state=13
:state=6,plrdistwithin=60:state=7
:state=7:scalehudx=bar %hudwide,state=8
:state=8:etimerstart,state=9
:state=9,etimergreater=250:state=4
;END SCRIPT
Second script same as above, but player is disabled until script is done running.
;AIScript
;Header
desc = Loading Progress Bar - Player disabled until script ended
;Script
:state=0:dimvar=hudwide,setvar=hudwide 0
:state=0:hudreset,hudx=50,hudy=80,hudsize=32,hudfont=Arial Black,hudred=255,hudgreen=0,hudblue=0,hudtext=Hack In Progress,hudname=hack,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=95,hudimagefine=gamecore\huds\loadingbar.tga,hudname=bar,hudhide=1,hudmake=display,state=1
:state=1,plrdistwithin=60:state=2
;DISPLAY THE TEXT
:state=2:fpgcrawtextsize=24,fpgcrawtextfont=Arial Black,fpgcrawtextr=255,fpgcrawtextg=0,fpgcrawtextb=0,fpgcrawtextx=50,fpgcrawtexty=80,fpgcrawtext=PRESS ENTER TO HACK,state=3
:state=3:fpgcrawtextsize=24,fpgcrawtextfont=Arial Black,fpgcrawtextr=255,fpgcrawtextg=0,fpgcrawtextb=0,fpgcrawtextx=50,fpgcrawtexty=80,fpgcrawtext=PRESS ENTER TO HACK
:state=3,plrdistfurther=60:state=0
:state=3,scancodekeypressed=28:plrdisable=100000,hudshow=bar,state=4
:state=4,varless=hudwide 90:addvar=hudwide 5,hudshow=hack,state=5
:state=4,vargreater=hudwide 89:activateifused=1,hudunshow=hack,alttexture=1,state=10
;DISPLAY THE TEXT
:state=10:fpgcrawtextsize=32,fpgcrawtextfont=Arial Black,fpgcrawtextr=255,fpgcrawtextg=0,fpgcrawtextb=0,fpgcrawtextx=50,fpgcrawtexty=80,fpgcrawtext=HACK COMPLETE,state=11
:state=11:fpgcrawtextsize=32,fpgcrawtextfont=Arial Black,fpgcrawtextr=255,fpgcrawtextg=0,fpgcrawtextb=0,fpgcrawtextx=50,fpgcrawtexty=80,fpgcrawtext=HACK COMPLETE
;NO REPEAT
;TIMER TO ENABLE PLAYER AGAIN
:state=11:etimerstart,state=12
:state=12,etimergreater=1500:hudunshow=bar,plrdisable=0,state=13
:state=5:scalehudx=bar %hudwide,state=6
:state=6:etimerstart,state=7
:state=7,etimergreater=250:state=4
;END SCRIPT
Attached is the retexture for computer screen. Don't forget, script must be attached to
computer entity for alttexture to work properly.
My games never have bugs. They just develop random features..
Lots and lots of random features...