How do I save the "pos x" values ​​

Started by ryuhoshi490, November 05, 2024, 02:48:21 AM

Previous topic - Next topic

ryuhoshi490

I ask from my ignorance.
I have an explod that is created in the position of p2 (explod1). And I need to create another explod, in another statedef, but in the same position as explod1, regardless of whether p2 has already changed position.

explod1 uses "postype = p2" but it doesn't work to use the same value for explod2 because p2 has already changed position.

How do I save the x values ​​of explod1 to use them in explod2?

VictorCYBR

You can set a variable.


[State 0, VarSet]
type = VarSet
trigger1 = !Time
var(5) = EnemyNear, Pos X

[State 0, VarSet]
type = VarSet
trigger1 = !Time
var(6) = EnemyNear, Pos Y


Then spawn the explods based on the variables:


[State 0, Explod]
type = Explod
.
.
.
pos = var(5), var(6)
postype = left
.
.
.


I can't remember exactly but I guess you should use postype = left in this case. Try experimenting with it.

ryuhoshi490

thanks. I tried with those values, ​​but I can't get them to be accurate enough.

VictorCYBR

By the way, I read your post again and noticed you only need Pos X and not Pos Y, so you can ignore the second varset.
Maybe the position is not accurate because of the triggers you're using in the varset, or even the placement of your varset. You need to place the varset before the explods. Also make sure the var is not being used anywhere. Lastly, make sure the trigger for the varset is correct. I gave you an example which you should change according to your own needs.

Odb718

This sounds better suited for a helper instead of an explod.
Spawn the helper the same way you spawn the explod. Then in the helper, you could make it's animation be the first explod, or it could spawn an explod immediately and then wait for the 2nd explod's conditions to be met to make a 2nd explod.
You could set up a destroyself after 400 tics or when both explods are finished
vVv Gouken718 vVv SabreTooth718 vVv