Drummin
  • Drummin
  • 100% (Exalted)
  • General Topic Starter
17 years ago
I was wondering if this makes sense to any of you.
If you have a condition that always needs to be checked and you're setting
a flag, wouldn't it be better to not have any conflicts in the script.
A simple script would be like this and would always be on.

*** IF ***
Unit in area etc...
*** THEN ***
Set flag to TRUE.
*** ELSE ***
Set flag to FALSE.

But because a unit will be in an area for some time, this script will keep trying to set
the flag to true or false. This could cause game lag if there were many scripts like this.
(Which is the case in the map I'm working on.)


Instead, I'm using the same conditions for two scripts like this.


(The first script deactivates upon success and activates the second.)

*** IF ***
Unit in area etc...
*** THEN ***
Set flag to TRUE.
Enable script two.

(The second script is inactive with no deactivation.)

*** IF ***
Unit in area etc...
*** THEN ***
Null operation. (Does nothing.)
*** ELSE ***
Set flag to false.
Enable SwitchScript.

(The SwitchScript just resets things.)

*** IF ***
True.
*** THEN ***
Enable Script One.
Disable Script Two.

Though this takes three times the coding, it seems more reliable and would
cause less game lag. What's you thoughts on this?
Sponsor
Yoshi714
17 years ago
Wouldnt the second script causes just as much lag as the first one with trying to continually detect where the unit is? Also, do you need 3? Or can't you just have the second one deactivate and activate the first script.
Turtling is not a strategy, its a weakness
Drummin
  • Drummin
  • 100% (Exalted)
  • General Topic Starter
17 years ago
Well, my thought is that the second script is only active while the unit is in area and does nothing. I don't believe that a script being active causes lag, only if it is trying to do something that is already done as in set the flag to true. I didn't want the second script to deactivate itself though that might have worked. As the script is set to stay active once activated, I needed a script to do it.
Me Myself and Pi
17 years ago
Don't worry about a script causing lag like. You won't detect any. But after you done with the area thing, you should disable it. Having multiple scripts like might cause lag, but I dought it. But if you're really worried about it, these to scripts below will do just the same thing, without having an action be activated over & over again. (If you wish to create these scripts, just leave the properties as default.)

Script 1:
*** IF ***
    Unit '???' enters  area '???'
*** THEN ***
  Set Flag named '???' to TRUE
  Enable Script 'Script 2'.

Script 2:
*** IF ***
    Unit '???' is outside  area '???'
*** THEN ***
  Set Flag named '???' to FALSE
  Enable Script 'Script 1'.
Drummin
  • Drummin
  • 100% (Exalted)
  • General Topic Starter
17 years ago
Well I do have several hundred of these scripts (36x12) which I just finished converting to the three script format. (Took days to do)
Your two script idea would work well, but as I didn't want to use named units, I used the comparison line which doesn't have an "outside" area.
[???] Player '???' has Greater Than or Equal To 1 unit or structure of type '???' in the area '???'

I certainly could have used the following for the second script.
[???] Player '???' has Less Than 1 unit or structure of type '???' in the area '???'

That would have been a good way to go.
Thanks for your input!!!