damage multiplier
Hello,
My current problem is the following: I got a damage multiplier on every gun depending on the amount of points you have on a certain skill (Power). PHP Code:
When it's maxed out it actually works. But below level 50 it's all the same damage (100%). Is there a reason that it won't work correctly? P.S. I got an error index out of bounds on the "new powers = (player_power[inflictor]/50)" line. I've tried attacker instead of inflictor aswell. |
Re: damage multiplier
You've got integer variables, the division will be rounded, just use float variables and problem solved.
About index out of bounds, use attacker but check if attacker is a player first. Inflictor can be the HE grenade that killed the victim, but attacker is still the HE's owner, but if victim was killed by a gun, then inflictor is equal to attacker. |
Re: damage multiplier
So basicly the idea of a floating variable is used for an integer? (If so I would now understand the purpose of a float). I will try it out anyway.
Thanks. Edit: I've tried to change it to what you suggested with the floating variable. However I got a tag mismachted now because of the float. I've also tried to put a check if the attacker is a player (I believe it's done this way, if not please correct me). PHP Code:
|
Re: damage multiplier
Use Float not float, there is a difference.
Use client print to make sure you are getting a good value, %f for float. |
Re: damage multiplier
I tried to change it to what you said, but I got a tag mismatch once again.
PHP Code:
|
Re: damage multiplier
Try 1.0 + ( float( player_power[ attacker ] ) / 100.0 )
or Float: ( player_power[ ... |
Re: damage multiplier
After making it this code it's finnaly working! Thanks Bugsy!
PHP Code:
|
| All times are GMT -4. The time now is 19:38. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.