RMMV strange issue with my Action sequence [YEP]

Status
Not open for further replies.

DRG

Orange juice lover, Sunny D Hater.
Veteran
Joined
Apr 23, 2018
Messages
131
Reaction score
51
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
Veteran
Joined
Oct 8, 2018
Messages
7,513
Reaction score
3,021
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
Veteran
Joined
Jun 29, 2020
Messages
1,144
Reaction score
1,417
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.
Veteran
Joined
Apr 23, 2018
Messages
131
Reaction score
51
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.
Veteran
Joined
Apr 23, 2018
Messages
131
Reaction score
51
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
Veteran
Joined
Oct 8, 2018
Messages
7,513
Reaction score
3,021
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
Veteran
Joined
Jun 29, 2020
Messages
1,144
Reaction score
1,417
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
Veteran
Joined
Oct 8, 2018
Messages
7,513
Reaction score
3,021
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.
Veteran
Joined
Apr 23, 2018
Messages
131
Reaction score
51
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
4,639
Reaction score
3,770
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

imgur sure is getting weird, one day I lose gradually all my images, the other I get them back randomly and then again they disappear again.
Despite OPT2 praise it still has some strange stories in it. Lady Mikka is trying to work herself to death because of guilt. Guilt over what? ¯\_(ツ)_/¯ So instead of finding a NPC to have a heart to heart with her they decide the cure is a new kimono. So when she drops dead she'll at least be well dressed. I haven't even got to the strange part yet.
Did so much work on the game today. I wish I could post it all in this status update but there is a character limit of course haha. I thought about making a topic for updates, though... maybe.
The most recent sign that I am old. I have done martial arts for over 4 decades. Never HAD to stretch out. Good, of course, but never required. Was doing some kicks in the kitchen because, why not, and I felt a pop in the back of my thigh. Now I am limping around. Gotta love getting old.
One of the biggest perks of being fluent in English is how many new and interesting recipes I am able to find and try out that I would have hardly come across if I just spoke my mothertounge :3

Forum statistics

Threads
131,683
Messages
1,222,227
Members
173,435
Latest member
TheAmplifier
Top