Site Announcements

  • Account registration restricted. Email lord.ixzion AT gmail.com and I will get you set up. Thanks.
  • RPGMM Discord Channel - https://discord.gg/YJnAfVr

  • New to the site? Let us know!! - Check here.
  • RPGM Magazine Mission Statement. - Check here.
  • We now have a forum up specifically for the races, check it out. - Check here.


[Continue]

It is currently November 22nd, 2024, 9:09 am
View unanswered posts | View active topics


All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: February 28th, 2014, 10:26 am 
Rank 0: Magonian Apprentice
Sir
Offline
User avatar

  Level 8
 

Joined: September 22nd, 2013, 7:38 pm

Posts: 29
Howdy, folks!

I'm working on my first game for VX Ace, and there's something I'd like to implement, but I'm not sure if it's possible. Hopefully someone will know.

What I would like to do is have a hidden stat for each character that can go up or down any time certain items are used ON that character. Specifically, I want my MP restoring items (booze) to be readily available and relatively cheap, but when a character takes too many of them without resting at an inn, they get progressively worse status effects, like berserk and reduced accuracy.

So, what do you guys think? Is there a way to make this happen? I've tried looking it up a bit, but I'm not sure how to even word the question without writing whole paragraphs. Any help or insight would be appreciated, even if it's just "No, I don't think there's a way."

Thanks in advance!
~Rosser


Top
Profile  
 
PostPosted: February 28th, 2014, 5:09 pm 
Rank 8: Adept Fighter Rank 8: Adept Fighter
Offline
User avatar

  Level 73
 

Joined: May 19th, 2006, 8:42 pm

Posts: 3632

Location: Ohio
The first thing that pops into my mind is using a variable to track the character's inebriation.

It's been a while since I looked through VX Ace's commands, and I don't have it installed right now, but I believe you can add scripts to items that take effect when you use them, ie. you can make it so that the variable increases when you use the item.

Then, you should be able to make a common event that inflicts whatever status you want when the variable reaches a certain point.

Again, I haven't looked at this stuff in a long time, but it's the first thing that popped into my head.

_________________
Image Image Image Image


1) Statement 2 is true
2) Statement 1 is false


Top
Profile  
 
PostPosted: February 28th, 2014, 5:34 pm 
Rank 0: Magonian Apprentice
Sir
Offline
User avatar

  Level 8
 

Joined: September 22nd, 2013, 7:38 pm

Posts: 29
Using variables to track characters' inebriation is EXACTLY what I'm getting at. I figure it'll be a good way to make short-term "mana burn" tactics viable, but causing problems over extended periods.

Sounds good so far. I'm not very familiar with scripting, but if it can be used to make an item affect each individual character upon use without it affecting the rest, I should be good to go. Just don't want to pursue it if it's either impossible or so difficult that it might as well be impossible, know what I mean?

~Rosser


Top
Profile  
 
PostPosted: March 1st, 2014, 1:14 am 
Rank 7: Learned Black Mage Rank 7: Learned Black Mage
Mongolian Chop Squad
Offline
User avatar

  Level 63
 

Joined: February 27th, 2007, 8:54 pm

Posts: 3449

Location: EXPEL
I really like this idea! If you find the answer somewhere else, please come back and share. It sounds like it has a few applications outside of your example too. I'm too new to PC makers to be of any real help but I am damn sure interested in this.

_________________
ImageImageImageImageImageImageImage


Top
Profile  
 
PostPosted: March 1st, 2014, 1:22 am 
Rank 6: Potent White Mage Rank 6: Potent White Mage
We didn't play twister mister
Offline
User avatar

  Level 50
 

Joined: May 7th, 2005, 11:24 pm

Posts: 2721
I'm not the best at eventing and whatnot, but under system data there should be a common events option. I think putting the variable controls there is probably a really good idea.:)

_________________
http://www.passid.ca/orange
Nintendo ID: SuperOrangeGamer


Top
Profile  
 
PostPosted: March 1st, 2014, 2:54 pm 
Rank 0: Magonian Apprentice
Sir
Offline
User avatar

  Level 8
 

Joined: September 22nd, 2013, 7:38 pm

