If i change a existing uint variable in a struct compared to normal ones does it consumes the same amount of gas(cost)? Im trying to optimize my contracts cost
If you modify an uint256 in a struct it should cost about the same than modifying a regular uint256 variable (a little extra is has to be used to adjust the offset inside the struct).
The compiler tries to packed together smaller types (like bool, uint8, uint16, uint32, etc.) to use less gas when storing an struct. But it has to generate extra code and that cause the gas to increase both when deploying and when executing a function.
Try different layouts of your struct to have together the smaller types and/or change the types to smaller ones. Measure the gas use carefully, a good change might cause too much gas use in practice, or your contract grow too large.