Okay So I have a durabilityInt = 0; and a modifiedDurability = .55; and an itemEquipInt = 0;
The itemEquipInt changed based on a dropdown menu that the player selects #1-60
For each # ex: 2 then modifiedDurability is multiplied by 2. This script all works fine. What I can’t get to work properly is multiplying the modifiedDurability by durModifier ← (1.5)
How do I Multiply modifiedDurability (integer) by durModifier (float)?
Finding this question as I’m doing a search here.
You have probably moved on and finished your project by now.
Anyway, in case someone else finds this question, here’s some explanation :
there is no multiply operator for float and int, and while a float cannot be implicitly converted to an int, an int is implicitly converted to a float. So the compiler will convert the int to a float, and the result will be a float. You need to cast is back to an int.
int myInt = 2;
float myFloat = 2.7f;
int result = (int)(myInt * myFloat);
float YourAnswerIs = modifiedDurability * durModifier;