I want to use a rule that destroys a specific effect in a specific location but i cant find out how
Anyone can give a hand?
I want to use a rule that destroys a specific effect in a specific location but i cant find out how
Anyone can give a hand?
The only way to access a specific effect is with âLast created entityâ.
So whenever you create an effect you might want to specifically destroy, you need to store it somewhere - probably by appending it to an array (modify variable, append, last created entity)
At a specific location, you also need to keep track of the position of said entity.
The common way to do this is this pattern:
Youâll have two arrays - one of the entity IDs, for removal, and one of the entity positions. If you have varying radii (e.g. different sizes spheres), youâll need a 3rd array that stores the radius value. Iâll continue as though all your radii are the same.
Then, e.g. if you want to remove an effect when a player walks into it, you would have
Is true of any ( var B, distance between current array element and player position < radius == true)
var Z = filtered array (var B, distance between current array element and player position < radius)
<< Using var Z as a temporary variable, and it now holds an array of all effect positions near the player.var Z = index of value (var B, value in array(var Z, index 0))
<< var Z is now the index in the array referring to the effect we wantDestroy effect (value in array( var A, index = var Z)
Modify var A (Remove at index, index = var Z)
Modify var B (Remove at index, index = var Z)
So, whenever you add an effect, you store its ID and its position. Whenever you remove an effect, you must then remove its ID and position.
If you do have different radii, then this gets a bit more complicated. Specifically your âis true of anyâ condition and âfiltered arrayâ action has to reverse-find the radius from the current array element by using the index of the current value. E.g:
(var C = array of radii)
Is true of any ( var B, distance between(Start = current array element, End = player position, <, Radius = value in array( var C, index = index of value (var B, current array element))))
Thing is that i already have this effect in a specific spot i can track. This beeing a global variable
I just dont know how to tell my game to destroy the effect at that variable
When you create the effect, store it in a variable using âLast created entityâ. Then when you want to destroy it, use âDestroy effectâ and pass in the variable storing the entity ID.
wellâŚI tried exactly that i think beforeâŚThis is what i had going
And on another rule
if Distance between event player and variable C is less than 1 then:
Modify player variable B, add 1
Destroy effect / global Variable C
Wait 20
Create effect / global Variable C
it didnt destroy it tho
with what you explained above, youâre passing the position vector to the âdestroy effectâ action, but you need to pass the ID of the effect.
You need to:
Then when you want to destroy it:
(although to waste less variables, I suggest using âset variable at indexâ to store everything in an array)
thanks for the help, sadly this preset just got deleted as well soâŚ
You can check my mode called âEnchanted Ana paintball but with buffsâ. Rules with tag Buff System
is what you need.
Code: ZRP60
You can ask me about anything any time you want, because itâs not that easy to understand what is going on in the code with out commentaries for actions (not for rules).