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,502
Reaction score
3,013
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,121
Reaction score
1,360
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,502
Reaction score
3,013
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,121
Reaction score
1,360
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,502
Reaction score
3,013
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,611
Reaction score
3,717
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 Posts

Latest Profile Posts

Ooops ended up trying out making my own A2 tile page instead of testing doors everywhere. Went well so far I think.
I guess I'm done making a blue squirrel's life difficult for posting new threads on different forums.
That's just for today so don't get used to this, squirrel-ish friend! :p
Got new hard drive, now trying to install the softwares I lost to the dead drive, and more than half of them won't install because they're already installed on the dead drive, and uninstallers won't run because they can't find where their programs are installed. So I take it having a drive die on you screws you in more ways than just data loss. >:\
PC got fixed finally. Back online again. Turns out I have no business trying to self repair pcs because it was getting to like 176F / 80C. Shop installed a totally new cooling system and now it runs fine and is super quiet.
When you're making major progress, but have to stop to go to work.

Forum statistics

Threads
131,484
Messages
1,220,206
Members
173,225
Latest member
ZecaVn
Top