Posts: 29
Okay, I've begun skirting around the problem. What I've done so far is under "terms" in the database, I've changed LUK to BAC (Blood Alcohol Content.) I've given all the characters a constant "luck" stat of one, so it never levels up. When they drink a beer, it goes up by one, and when they sleep it goes down by 999. Now I just need to figure out how to do some sort of common event where any time a character's stat goes over a certain number, it adds the "drunk" status effect. I figured I'd make different numbers for each character, since everyone handles alcohol differently. So, does anyone know how to make a common event add a status effect at a certain "luck" stat?

~Rosser


Top
Profile  
 
PostPosted: March 1st, 2014, 4:44 pm 
Rank 0: Magonian Apprentice
Sir
Offline
User avatar

  Level 8
 

Joined: September 22nd, 2013, 7:38 pm

Posts: 29
Okay, so first I made a common event for each character where I A) set a control variable for that character's LUK (BAC) stat, B) Add a conditional branch that adds the "drunk" status effect if that variable is greater than or equal to X (whatever that character's tolerance is) and remove it if that variable is less than X. Then I set the beer item to restore MP, add 1 to the LUK (BAC) stat, and run each character's common event. Then when their BAC goes over the threshold, the drunk stat is added until they hit an inn or something that drops the LUK by 999 and removes status effects. I still haven't figured out how to make an item that LOWERS the stat by a bit AND re-runs the check to drop them back to normal, it seems to be a bit fidgety. If I figure out how to do that, I'll let y'all know.

~Rosser


Top
Profile  
 
PostPosted: March 1st, 2014, 4:50 pm 
Rank 0: Magonian Apprentice
Sir
Offline
User avatar

  Level 8
 

Joined: September 22nd, 2013, 7:38 pm

Posts: 29
Update - I was a bit hasty with reports of my last success. Apparently by doing things this way, the item only runs the last common event in the list. I can't figure out how to make it run all of them...Still working on it.

~Rosser


Top
Profile  
 
PostPosted: March 1st, 2014, 5:53 pm 
Rank 0: Magonian Apprentice
Sir
Offline
User avatar

  Level 8
 

Joined: September 22nd, 2013, 7:38 pm

Posts: 29
Further update, I think I've solved most of the problems with my system now. Okay, here's the solution I have.

