Problem trying to use <scriptEffectElapsedSeconds>

Post » Sat May 28, 2011 7:11 pm

SCN JetSpeedBoostBegin ScriptEffectStart	ModActorValue SpeedMult 50		EndBegin ScriptEffectUpdatelabel 1			If ScriptEffectElapsedSeconds >= 10				ModActorValue SpeedMult -50			Else GoTo 1			EndIfEnd


I'm trying to add a script to make Jet increase movement speed (The increase speedmult ability doesn't work in game and comes up as (null) in the pipboy). The mod+50 part works, but doesn't return to normal after the base effect's duration wears off, so I tried creating a timer in the script, but it still doesn't reset the speedmult.

SCN JetSpeedBoostBegin ScriptEffectUpdate	ModActorValue SpeedMult 50		label 1			If ScriptEffectElapsedSeconds >= 10				ModActorValue SpeedMult -50			Else GoTo 1			EndIfEnd


Also doesn't work, any ideas?
User avatar
jesse villaneda
 
Posts: 3359
Joined: Wed Aug 08, 2007 1:37 pm

Post » Sat May 28, 2011 4:37 pm

I think the Loop is part of the problem because ScriptEffectElapsedSeconds updates at every iteration of the ScriptEffectUpdate block, so it's always 0. Another problem is that if the timing actually did work, the modav -50 would be applied repeatedly (every frame). You don't need the Loop because the ScriptEffectUpdate block is looping for you every frame. So you might try something like this:

SCN JetSpeedBoost  float fTimershort iDone Begin ScriptEffectStart  	ModActorValue SpeedMult 50                 End  Begin ScriptEffectUpdate 		if (iDone)	else		if fTimer >= 10			ModActorValue SpeedMult -50			set iDone to 1		; guard against multiple ModActorValue		else			set fTimer to fTimer + ScriptEffectElapsedSeconds		endif	endifEnd

User avatar
helen buchan
 
Posts: 3464
Joined: Wed Sep 13, 2006 7:17 am

Post » Sat May 28, 2011 1:06 pm

Wouldn't it just be simpler to use the ScriptEffectFinish block to remove the speedmult?

Edit: Side note ScriptEffectElapsedSeconds does not tell you how long the spell has been running, it only returns the elapsed time since the last time the scripteffect block ran. So it's only going to give numbers between 0 and 1 every time. That's what I get from the description anyway. Not sure how this is intended to be used. I'll have to look at some vanilla scripts to confirm.
User avatar
Louise Dennis
 
Posts: 3489
Joined: Fri Mar 02, 2007 9:23 pm

Post » Sat May 28, 2011 6:33 pm

I think the Loop is part of the problem because ScriptEffectElapsedSeconds updates at every iteration of the ScriptEffectUpdate block, so it's always 0. Another problem is that if the timing actually did work, the modav -50 would be applied repeatedly (every frame). You don't need the Loop because the ScriptEffectUpdate block is looping for you every frame. So you might try something like this:

SCN JetSpeedBoost  float fTimershort iDone Begin ScriptEffectStart  	ModActorValue SpeedMult 50                 End  Begin ScriptEffectUpdate 		if (iDone)	else		if fTimer >= 10			ModActorValue SpeedMult -50			set iDone to 1		; guard against multiple ModActorValue		else			set fTimer to fTimer + ScriptEffectElapsedSeconds		endif	endifEnd



Didn't work, not sure why, it seems logical...

Edit: Cancel that, when playing around with scripteffectfinish I noticed my speed only returns to normal after I've crouched. Weird.


Wouldn't it just be simpler to use the ScriptEffectFinish block to remove the speedmult?


Begin ScriptEffectStart        ModActorValue SpeedMult 50                EndBegin ScriptEffectFinish        ModActorValue SpeedMult -50End


Does the scripteffectfinish block start when the base effect's duration is over?
User avatar
Matt Fletcher
 
Posts: 3355
Joined: Mon Sep 24, 2007 3:48 am

Post » Sat May 28, 2011 5:50 pm

Does the scripteffectfinish block start when the base effect's duration is over?


Yes it runs one time when the spell ends.
User avatar
Astargoth Rockin' Design
 
Posts: 3450
Joined: Mon Apr 02, 2007 2:51 pm

Post » Sat May 28, 2011 8:52 pm

Yes it runs one time when the spell ends.


Works like a charm, thanks both of you.
User avatar
Sara Johanna Scenariste
 
Posts: 3381
Joined: Tue Mar 13, 2007 8:24 pm


Return to Fallout: New Vegas