RMMV strange issue with my Action sequence [YEP]

Status
Not open for further replies.

DRG

Orange juice lover, Sunny D Hater.
Regular
Joined
Apr 23, 2018
Messages
143
Reaction score
56
First Language
english
Primarily Uses
RMMV
Hello!
i'll try and keep things brief, I have a food system in a project I'm working on where certain items, when consumed, increase the stats of the target, but also increases their hunger, and once they're full, they can't eat anymore and have to fight battles to get hungry again. I have most of the system sorted out, save for the actual food items.

I used DreamX_SaveTarget to save the targeted actor ID to variable 19, and using that I would use action sequences to check what the variable equels and then to change the other variables. however, for some reason when using the item, the targeted actor gets the stat boosts, but doesn't get their hunger increased, the former of which can only happen after the hunger has been increased according to the action sequence.

Can anyone that's better than me at this take a look and see what's wrong? if so that'd be very helpful!

below is the action sequence in its entirety, as well as a cutdown simplified version that has notes to explain what I'm trying to achieve better.

Code:
<target action>
if $gameVariables.value(19) == 1
  if (target.isStateAffected(13))
    GAIN ITEM 24: 1
    COMMON EVENT: 11
  else
    if $gameVariables.value(9) < 100
      CHANGE VARIABLE 9 += 1
      action effect
      if $gameVariables.value(9) > 100
      ADD STATE 13: target, (show)
      end
    else
      GAIN ITEM 24: 1
      COMMON EVENT: 10
    end
  end
if else $gameVariables.value(19) == 2
  if (target.isStateAffected(13))
    GAIN ITEM 24: 1
    COMMON EVENT: 11
  else
    if $gameVariables.value(10) < 100
      CHANGE VARIABLE 10 += 1
      action effect
      if $gameVariables.value(10) > 100
      ADD STATE 13: target, (show)
      end
    else
      GAIN ITEM 24: 1
      COMMON EVENT: 10
    end
  end
if else $gameVariables.value(19) == 3
  if (target.isStateAffected(13))
    GAIN ITEM 24: 1
    COMMON EVENT: 11
  else
    if $gameVariables.value(11) < 100
      CHANGE VARIABLE 11 += 1
      action effect
      if $gameVariables.value(11) > 100
      ADD STATE 13: target, (show)
      end
    else
      GAIN ITEM 24: 1
      COMMON EVENT: 10
    end
  end
if else $gameVariables.value(19) == 4
  if (target.isStateAffected(13))
    GAIN ITEM 24: 1
    COMMON EVENT: 11
  else
    if $gameVariables.value(12) < 100
      CHANGE VARIABLE 12 += 1
      action effect
      if $gameVariables.value(12) > 100
      ADD STATE 13: target, (show)
      end
    else
      GAIN ITEM 24: 1
      COMMON EVENT: 10
    end
  end
if else $gameVariables.value(19) == 5
  if (target.isStateAffected(13))
    GAIN ITEM 24: 1
    COMMON EVENT: 11
  else
    if $gameVariables.value(13) < 100
      CHANGE VARIABLE 13 += 1
      action effect
      if $gameVariables.value(13) > 100
      ADD STATE 13: target, (show)
      end
    else
      GAIN ITEM 24: 1
      COMMON EVENT: 10
    end
  end
if else $gameVariables.value(19) == 6
  if (target.isStateAffected(13))
    GAIN ITEM 24: 1
    COMMON EVENT: 11
  else
    if $gameVariables.value(14) < 100
      action effect
      CHANGE VARIABLE 14 += 1
      if $gameVariables.value(14) > 100
      ADD STATE 13: target, (show)
      end
    else
      GAIN ITEM 24: 1
      COMMON EVENT: 10
    end
  end
end
</target action>

Code:
<target action>
//check if the actor id
if $gameVariables.value(19) == 1
//check if the actor has the "sick" status effect
  if (target.isStateAffected(13))
    //gives item back and displays text saying the actor is sick
    GAIN ITEM 24: 1
    COMMON EVENT: 11
  else
    //checks if target is full
    if $gameVariables.value(9) < 100
      //increases the correlated actor's hunger variable before giving the stat increases (action effect)
      CHANGE VARIABLE 9 += 1
      action effect
      //check if the hunger variable is now past the limit
      if $gameVariables.value(9) > 100
      //gives the target the sick status effect
      ADD STATE 13: target, (show)
      end
    //if the target is full but not sick, it gives the item back and displays a different message
    else
      GAIN ITEM 24: 1
      COMMON EVENT: 10
    end
  end
end
</target action>

1680416103422.png
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,246
Reaction score
3,518
First Language
Dutch
Primarily Uses
RMMV
the code might be correct, but you miss parenthesis on the "if" parts like

JavaScript:
if $gameVariables.value(19) == 1

