I'm going to get this out of the way, but I'm a noob. I'm doing my best, so I came to the source.
At any rate, I have a map where I have a timer kicking off every second or so. It is basically monitoring the positions of units and altering their height to simulate them floating in the water. Now, the problem I have is with switching models. Simply, I have it set now to check as the units enter the water their model is replaced in step with the timer over and over and over again. This isn't ideal because it causes the units to bug out a little and either stop animating properly or causing them to look a bit "stuttery". The same goes for changing the units weapons as they are switched over and over and over again sometimes the game bugs and the weapons aren't removed or replaced when it moves from one region to the other. So, here is my question.
How do I go from a periodic checking via the timer firing off to a static value? I want to convert the event of the unit switching from the land to the water from a constantly checked value to a static value that can be used to trigger changes. This way the model will get switched only once when the timer starts detecting a change.
I guess really I need a script that detects when a "change" has occurred rather than constantly checking for updates. So, I need a script that compares the value from the last time to the value from this time. If there is a difference it would fire off an event. Correct?
Ok, so now how would I write it? Thanks in advance!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm going to get this out of the way, but I'm a noob. I'm doing my best, so I came to the source.
At any rate, I have a map where I have a timer kicking off every second or so. It is basically monitoring the positions of units and altering their height to simulate them floating in the water. Now, the problem I have is with switching models. Simply, I have it set now to check as the units enter the water their model is replaced in step with the timer over and over and over again. This isn't ideal because it causes the units to bug out a little and either stop animating properly or causing them to look a bit "stuttery". The same goes for changing the units weapons as they are switched over and over and over again sometimes the game bugs and the weapons aren't removed or replaced when it moves from one region to the other. So, here is my question.
How do I go from a periodic checking via the timer firing off to a static value? I want to convert the event of the unit switching from the land to the water from a constantly checked value to a static value that can be used to trigger changes. This way the model will get switched only once when the timer starts detecting a change.
I guess really I need a script that detects when a "change" has occurred rather than constantly checking for updates. So, I need a script that compares the value from the last time to the value from this time. If there is a difference it would fire off an event. Correct?
Ok, so now how would I write it? Thanks in advance!