As far as I understood, the LUA code that can be added at each waypoint is treated as a "local function".
I found this in the wiki:
Code: Select all
self.free_field1 = nil; -- free field for user use
self.free_field2 = nil; -- free field for user use
self.free_field3 = nil; -- free field for user use
self.free_counter1 = 0; -- free counter for user use
self.free_counter2 = 0; -- free counter for user use
self.free_counter3 = 0; -- free counter for user use
self.free_flag1 = false; -- free flag for user use
self.free_flag2 = false; -- free flag for user use
self.free_flag3 = false; -- free flag for user use Code: Select all
player.free_flag1 = false
But what should I do, if I need more variables? And I'd like to give them more meaningfull names.
Maybe define a new class holding my variables and store such an object in one of the player fields?
Other solutions?
---
Next question:
Sometimes it happens that the scripts targets a mob, that is behind an obstacle. After several
failed attacks it cancels this target and looks for a new target. It happened several times to me,
that my script ran into a situation, that there were 3 mobs that were behind obstacles and so
the script did loop though these 3 mobs forever.
I was thinking to put mobs onto a "black list", if they cannot be attacked. When scanning for a new
target, the mobs on the black list should be ignored. The black list should be cleared when reaching
a new waypoint.
Where should I put such code?
Thx for any comments