The concept is take value and multiply by 2. I don't think there's anything that can necessarily make the multiplication of 2 not the multiplication of 2. One scenario I can imagine this not "working" would be a shared method that does some operator overloading for basic mathematical operations. In the event the game is doing this, maybe due to some convoluted value encryption, a script like the one above, placed at shared code, would apply itself to every instance of that encrypted value type, making the script not work as intended.
But, yea, taking something like:
Code: Select all
player.experience += additionalExp
and turning it into:
Code: Select all
player.experience += additionalExp * 2
is just how math works and shouldn't necessarily stop working.
The idea of that specific script not working isn't really the question you need to ask, but whether multiplying a value by 2 is what you need/want to do.
Edit: Oh, I suppose one instance where, not the concept, but the majority of that code won't work is if the value is being obtained from the stack, via the ESP register. The push and pops used to save and restore the original values in the reigster would shift the ESP register position, making the original code not work. Like this example:
push rdx
mov rdx, [rsp+28] // This +0x28 position is not the same position now that rdx was pushed and rsp has moved by eight bytes
...