Page 1 of 1

GetWeapon() or something similiar

Posted: Fri May 06, 2016 5:06 pm
by Raught19
I'm trying to set weapon accuracy for different guns, but the same ammo.

For example:

HeavyGun1 deals 200% more damage, but has a chance to miss 20% of the time with ammo1.

SmallGun deals normal damage but never misses when using ammo1.

Is there a lua function that calls for the player's active weapon so I can specify the chances per weapon? I found one for the index, but that just returns the numbered slot its in.

Any help would be greatly appreciated!

Re: GetWeapon() or something similiar

Posted: Fri May 06, 2016 5:55 pm
by Adil
Well, you take that number and use it with the get_inventory() or something and in the end you get the desired items.

Though I don't understand what you're hoping to do after that. You can't just alter the attack parameters, nor there is accuracy parameter for machinegun and pistol.
Or actually, there's no accuracy checks for the bullets as they're instant.

Without runtime scripts, you can try altering ammunition prototypes to be real projectiles like shotgun pellets and cannon-projectile.
Then you could try specifying direction_deviation in weapon attack_parameters.

However, the prototypes are least documented element of the game, and I have only vague memory of making attempts of altering cannon turret accuracy. I don't remember or possess results on that but I believe that attack_parameters from gun override those of ammo, whenever they collide.
Also, they say such change of attack parameters might bork up gun turret ai as it relies on knowing the exact damage that will be dealt to enemy. (At least until 0.13 release.)

Re: GetWeapon() or something similiar

Posted: Fri May 06, 2016 6:08 pm
by Raught19
Adil wrote:Well, you take that number and use it with the get_inventory() or something and in the end you get the desired items.

Though I don't understand what you're hoping to do after that. You can't just alter the attack parameters, nor there is accuracy parameter for machinegun and pistol.
Or actually, there's no accuracy checks for the bullets as they're instant.

Without runtime scripts, you can try altering ammunition prototypes to be real projectiles like shotgun pellets and cannon-projectile.
Then you could try specifying direction_deviation in weapon attack_parameters.

However, the prototypes are least documented element of the game, and I have only vague memory of making attempts of altering cannon turret accuracy. I don't remember or possess results on that but I believe that attack_parameters from gun override those of ammo, whenever they collide.
Also, they say such change of attack parameters might bork up gun turret ai as it relies on knowing the exact damage that will be dealt to enemy. (At least until 0.13 release.)
Thanks for the response :) I will try going through get_inventory()

Yeah basically I have the accuracy working by messing with attack parameters, but its okay because its for ammo that the turrets won't touch. Just doing some test projects for something bigger I had planned.