Problem with effects

I dont really know how to copy code from workshop to paste it here for you all to see, if anyone needs exact information i’ll screenshot the relevant rules instead.

Basically, i have a bug that i dont think my code is causing:
I have a player variable (nPhase) to know in which phase my boss is, this is used in a lot of rules but never modified unless a specific event occurs, once this happens a sphere is supposed to show up and you have to trigger it to commence the next phase (Modify P.V. “nPhase” + 1), the sphere is then destroyed and replaced with a different color sphere supposed to stay in place with no interaction, with no “set — variable: last effect”. In some situations a ring is also created with the first sphere, signaling an area, to then also be replaced with a non set variable ring.
The problem here is that after the 1st phase is done and you trigger 2nd phase, triggering the second sphere causes the first to dissapear with the ring, having nothing to destroy it (ive tested removing the “destroy effect” actions), nothing changes their positions either.
Not only that but the sphere and ring created after the destruction always are the next that should come (Position: Value in array Global A “nPhase”; if nPhase is 1, it checks 2. I had to change it to “nPhase - 1” and it works when it shouldnt) as the action that changes the phase is like 10 actions after the creation of the spheres and the first action in the list that does not involve effects works properly.

Note: I am only using 2 relevant rules, one to trigger the creation of the sphere and ring, and the other to destroy both, replace them and commence next phase. The only other variable involved checks the radius of the rings.

Does anyone know why is this happening?

Seeing your code would be really helpful here. By your explanation alone I can’t find the error, sorry.

There are 2 ways:

  • click on export/share code, then paste the generated code here.
  • If you are on pc you can select all the rules, then click on the copy button, go to the forum and paste (ctrl + v)
1 Like

A few hours after i posted this i found the problem:

The workshop doesnt allow the creation of multiple effects through the same action, i already knew this because using loops to create effects always ended up with only the last or none showing up, forcing me to create an action per effect wished to create, i just hadnt thought it could also be outside of loops.
In this case, using the create effect action did work as intended the first time but when called again to create another, it would immediately delete the previous because it only allows 1 per action. I fixed this by creating another rule that spawns all the effects.

Regardless, thanks for the reply. I didnt know you could copy paste rules from the workshop.

This sounds for me like you tried to create n effects at n positions in a loop. You can do that, but keep in mind that you have to set the reevaluation to “none”. If the reevaluation is not set to “none”, the position of the effect will change when you increase the loop counter. So in the end you dont have just the last effect created, but n effects overlaping all at the same position.

That couldve been the case but i couldnt have used a “none” reevaluation because i needed to move every single one of the effects (in the loop), in any case, i doubt this is the case because when i tried to put the reevaluation to “none” the effect created would just be the first and not create any other (tested outside a loop though. It should still work the same in a loop). Another thing to mention; in the loop i tried to create effects in, every single position was different (Value in array (x) index (value in array (I) index (0))) (I is an array because i looped it more than once and wasnt going to use 2+ global variables for it) so there was no chance that the effects would overlap in the same position

Then I do not understand what your problem was and how you solved it. But nvm, cause you solved it, all good :slight_smile:

Workshop doesnt work properly with the action(s) that involve creating effects, taking it as one effect per action instead of one effect per action trigger. For example:
Loop i=0 ; i<2 {
create effect blahblahblah
i++
}
in this loop it should create 2 effects, however, because it only allows 1 per action, it actually only leaves the last effect, when i=1. The first effect is replaced with the next without any “destroy effect” action(s) of the sort.

Funny then that it works fine for me.
Like I said, I guess that this happens for you because you set the position of the effects to “value in array(array, i)”
i = 0 --> effect 1 at position array[0]
i = 1 --> effect 1 at position array[1], effect 2 at position array[1]
i = 2 --> effect 1 effect 1 at position array[2], effect 2 at position array[2], effect 3 at position array[2]

To prevent this you can simply set the reevaluation of the effects to something that doesnt contain the position, e.g. none.