OK, I'm completely stumped. I'm trying to create a unit that has random stats. The problem I ran into is, the "eval" script for options run everytime ANY option change is made. So if a user changes an option on this unit, all his stats are re-randomized.
I tried to add another option and auto toggle it's selection to track the state, so randomize stat on first eval, set counter to true. And checking if counter = true at the top and skipping the rest of the script. Therefore it should only set the random stat once.
Except it just doesn't work. The option is set, but the stat doesn't change (if I remove the first if/then check, the stats randomize fine so that works, just not the boolean check).
HELP! Is there an easier/better way to run a script just once for a unit (EVER!)?? I also tried setting tags, but the tagis/tagcount always returned 0 even though I saw the tags for the unit under debug.
The unit is a child under a single parent if that makes a difference.
[EVAL SCRIPT]
var x as number
var y as number
if ( this.unit.option[neCounter].selection = 1 ) then
done
endif
x = random(10) + 1
if (x = 1) then
y = 8
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 2) then
y = 9
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 3) then
y = 9
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 4) then
y = 10
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 5) then
y = 10
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 6) then
y = 10
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 7) then
y = 10
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 8) then
y = 11
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 9) then
y = 11
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 10) then
y = 12
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
I tried to add another option and auto toggle it's selection to track the state, so randomize stat on first eval, set counter to true. And checking if counter = true at the top and skipping the rest of the script. Therefore it should only set the random stat once.
Except it just doesn't work. The option is set, but the stat doesn't change (if I remove the first if/then check, the stats randomize fine so that works, just not the boolean check).
HELP! Is there an easier/better way to run a script just once for a unit (EVER!)?? I also tried setting tags, but the tagis/tagcount always returned 0 even though I saw the tags for the unit under debug.
The unit is a child under a single parent if that makes a difference.
[EVAL SCRIPT]
var x as number
var y as number
if ( this.unit.option[neCounter].selection = 1 ) then
done
endif
x = random(10) + 1
if (x = 1) then
y = 8
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 2) then
y = 9
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 3) then
y = 9
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 4) then
y = 10
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 5) then
y = 10
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 6) then
y = 10
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 7) then
y = 10
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 8) then
y = 11
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 9) then
y = 11
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif
if (x = 10) then
y = 12
this.unit.basestat[mp] = y
this.unit.option[neCounter].selection = 1
done
endif