Problem trying to use <scriptEffectElapsedSeconds>

Post » Fri Dec 02, 2011 9:43 am

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
Abi Emily
 
Posts: 3435
Joined: Wed Aug 09, 2006 7:59 am

Post » Fri Dec 02, 2011 4:07 am

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
Lisa Robb
 
Posts: 3542
Joined: Mon Nov 27, 2006 9:13 pm

Post » Fri Dec 02, 2011 7:41 am

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
Spaceman
 
Posts: 3429
Joined: Wed May 23, 2007 10:09 am

Post » Fri Dec 02, 2011 2:57 am

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
Ridhwan Hemsome
 
Posts: 3501
Joined: Sun May 06, 2007 2:13 pm

Post » Fri Dec 02, 2011 2:20 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
Rebekah Rebekah Nicole
 
Posts: 3477
Joined: Fri Oct 13, 2006 8:47 pm

Post » Fri Dec 02, 2011 2:11 pm

Yes it runs one time when the spell ends.


Works like a charm, thanks both of you.
User avatar
Ria dell
 
Posts: 3430
Joined: Sun Jun 25, 2006 4:03 pm


Return to Fallout: New Vegas