psychoorc99 Posted December 30, 2020 Share Posted December 30, 2020 I'm working on a ballistics mod, right now I'm interested in adding some damage falloff based on how far a bullet has traveled. I'm using a ScriptEffectStart block in an Impact Script to do so. What I'd like to do is get the distance a given projectile has traveled with GetProjectileRefDistanceTraveled, do some calculations, and set the projectile's final damage with SetProjectileRefDamage. Unfortunately, I'm having some trouble figuring out how to use GetHitProjectile properly. This is the essence of my code: Begin ScriptEffectStart set rTarget to GetSelf set rProjectile to rTarget.GetHitProjectile set fDistance to rProjectile.GetProjectileRefDistanceTraveled ;do calculations and get final value, using constant for testing rProjectile.SetProjectileRefDamage 3 End rTarget correctly identifies the creature/NPC that has been shot.Seems like GetProjectileRefDistanceTraveled works sometimes, but it will also return zero if I get too close to what I'm shooting and then seem to inconsistently get stuck returning zero for a while even if I shoot something else. Can always just get the attacker and find the distance between attacker and target instead.Trying to print the name of rProjectile or run SetProjectileRefDamage on it invariably fails (same for GetBaseForm and most other functions from what I can tell), it gives me an error saying that I'm trying to reference a null or base form. Not really sure what I'm doing wrong, wondering if maybe there are some parameters the projectile has to fit to be recognized? Any input is welcome. Would also be open to some other way besides SetProjectileRefDamage to dynamically set a given bullet's damage without messing with the base ammo/weapon damages (i.e. something other than SetAttackDamage or changing the base ammo traits so it does more/less damage). Link to comment Share on other sites More sharing options...
GamerRick Posted December 31, 2020 Share Posted December 31, 2020 The author of JIP is still active. Maybe ask him. Link to comment Share on other sites More sharing options...
psychoorc99 Posted January 1, 2021 Author Share Posted January 1, 2021 The author of JIP is still active. Maybe ask him. I was trying to avoid that, I was hoping someone on here knew something because I'm sure JIP has better things to do than answer random tech support DMs from someone he's never heard of. Will probably do that eventually if I don't have any luck here/troubleshooting more on my own. Link to comment Share on other sites More sharing options...
Recommended Posts