- 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.
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>