Hey all, first off i'd like to mention that i'm new to IL editing!
And here's what i'm trying to do in c#, taken from Gun.shootPlayer()
Code:
...
if ((limb == 5) && (user.model.GetComponent<Clothes>().vest != -1))
{
num *= ArmorStats.getArmor(user.model.GetComponent<Clothes>().vest);
}
if (limb == 4) && (user.model.GetComponent<Clothes>().hat != -1)
{
num *= ArmorStats.getArmor(user.model.GetComponent<Clothes>().hat);
}
if (user.model.GetComponent<Clothes>().hat == 0)
{
num *= 0f;
}
...
pseudocode is; if the person getting shot is wearing fancy shades, the bullets do no damage.
Red is existing code and green is what i would like to add, but when i add it (using reflexil), save and reload it ends up looking like this:
Code:
if (user.model.GetComponent().hat == 0)
{
num *= 0f;
}
IL code is attached (not allowed to post link to imgur yet, sorry!)
I mostly just took code from above it and tried to replicated it to my need, however i'm not sure if i picked the correct GetComponent, the one i pointed to was in UnityEngine\GameObject\GetComponent<T>() :T, but in the reflexil editor it shows up as GetComponent() : T
Help is appreciated!
EDIT: Figured it out, had to call GetComponent(type string), attached the updated IL code for anyone else who got stuck like i did
Code:
if (user.model.GetComponent("Clothes").hat == 0)
{
num *= 0f;
}
Can i mark this as solved somehow?