// should be

if ($gameVariables.value(19) == 1)

not entirely sure if you need { and } or will be readed automatically as I seen
some using without it, but the if should be in parenthesis at least on each instance
you used in your notetag and should work afterwards, otherwise, I dont know what
could be missing.
 

SGHarlekin

Orc Jester
Regular
Joined
Jun 29, 2020
Messages
1,609
Reaction score
2,554
First Language
German
Primarily Uses
RMMV
May just be me here but I think indentation and if else don't actually work in MV action sequencing.
 
Last edited:

DRG

Orange juice lover, Sunny D Hater.
Regular
Joined
Apr 23, 2018
Messages
143
Reaction score
56
First Language
english
Primarily Uses
RMMV
May just be me here but I think indentation and if else don't actually work in MV action sequencing.
If else is part of the action sequence plugin, so it should work,
or, are you saying that it's just a broken part of the plugin?

also, the indentation is just to make it easier to read for myself, it's not required or anything
 

DRG

Orange juice lover, Sunny D Hater.
Regular
Joined
Apr 23, 2018
Messages
143
Reaction score
56
First Language
english
Primarily Uses
RMMV
the code might be correct, but you miss parenthesis on the "if" parts like

JavaScript:
if $gameVariables.value(19) == 1

// should be

if ($gameVariables.value(19) == 1)

not entirely sure if you need { and } or will be readed automatically as I seen
some using without it, but the if should be in parenthesis at least on each instance
you used in your notetag and should work afterwards, otherwise, I dont know what
could be missing.
thanks for the help, but sadly this didn't work.

i didn't put parenthesis around the if on my first draft because I had made use of the if/else before in another project and the parenthesis didn't seem to be necessary for it to function.

again, thank you for trying to help,
for now i'll try seeing if I can find a workaround that'll make it function properly like common events or something
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,246
Reaction score
3,518
First Language
Dutch
Primarily Uses
RMMV
there was a plugin that can nest alot of "if, if else, else if" things, but I dont know
who made it, as it might be usefull for you.

I cannot tell if the "if condition" without paranthesis works.
as I dont know much lunatic, but only read things that could be of help.

if it didn't work out, than I dont know what is wrong with the code.
but if you use plugin correctly as the documentation said, maybe there
is something in the YEP tip and trick part that might help on those things.

there is alot of lunatic codes, in case it might help to get your skill working.

I wish you good luck on your project, and that the help you need come by
that knows lunatic code ^^
 

SGHarlekin

Orc Jester
Regular
Joined
Jun 29, 2020
Messages
1,609
Reaction score
2,554
First Language
German
Primarily Uses
RMMV
If else is part of the action sequence plugin, so it should work,
or, are you saying that it's just a broken part of the plugin?

also, the indentation is just to make it easier to read for myself, it's not required or anything
I'm saying nested ifs don't exist in action sequence.

As @ShadowDragon mentioned, there is an extra plugin that makes those possible.
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,246
Reaction score
3,518
First Language
Dutch
Primarily Uses
RMMV
[here is a link] with the nested if statements that might work for you,
as you can place as many if's you need or else if, if else.

read the document though, so it will work out for you.

if it still doesn't work, than I'm out of options though.
 

DRG

Orange juice lover, Sunny D Hater.
Regular
Joined
Apr 23, 2018
Messages
143
Reaction score
56
First Language
english
Primarily Uses
RMMV
I believe I found the issue, and it's that I never realized that action sequences just
don't work when using something outside of battle, not even stuff like changing variables or calling common events

In the end, I used the damage formula box to set my variables and then called the common event that roughly does the same thing I wanted. kinda sucks I wasted so much time on this but at least it works now.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,272
Reaction score
4,754
First Language
EN
Primarily Uses
RMMZ

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Decided to splurge and commissioned a friend to draw the main character of my game jam project. Worth it! I never could've gotten the game and the art done XD New avatar by ClockworkCrane!
One of my biggest pet peeves? Action Button events not being interactable unless they are same as character.


Like... for why?
The X-Mas and ~ all ~ December long Calendar Project seems to bring my machine right to the limit. A very good oportunity to test what my pc can do. Or at which point I should decide to take a step back from filling the rendering program with assets.
The new grafics card and ram do their job well, that's for sure. My own early Christmas gifts were a good investment.
my laptop keyboard gave up, they keep glitching out, it seems like it's time to finally replace them, honestly surprised it lasted this long.
Tiny setback. Turns out my Title Screen image and one of my primary background & avatar images are AI Generated. Glad I went back and checked all my resource links. So I am in hot pursuit of replacement images. Which is fine since I was still missing some images that I need anyway.

Forum statistics

Threads
136,895
Messages
1,271,151
Members
180,673
Latest member
SnailKing
Top