Jump to content

Ammo Script Feedback/Advice


Deleted2746547User

Recommended Posts

Advice on tweaking/improving this script?

I've attached it to a weapon that uses a form list for its ammo. One type of ammo is a depleted uranium round. One of the effects of firing a DU (in this mod) is it turns the body into a pile of ash.

It seems to mostly work right except for a few problems. 1.) when a companion fires the same weapon but does not have the same ammo (eg a 308 round vs. a 308 DU round) - it still sometimes gives the same effect. 2.) Not a big deal but sometimes the ash pile disappears along with the body - I suspect that has to do with the disable/delete 3.) Not a big deal but the inventory completely disappears and the ash pile isn't searchable. Ideally any weapons etc would appear in the ash pile and when you emptied it, the ash pile would also disable/delete. **trying to always keep the memory eating garbage to a min.** I suppose for the sake of 'realism' only certain items would remain through a form list check of some sort - though that would take more knowledge than I have when coding. Would you go about attaching a self disabling/deleting script to the ash pile... but if so, how would that look?

I suppose a workaround for the companion issue is to only place the script on a special weapon for the player if I can't figure another way around it since the script works 'right' when i fire it (ie if I fire a regular 308 round no ashpile and no disappearing body).

Suggestions?

ScriptName BlackbriarUraniumRoundScript
Float Timer
Short DoOnce
short IsPile
ref rTarget
ref rCurrentAmmo
ref rPile
Begin ScriptEffectStart
set rCurrentAmmo to GetPlayerCurrentAmmo
if GetDead == 1 && rCurrentAmmo == BlackbriarAmmo308mm2RHIP ; if target is dead and if the ammo your gun is using is a specific item
set rTarget to getdead
SetCriticalStage DisintegrateStart
PMS LaserCritGlowFXShader
PMS effectLaserDisintegration
Set Timer to 1.8
Set DoOnce to 0
else
Set DoOnce to 1
endif
End
Begin ScriptEffectUpdate
If DoOnce == 0
If IsPile == 0
If Timer <= 0.5
AttachAshPile
Set IsPile to 1
set rPile to IsPile
EndIf
EndIf
If Timer <= 0
SetCriticalStage DisintegrateEnd
rtarget.removeallitems rPile
SMS LaserCritGlowFXShader
SMS effectLaserDisintegration
Set DoOnce to 1
EndIf
Set Timer to (Timer - GetSecondsPassed)
EndIf
End
Edited by Guest
Link to comment
Share on other sites

  • Recently Browsing   0 members

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