YesNoOk
avatar

Getting a helper to read P2's variables? (Read 3435 times)

Started by Minakata Moriya, September 28, 2020, 05:52:52 pm
Share this topic:
Getting a helper to read P2's variables?
New #1  September 28, 2020, 05:52:52 pm
  • *
    • USA
I'm working on a projectile reflect setup, and I've gotten it functioning, except for one thing: I need the newly generated "reflected" projectile to have variable speeds, depending on the type of projectile being reflected.

The method I thought to try was to put this in the projectile summon state.
Code:
[State 1050, ReflectStrength]
type = VarSet
trigger1 = time = 0
var(11) = [between 0 and 2]

My projectiles are helpers in this case, and the reversaldef is being triggered by a helper...

Code:
[State 1000, Projectile]
type = Helper
trigger1 = time = 0
trigger1 = enemy, Name = "testname"
name = "Proj Reversed"
id = 1050 + (enemy, var(11) * 10)
postype = p1
pos = 80, 0
stateno = 1050 + (enemy, var(11) * 10)
ownpal = 1

The idea being that it would read that 0/1/2 and then summon the projectile from state 1050, 1060, or 1070, as appropriate. But no such luck. I tried putting that varset inside the original projectile helper state, too, but still nothing. It only ever calls the helper at state 1050. Anyone have any ideas? Thanks in advance.
Last Edit: September 30, 2020, 04:43:04 pm by Minakata Moriya
Re: Getting a helper to read P2's variables?
#2  September 28, 2020, 08:50:45 pm
  • avatar
  • **
    • USA
sorry for my english, the 2nd part of the code you pasted is from the character that is doing the reflecting right?
Re: Getting a helper to read P2's variables?
#3  September 28, 2020, 10:16:34 pm
  • *
    • USA
Correct. In essence, the helper absorbs and kills P2's projectile and summons a copy of it to send back at P2.
Re: Getting a helper to read P2's variables?
#4  September 29, 2020, 03:17:40 pm
  • ****
Re: Getting a helper to read P2's variables?
#5  September 29, 2020, 03:30:17 pm
  • *
    • USA
It is. There's a lot of shared code, and none of the characters are going to work in vanilla MUGEN.
Re: Getting a helper to read P2's variables?
#6  September 29, 2020, 05:15:15 pm
  • *
    • Mexico
    • Reptorebanador@gmail.com
Re: Getting a helper to read P2's variables?
#7  September 29, 2020, 08:49:55 pm
  • avatar
  • **
    • USA
2nd the above and also, if this is a full game I feel like using a var and detecting it is a bit over complicated maybe? I feel theres an easier way you could do it, unless i am still understanding the concept wrong. I guess I feel the concept could be even easier since its a full game. i never really seen a defelect like this (even for different projectiles)
Re: Getting a helper to read P2's variables?
#8  September 29, 2020, 09:31:02 pm
  • *
    • USA
I suspect I may well be overcomplicating things. If I can just find a way to read the P2 helper projectile's name, that would do it. But I seem to be unable to figure out how to make sure I'm getting the P2 helper's name and not P2's name.
Re: Getting a helper to read P2's variables?
#9  September 30, 2020, 03:36:06 pm
  • *
    • USA
Fixed with putting a parentvarset in the helper projectile state.

Code:
[State 1050, ReflectStrength]
type = ParentVarSet
trigger1 = time = 0
var(11) = 0

That makes this work like a charm.

Code:
[State 1000, Projectile]
type = Helper
trigger1 = time = 0
trigger1 = enemy, Name = "testname"
name = "Proj Reversed"
id = 1050 + (enemy, var(11) * 10)
postype = p1
pos = 80, 0
stateno = 1050 + (enemy, var(11) * 10)
ownpal = 1

Thanks, everyone.