I have two characters so far, but it could be modified for more. First thing is a common event I call "Drunk Check." First, I set a control variable called [0002:Jimmy's BAC] to equal [Jimmy]'s LUK. This makes the variable [Jimmy's BAC] equal to whatever the LUK stat is at the time.

Next line is a Conditional Branch. I set it for Variable, then [Jimmy's BAC] is greater than or equal to 5. Right under that, it changes Jimmy's state to "Buzzed." Then, under ELSE, change Jimmy's state to REMOVE "Buzzed." Then branch end.

Immediately after that, I do the SAME THING, but with [Louis] instead of [Jimmy], of course picking the next variable as [0003:Louis's BAC] in the first part. Rinse and repeat for all the different characters.

So now, I work with items. I have items like beer, wine, etc. that restore more and more MP, but increase LUK more at the same time. For Effects I just put in Recover MP (however much), Grow LUK (however much), and Common Event: Drunk Check. Then, when the character gets sufficiently drunk, they get "Buzzed."

I also have the item "Coffee," which LOWERS the BAC a little, but it's more tricky, because you have to lower the stat instead of increase it. First, a control variable. I checked single, called this variable [Party Member], and for the operand I clicked "script" and typed $game_party.target_actor.id
which after some research, is what you use when you want the game to do whatever-it-is to whomever used the item. Next line, Change Parameters: Variable [0001:Party Member], LUK - 5. After that line, I just copied and pasted EVERYTHING in the "Drunk Check" event, so that if the character's BAC drops below their limit, it REMOVES the "buzzed" status.

Finally for an Inn stay, I just added some lines before the Recover All: Party line - I used Control Variables: [Character's BAC] = [Character's LUK], then Change Parameters: [Character], LUK - [Character's BAC]. This changes the LUK stat back to 0, even though it will display as 1 in the status screen.

There are a couple of bugs, like going into negative numbers for LUK if you drink lots of coffee, but this is pretty good for now. With a little tweaking, I think I can make it so there are varying degrees of stats, i.e. "Buzzed," "Drunk," "Blackout."

I'll keep working on it, but for now I'll call this one "solved." Thanks!

~Rosser


Top
Profile  
 
PostPosted: April 15th, 2014, 2:38 pm 
Rank 0: Magonian Apprentice
Offline

  Level 1
 

Joined: July 18th, 2013, 8:16 pm

Posts: 17
I think you've got a very cool idea, Rosser! But I can see the way you implemented it causing some unexpected problems. The chief problem is that the "LUK" stat is used deep in the system to determine the chances of having negative States applied to you (so getting really drunk would effectively render you hard to poison/confuse/etc. - funny, but probably unintended). Additionally I think there might be scenarios (such as the end of a scripted battle) where the Common Events you have set up might not run when they are supposed to.

There's actually an easier and more reliable way to do this and you were onto it in your first post - add an actual attribute to battlers to track how "drunk" they are. Here's what you need to do in Game_BattlerBase (in the script editor) to make that a reality:

* In the "Public Instance Variables" method, add a line:

attr_reader :dp

(or whatever you want to call the "drunk" rating; I'm using "dp" for drunk points... this allows the game to work with your new attribute)

* In the object initialization method, change the second line to:

@hp = @mp = @tp = @dp = 0

(this has the game set the "drunk" rating to zero when the game starts; if you want a higher initial rating for all characters, instead add a new line that says, for example, @dp = 50)

* Where you see "change HP", "change TP", etc., add a similar method for Drunk Points:

#--------------------------------------------------------------------------
# * Change Drunk Points
#--------------------------------------------------------------------------
def dp=(dp)
@dp = [dp, 0].max
end


(I believe this is known as a "set" method; it's a common structure for any attribute of an "object" (read here as "character") in programming. Also, if you want an upper limit on the Drunk Points a character can have, for example 999, you can do it here by changing the second line to @dp = [[dp, 0].max, 999].min )

All characters (even enemies, in theory) can now use the "Drunk Points" stat! You don't need to track these variables separately because RPG Maker will do it for you, and you don't need to hijack any stats that it might be using behind the scenes.

Now, there are still two things I believe you want to do: take control over the character's DP when they use an Alcohol Item, rest at an Inn, etc., and also apply negative "Drunk" states when they accumulate too many DP. Both of these become really easy.

* Items: The common event you have in place will work fine (although it can probably be improved, see below) so simply add the following to your item's Formula Box BEFORE the MP healing amount:

b.dp += 7;


("b" refers to the target of the item; "7" is how many drunk points you want to add so change it to your heart's content for each item; for items like Coffee, use -= instead of += )

* Skills: A few cool things you can do here. If a skill GETS you more drunk when you use it, treat it exactly like an item above. If you want a skill to, say, do damage based on how drunk you ARE right now, you can add it into the damage formula, such as:

a.atk * 4 - b.def * 2 + a.dp

(Drunken Fist Style, baby! "a" refers to the user of the skill)

* Inns: In the eventing for the Inn, choose "Script..." and enter the following:

for i in 1..12
$game_actors[i].dp = 0
end


(this sets each actor's DP to 0, including the ones that are not currently in your party... if you want it to only be the actors currently in your party, let me know and I can give you a simple bit of code for that as well... BE SURE to replace "12" with the highest Actor ID that any of your party members has!!... finally, be sure to run the Common Event below AFTER this Script command.)

* Common Event for checking DP and applying Drunk states: It wasn't clear whether you already have a Common Event that you're happy with, so if you do, just change the checks to look for DP. But here's the easiest way to set it up from scratch - once again, use the "Script..." event command:

for i in 1..12
j = $game_actors[i]
j.remove_state(88); j.remove_state(89)
j.remove_state(90)
if j.dp > 300; j.add_state(90);
elsif j.dp > 200; j.add_state(89);
elsif j.dp > 100; j.add_state(88);
end
end


(I haven't tried this yet, so let me know if anything goes awry, but I think it should work perfectly for what you want to do. What it does is remove the drunk states for each actor, then check their drunk points to apply a new drunk state if appropriate. The 88, 89, and 90 states would be the State IDs of your "buzzed", "hammered", and "blasted" states respectively, and the 300, 200, and 100 would be the thresholds above which a character would advance to the next level of drunkenness; feel free to change them to your heart's content but be sure the highest DP levels correspond to the most drunk State)

So there you have it! It's a lot to take in, but it will save you a TON of time in the long run because it's so easy to scale to new items, characters, etc., and it shouldn't produce any of the "fidgety" behavior you're seeing now.

I hope this helps, and feel free to ask me any questions about issues you encounter or extra features you want to add to this system.


Top
Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group