Jump to content

Please help me with this script!


zantetzou

Recommended Posts

thanks for reading.

 

so, im trying to make a script that will have a vertibird fly in, land on a roof then after a set time i need it to change playgroup to "left" which makes the vertibird idle as if it had landed and powered down.

 

i was able to make this script which as far as i can tell should work, but its not.

this is my script using timers so any help would be great

 

scn verttest

short bDoOnce
float timer

Begin OnTriggerEnter player
if timer < 5
	if [bDoOnce == 0]
		set timer to timer + GetSecondsPassed
		vert1.playgroup backward 1
	else
		vert1.playgroup left 1
		set timer to 0
		set bDoOnce to 1
		Disable
	endif
	activate
endif
end

Link to comment
Share on other sites

I did almost the exact same thing in Skunkwater Gulch.

You don't say what's not working, exactly.

 

There are different vertibird models, and their playgroups are not all consistent.

The one I used uses the model in meshes\vehicles\vertibirdencount01_hd.nif

 

Here is a snippet of the script I used:


Begin Gamemode

if animstage == 0
QSlaveVertibirdRef.playgroup left 0
elseif animstage == 1
QSlaveVertibirdRef.playgroup backward 0
endif 

End

 

I also used timers to set those animstages (animstage is a variable declared at the top of the script)

For this nif, playgroup left 0 is the "idle" animation, where the vertibird is landed with it's propeller spinning.

playgroup backward is the "take off and leave" animation. Sounds like it might be the same as yours. You can open the nif in nifskope to verify.

 

Looking at your script, it might be disabling immediately so you never see the playgroup left animation.

I put in a check in mine

if QSlaveVertibirdRef.isanimplaying backward == 0
	QSlaveVertibirdRef.disable
endif

So that it would disable only after it was done flying away.

Without knowing what isn't working it's hard to say what your fix will be.

Link to comment
Share on other sites

In order to run a timed script off an activator, I like to set a variable in the OnActivate block, and handle the timer in a GameMode block (the timer being dependent on the var set by OnActivate)

 

Something like

 

scn ActivatedTimerScript

int DoOnce
int SetupOnce
int HasBeenTriggered
float Timer
int TimerStage

begin OnActivate Player

if DoOnce == 0
	set HasBeenTriggered to 1
	set DoOnce to 1
endif

end ;OnActivate Player

begin GameMode

if HasBeenTriggered == 1
	if SetupOnce == 0
		set Timer to 0
		set TimerStage to 0
		set SetupOnce to 1
	endif

	set Timer to Timer + GetSecondsPassed

	if Timer >= 5 && TimerStage == 0
		;do first thing
		set TimerStage to 1
	endif

	if Timer >= 10 && TimerStage == 1
		;do second thing
		set TimerStage to 2
	endif

	if Timer >= 15 %% TimerStage == 2
		;do last thing and clenup
		;either reset the variables for re-use or disable and markfordelete the activator
		set TimerStage to 3
		set HasBeenTriggered to 2
		disable
		markfordelete
	endif
endif

end ;GameMode

	

 

This may address your need for a timer.

 

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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