Timer and MarkForDelete

Post » Sun Jun 03, 2012 2:49 pm

Hello,

I have a crossbow which shoots bolts. I want to pick up the bolts, that I shot.
For now I have added a Script to the "Impact Script" for the Ammo "Bolt".

When I hit an enemy, the pickable bolt is created under the enemy. Thats ok for me.
But I want to disable and markfordelete the bolt, if I can't pick it up for some reaon (can't find it or whatever). For clean scripting und to prevent savegame bloat.
So I want the script to wait maybe 10 seconds before setting disable and markfordelete, so I can pick up the shot bolt in this time (10 sec).

My Script so far:

scn 213ArmbrustPlaceAtMe001ref BoltTemp21short BoltShotfloat BoltTimerBegin ScriptEffectStart  set BoltTemp21 to PlaceAtMe 01Abolt 1 1 0  set BoltShot to 1  set BoltTimer to 10EndBegin GameModeif BoltTimer > 0	set BoltTimer to BoltTimer - getSecondsPassed		else		   if BoltShot == 1		   BoltTemp21.disable		   BoltTemp21.markfordelete		   set BoltShot to 0		endifendifEnd

The Bolt is "placed-at-me" under the enemy but won't be disabled after 10 seconds.
Where is my mistake?

Do I need a "Quest-Script" for this? The above script is only an "Effect-Script" for the Impact of the Ammo.

Greetings
User avatar
bimsy
 
Posts: 3541
Joined: Wed Oct 11, 2006 3:04 pm

Post » Sun Jun 03, 2012 7:45 am

As an alternative what about just adding a bolt to the target container reference when it hits? That way you can loot bodies the usual way, and let the game engine take care of the cleanup. You could also easily use a random per cent to determine if a bolt gets added on impact, or not if it broke and was destroyed.
User avatar
Isaiah Burdeau
 
Posts: 3431
Joined: Mon Nov 26, 2007 9:58 am

Post » Sun Jun 03, 2012 6:31 pm

Adding the bolt to the victim's inventory is a good idea. But I think the problem with your script is you need to use a ScriptEffectUpdate block with scripteffectelapsedseconds - not a GameMode block. http://geck.gamesas.com/index.php/ScriptEffectElapsedSeconds
User avatar
Lily Something
 
Posts: 3327
Joined: Thu Jun 15, 2006 12:21 pm

Post » Sun Jun 03, 2012 6:22 pm

Thanks for the replies!
Yes, that is my alternative, too. Have done this yesterday and it worked good.
However, I want find the error in my script. I will look into the ScriptEffectUpdate.
User avatar
Marlo Stanfield
 
Posts: 3432
Joined: Wed May 16, 2007 11:00 pm


Return to Fallout: New Vegas