Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
Hi. This is my first post so I apologise if it Isn't exactly clear what I am asking for, but I'll try my best. I am trying to make an item work differently when in battle. I have made the item run a common event, which has a conditional branch. That's where I get stuck. After much experimenting, i came to the conclusion that the only way i would be able to check this, is by using a script call. After searching online the closest thing i could get was this: ' SceneManager.is?(Scene_Battle); ' Which doesn't work. I have no coding experience, so i have no idea what exactly to change to get this to work. Thanks in advance for anybodies help!
 

fallenlorelei

Veteran
Veteran
Joined
Jul 8, 2013
Messages
298
Reaction score
348
First Language
English
Primarily Uses
What does the item do out of battle and what would you like it to do in battle? Let's see if we can do this without js first.
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
It is a potion that heals instantly outside of battle. But over a few turns in battle. However, I think the real difficulty might come because I have it tied to a common event that replaces the potion with an 'empty bottle' item, so it can be 'refilled' rather than restocked.
 

fallenlorelei

Veteran
Veteran
Joined
Jul 8, 2013
Messages
298
Reaction score
348
First Language
English
Primarily Uses
It is a potion that heals instantly outside of battle. But over a few turns in battle. However, I think the real difficulty might come because I have it tied to a common event that replaces the potion with an 'empty bottle' item, so it can be 'refilled' rather than restocked.
You might be able to add multiple commands to the same common event.

Maybe you can turn on a switch every time the character enters battle (I feel like there's a plugin for battle events out there, or you can add it to your encounters if they are evented), and add a conditional branch, "If inbattle = on then add state HoT? Else... heal instantly." Then turn it off at the end of the battle.

I'm at work and can't see if this will work, but maybe you can mess around with switches.

It might be more worth your time to request a script though. Sorry I couldn't help too much! I once had an item that did 2 different things, so I thought maybe I'd have better ideas for you :)
 
Last edited by a moderator:

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
I did consider switches, but my initial thought was that I would need to add that switch into every troop. Which led me to try and find a way to tell when the player was in battle. I think switches will make it work, but being able to specifically tell when the player is in battle would allow me to keep everything within the one common event.

No problem! Iv found that just talking it through can be enough to strike an idea!
 

fallenlorelei

Veteran
Veteran
Joined
Jul 8, 2013
Messages
298
Reaction score
348
First Language
English
Primarily Uses
I did consider switches, but my initial thought was that I would need to add that switch into every troop.
That's true. In another game I made, I put all of my evented encounters (who roamed the map) onto a common event, just so I could do things like add switches without editing *all* of my monsters.

 Iv found that just talking it through can be enough to strike an idea!
Yes! My favorite solution! Good luck :D
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
So I'm still looking for a way to specifically tell when the player is in battle. Preferably without the use of switches, instinct is telling me this will only be possible by a plugin, or hopefully, a script call that checks if the player is in battle.

If anyone is also able to give any suggestions for how to upgrade items. I was hoping Yanflys upgrade plugin would work, but it only works for weapons and armour.
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
$gameParty.inBattle() will return true if player is in battle =)

You can use it inside the item  formula instead of calling a common event.
Just for future reference, how would that change if i want to check if the party isn't in battle?
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
Ok, now i have another issue! Im using $gameParty.inBattle() in the potions formula. But i cant get it to add a state, i assumed you would add it between the brackets. But i can't get it to work. Its very likely im not even correctly trying to add a state: $gameParty.inBattle(add.State(36)) Any help would be greatly appreciated again!
 

Musashi

Veteran
Veteran
Joined
Oct 30, 2012
Messages
150
Reaction score
259
First Language
Portuguese
You have to check if player is in battle and then telling the item what to do, like this:

if ($gameParty.inBattle()) {b.addState(36)} else {}write inside "else{ }" what the item will do if "$gameParty.inBattle()" is false.
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
The else would be a HP% heal, another thing i cant seem to get to work in the formula, only healing by a specific number. 
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
It isnt adding the state within battle still, this is what the item looks like in the database: Potion.png
 

Musashi

Veteran
Veteran
Joined
Oct 30, 2012
Messages
150
Reaction score
259
First Language
Portuguese
Got it, my mistake, you can't just add a state, you have to set a healing value too, even if it is 0.

if ($gameParty.inBattle()) {b.addState(36);0} else {value}you can use expressions to determine "value", so if you want to heal 20% of the Max HP for example, use "b.mhp * 0.2"
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
I tried using:

($gameParty.inBattle()) {b.add.State(36);0} else {b.mhp * 0.2}

and neither is working, in battle or outside. Iv tried removing the common event that is also tied to the item and still nothing. 
 

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
453
Reaction score
168
First Language
Not English
Primarily Uses
N/A
I tried using:

($gameParty.inBattle()) {b.add.State(36);0} else {b.mhp * 0.2}

and neither is working, in battle or outside. Iv tried removing the common event that is also tied to the item and still nothing. 
replace b.add.State with b.addState

without dot ;)

and its works for me
 
Last edited by a moderator:

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
yeah my bad, just realised that. However, it still doesnt work when it is all together. When   b.addState(36);0   is used in the formula, the state is added correctly, inside of battle and out. When   b.mhp * 0.2   is used alone in the formula, HP is healed correctly in battle and out. When   ($gameParty.inBattle())   is used alone in the formula, the player is healed by 0 outside or battle, and 1 in battle. I presume the '1' means it has found that the player being in battle is true? However, when all 3 are together:    ($gameParty.inBattle()) {b.addState(36);0} else {b.mhp * 0.2}   , the character is always healed by 0, both inside and outside of battle.

I feel like i missing something obvious  :(  
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
>_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>   >_>

The second i pressed the send button i realised... i was missing somethng obvious. I didnt put 'if' before the whole thing.

It now works perfectly, thank you so much everyone!
 

Latest Threads

Latest Posts

Latest Profile Posts

Ladies and gentlepeeps, I'm working on a Chuck E Cheese horror game! Did you know that in the 80's, in the Pizza Time Theater, Helen Henny was a separate character who performed in a separate room called the Cabaret? She was one of the possible guest stars there, and she was a Hollywood star at the time. But this particular unit seems to have a dark secret...
So here we go again with my programming. Currently I don't know what to program, so I am just doing things to see what I can make. Currently just photoshop though :/ Join in if you wish to see the stream. Very exclusive, mostly just 1-2 people watching.
I'm feeling rough today, a bit too many last night I'd say. Still have no choice to work on Corpse Mansion. That and I got. bunch of sales last night. I was like wtf this morning? Next payout is gonna be nice at least.
I'm just so close to replacing LUK with a different stat, maybe DEX but we'll see.

Forum statistics

Threads
117,153
Messages
1,105,016
Members
153,235
Latest member
arpeejay
Top