I made Rule1 and Rule2.
Rule1 makes array of icons, which is made from random vector.
and Rule1 also makes array of vectors, consist of above random vectors.
array of icons is entity_arr, array of vectors is vector_arr.
arr_size is size of both array, number of icons.
Rule2 destroy and remove the icon nearby player and vector of the icon, from entity_arr and vector_arr.
Rule3 remove and destroy all vectors and icons from the arrays at once.
Problem is Rule3 destroy all icons from array, which makes icons invisible but Rule2 destroy all icon, which can’t make icons invisible. Though both Rule use same code!
I need to destroy icon entity successfully in specific condition, not at once.
below is the code.
#Timer increment 1 per 0.01 seconds
Rule0
Event
Ongoing - Global;
Action
While(True == True);
Wait(0.010, Ignore Condition);
Global.timer += 1;
End;
# makes icons array
Rule1
Event
Ongoing - Each Player
Team - All
Player - All
Actions
For Global Variable(j, 0, Global.arr_size, 1)
# vector of icon, which is nearest walkable position
Global.random_vector = ...
Global.possible_randvec = Global.possible_randvec = Nearest Walkable Position(Global.random_vector)
# store vector to vector_arr
Global.vector_arr[Global.j] = Global.possible_randvec
# create icon, reevaluation: VISIBLE TO
Create Icon(All Players(All Teams), Global.possible_randvec, Ring Thin, Visible To, Blue, True)
# append icon to entity_arr
Global.entity_arr[Global.i] = Last Created Entity;
# Check player nearby icon
Rule2
Event
Ongoing - Each Player
Team - All
Player - All
Condition
(Global.timer >= 1500 && Global.timer % 20 == 0) == True;
ACTIONS
For Global Variable(j, 0, Global.arr_size, 1)
If(Distance Between(Position(Event Player), Global.vector_arr[j]) <= 5)
Event Player.score += 50;
Global.vector_arr[Global.j] = Vector(0, 0, 0);
Destroy Icon(Global.entity_arr[j]);
Global.entity_arr[Global.i] = Null;
Break;
End;
End;
# Destroy all icons in entity_arr ( I didn't use Destroy all icons Action)
Rule3
Event
Ongoing - Global;
condition
Global.timer == 4000;
action
For Global Variable(k, 0, Global.arr_size, 1);
Destroy Icon(Global.entity_arr[Global.k]);
End;
Rule3 perfoms garbage collection, but Rule2 has problem. I think it’s about difference of reference and copy or synchronization or maybe just workshop itself problem…
Rule2 seems to destroy icons sometimes… sometimes work sometime don’t work but Rule3 destroy all icons with same code.
I tried almost all actions but I can’t fix Rule2 myself, please expert help me.