Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: happyman on November 14, 2009, 01:09:33 pm

Title: Script for gifting items to NPCs... (resolved)
Post by: happyman on November 14, 2009, 01:09:33 pm
I've never requested a script before, so please excuse me if I'm out of line anywhere.

I'm making a Harvest Moon/Animal Crossing Game and I need a way of giving items to NPCs as gifts.

Here's what I really want to happen:
When you speak with a character, the player is given three choices:  Talk, Gift, Nevermind (or something).  Obviously, choosing "Talk" would display text for the specified character.  I don't have a problem here, or with the choice "Nevermind."  :D  But when you choose "Gift," I need a menu to pop up, displaying a list of items currently in possession of the party.  I'm thinking selecting an item would deplete held quantity of said item by 1, and a text box would display for the NPC.  If I can store the selected item as a variable, then I can use Condition Branch to determine different reactions from the NPC depending on the item.  Example: "Oh, thank you, I love flowers!"  or "Ew!  Gross!  I hate bugs!"  I have variables that determine the happiness of every NPC, which would change depending on the gift.

I also think it's important to cancel the process of gifting while the window's open.  Doing so would probably Jump to a Label, specified in the "Nevermind" option.  <-- Unless someone thinks of a better way.

So that's it.  I want to be able to control this script with eventing (I'm not sure if I even need a script).  All I need is the power to summon a Gift Window when a player chooses "Gift," and assign the selected item to a variable.  Seems simple enough, I hope.

Coincidentally, I'm also having trouble finding a good HP/SP bar displayed onscreen during gameplay (Not in the menu or battle, in the field).  Can anyone help me out?  Thanks for any help :)

Edit:
I forgot to mention, I'm using some scripts already.  Don't know if they'll affect this request though.  I'm using Blizzard's ATES, a Ring CMS and an AMS (advanced message script).  The CMS might be a problem if you think i need to access the menu to get to the items...  But I'm not a scripter and idk.

Added resolved tag ~ G_G
Title: Re: Script for gifting items to NPCs...
Post by: Aqua on November 14, 2009, 01:25:45 pm
HP/SP display is a HUD
Search around XD

As with the gift window thing, it's not too hard.
It'd just call a scene that would show the inventory, and then have it do stuff on action.
I might be able to do this today... but... not sure XD
Depends on what other stuff I have to do D:

Ps.
Don't double-post.
Use the modify button instead.


Edit:
Do you want all game items to be able to be gifted or only certain ones?
If only certain, do you want to define the list in the script or use an element check?

Also, how big do you want the selection of the window in terms of columns and rows?
Title: Re: Script for gifting items to NPCs...
Post by: happyman on November 14, 2009, 02:48:01 pm
For the item selection window, it would be nice if the items were in one column.  How many could fit in one row?  Maybe six, with the option of scrolling down for more.  I didn't consider that.

I DO have some special items that shouldn't be gifted.  How would an element check work?  Is it kind of like a switch in the item settings, and basically all items of the element "fire," for instance, will appear grayed out and unselectable?  Because that sounds good to me :)

Sorry for the double post.  Learned my lesson :)
Title: Re: Script for gifting items to NPCs...
Post by: Aqua on November 14, 2009, 02:58:38 pm
The ones with the "fire" wouldn't show up at all :P

Lol I was thinking of the one column too :D

So... just tell me if you want the element check, and I'll work on it soon (I hope)
Title: Re: Script for gifting items to NPCs...
Post by: happyman on November 14, 2009, 03:13:46 pm
That element check idea sounds good!  :)  I imagined the ungiftable items to appear gray in the list, but if they don't show up at all, that's okay too.

Thanks a lot for taking an interest.  There's no rush, so take all the time you need :)
Title: Re: Script for gifting items to NPCs...
Post by: Aqua on November 14, 2009, 03:25:53 pm
I can make them show up as grey or not show up at all...
Which do you want? :p
Title: Re: Script for gifting items to NPCs...
Post by: happyman on November 14, 2009, 04:16:22 pm
Well, if I get to choose, I would prefer them to be grey.  But if it's easier to make then not appear, that's okay too.

Also, i just realized...  It might be cool if the Icons for every Item could appear next to each item.  You know what I mean?  Is that a possibility?
Title: Re: Script for gifting items to NPCs...
Post by: Aqua on November 14, 2009, 04:24:35 pm
Spoiler: ShowHide
(http://img69.imageshack.us/img69/9846/giftpreview.png)

Of course... :P
I wouldn't have it any other way.

Mm... forgot to change the size of the selection...
And I still gotta make the gift to be "processed" XD
Title: Re: Script for gifting items to NPCs...
Post by: happyman on November 14, 2009, 04:48:27 pm
Awesome!  Keep up the good work! :)
Title: Re: Script for gifting items to NPCs...
Post by: Aqua on November 14, 2009, 06:18:27 pm
It's a combination of a script & event system...
Do you want me to comment the event parts?
Title: Re: Script for gifting items to NPCs...
Post by: happyman on November 14, 2009, 06:44:38 pm
Comments are great.  How did it go?
Title: Re: Script for gifting items to NPCs...
Post by: Aqua on November 14, 2009, 06:57:41 pm
Still working on it...
Basically... it's done... I just wanna make it look better XD
Title: Re: Script for gifting items to NPCs...
Post by: happyman on November 14, 2009, 07:46:22 pm
I have no problem with that  :)

Btw, I've searched High and Low for a good HP/SP bar HUD, but with no luck.  Should I make a new script request?
Title: Re: Script for gifting items to NPCs...
Post by: Aqua on November 15, 2009, 11:40:42 am
If you want to really make one that's unique to your game, then you'd need to make a script request.

Make sure to include a mockup of what you want it to look like and include any features you would like the HUD to have.

Edit:
Here's the demo with the gift giving.
[Link] (http://starrodkirby86.web44.net/AquasStuff/Aqua_Holding_Bin/RGSS/Gift%20Giving.zip)

I only did the minimal comments.
The NPC is fully commented, but script itself is barely commented XD

Anyway... it should be (hopefully) easy to understand and set up.

If you want anything changed, let me know.
Title: Re: Script for gifting items to NPCs...
Post by: element on November 15, 2009, 01:58:02 pm
nice !
great work aqua !
this is veary handy for making quests :p
Title: Re: Script for gifting items to NPCs...
Post by: G_G on November 15, 2009, 02:00:39 pm
very nice aqua! *level's up*
Title: Re: Script for gifting items to NPCs...
Post by: happyman on November 15, 2009, 02:36:15 pm
Wow!  Aqua, this is awesome!  And it's perfect!  Just what I needed!
Title: Re: Script for gifting items to NPCs...
Post by: Aqua on November 15, 2009, 02:41:25 pm
Glad it's what you needed :D
Please add a [Resolved] tag to the title of your first post to signify that this request is resolved.

Lol... I'm too lazy to officially release it right now XD
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: legacyblade on November 15, 2009, 04:13:28 pm
Great job aqua! However, it would be better if you had it call a common event rather than flip the event's self switch. (since you're going to have to use a different event for the person on every map) But it's easy to get around, as you can just have the second event page call said common event. Other than that, GREAT script Aqua :D
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: Aqua on November 15, 2009, 04:17:18 pm
If I use a common event, then it won't be customized to each event... :P
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: legacyblade on November 15, 2009, 04:24:09 pm
Well I mean instead of passing the event ID, pass the common event ID. I mean what if you want to have a "character" found in multiple places (most likely based on the time of day) and his reaction would be the same to the gifts (like it is in harvest moon games). You could copy and paste the event page, true, but what if you have 60 copies of that event? It would be a pain in the BUT to change all the numbers around.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: Aqua on November 15, 2009, 04:39:10 pm
But this allows for the giving of gifts to multiple NPCs that won't have effects on each other...

And change what numbers around? O.o

*confused by your post*
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: legacyblade on November 15, 2009, 10:15:30 pm
Alright, I'll clarify what I meant. Currently, your system has you pass the map and event id, and proceeds to flip the self switch of the event.

$gift_recipient = [event_id,map_id]


What I'm requesting is that you pass the common event number for the game to call.

The reasoning behind this is the following:

In a game, you have a total of 16 town members who you can give gifts to (think harvest moon games). Since this all takes place in a single town with a time system, there are going to be 6 events for each town member to represent where they'll be at certain moments of the day (in the morning, they're at home, in the afternoon, they're at work, etc). At first that doesn't sound like a problem, so you (via copy and paste) set up the second event page to determine how they should act with gifts you give them.

Then you decide later that every NPC HATES a certain item you just barely added into the game, and will loose 100 relationship points if you give it to them. You'd have to go through 96 separate events to add this in.

Now let's say that instead of flipping an event's self switch, the script would call a common event (which common event called is determined by passing it to the script before entering the gifting scene). That way you'd set up 16 common events, one for each NPC.

Does that make sense?

(btw, it would probably be better just to pass "common_event" to the Scene_Gift_Giving class when you initialize it. Just make @common_event a class variable. It would be less lines of code)
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: Aqua on November 15, 2009, 10:22:01 pm
Ah... you wanted 1 common event for each NPC.
I thought you meant just 1 common event in general... ._.

Edit:
I'll think about it.
happyman, what do you think about it? XD
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: legacyblade on November 15, 2009, 10:26:48 pm
Yah. One common event in general would just totally suck, lol

And if you decide NOT to do it that way, it's easy enough to just call a common event on the page with self switch A flipped. So I'm fine either way. Just saying what I thought would improve the system.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: happyman on November 16, 2009, 03:01:11 am
I didn't think about it before, but I agree with legacyblade.  It would be a pain to edit the details of multiple events on different maps.

Actually, I already use common events in the way legacyblade described.  Talking to someone brings up that someone's specific common event, in which condition branches apply and the dialogue is different depending on an affection variable.

Having the choices of Talk and Gift, when the player chooses Talk, I can call the common event I call "Talking to Joey."  It would be nice (and probably more convenient) if I could call a similar common event, "Gifting to Joey" if the player chooses Gift.  That way, if I modify items from the database, or Joey's item preferences, it would be easier to modify the changes of Joey's reactions.

I like the sound of this.  Is it too much trouble?

Basically, can Event Page 2 be moved to a Common Event?
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: legacyblade on November 16, 2009, 02:33:22 pm
With the current script, just have a common event call on the second event page to the "gifting joey" common event. Make sure that page is still a parallel process though.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: Aqua on November 16, 2009, 04:26:21 pm
Yeah, having page two point to a common event should be the easiest way to do it.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: legacyblade on November 16, 2009, 06:59:55 pm
But then again having your script just call a common event would increase speed, shorten the script, and cause greater compatibility :P
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: happyman on November 16, 2009, 07:43:05 pm
Have page 2 point to a common event instead?  I can do that.  Didn't think of that either.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: happyman on November 19, 2009, 06:27:56 pm
I've run into a problem.

I tried setting it up so page 1 of the event calls a common event, and page 2 of the event also just calls a common event.  I'm not sure, but I think common events cannot retrieve Event ID.  I can "talk" to an NPC just fine, but when I try gifting to them... the gift window appears, I select an item, and then nothing happens.

What should do?
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: Aqua on November 19, 2009, 06:37:37 pm
Try to see if this works...

On the event on the Map, put that in the 1st page before you call the common event and also delete that part from the common event.
$gift_recipient = [@event_id, 
$game_map.map_id]
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: happyman on November 19, 2009, 07:07:06 pm
I did what you said, but I get the same problem.  Everything works fine until page 2.  Actually, it's weird...

I'm using Blizzard's ATES script, and I use the commands ATES.on and ATES.off to turn off and on the time.  I use it so time stops when you talk to people.  Anyway, at the end of event page 2, I use the command "ATES.on" after I call the common event "gift reactions", and I've noticed it works.  So basically, it's skipping the common event.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: Aqua on November 19, 2009, 07:23:44 pm
Um... this works perfectly fine for me when I do common events...

Are you sure you're calling the right common events, the common events have a trigger of none, and you're still using the self-switches?
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: happyman on November 19, 2009, 07:47:32 pm
I just went back and copied the event in your demo, without any common events, but it still didn't work.  The only thing I changed was the variable for the "affection."

I could copy and paste the script again (just in case I accidentally didn't copy something).

I was also wondering if the common event needs to be a parallel process, just like page 2 of the event.  But if it works for you, then probably not.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: Aqua on November 19, 2009, 07:54:36 pm
Can you make a small demo of your problem?
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: happyman on November 19, 2009, 08:10:19 pm
How do I upload a demo?

I'll do it.  But I gotta go soon, so probably not right now.

I bet it's something I changed, because the script/events works fine in your demo.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: G_G on November 20, 2009, 10:03:30 am
use http://sendspace.com upload your demo there and post the link here
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: happyman on November 21, 2009, 12:42:14 am
Thanks for the tip, gameguy :)

Okay Aqua, so here's a little demo: http://www.sendspace.com/file/td9qsr (http://www.sendspace.com/file/td9qsr)

You'll notice three people to gift to.  They're each evented differently.  I thought it might be helpful for you to see how I did things.
The one on the the right is the one I really want to work :)

I'm guessing the problem has to do with the other scripts I'm using, or perhaps the parallel event I have running.

Thanks for all your help, I really appreciate it! :)
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: Aqua on November 21, 2009, 01:05:24 pm
I don't know why there is a problem...
But I found a solution
The system now uses strictly common events... no more self switches XD

However... with this solution... came another problem...
After you press "enter" to stop talking what you give him, the text recycles again... >.<
I'll try to find a solution before I upload the game.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: happyman on November 21, 2009, 01:40:24 pm
I know, it's weird isn't it?

Would it be possible to have everything happen in 1 common event?  Like, the map event would only be one page with one action, call common event "talking to."  And in that common event, have EVERYTHING, the three choices with all dialogue and the gifting reactions?

I don't know though.  I'm just speculating :)
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: The Amazing Link on March 30, 2012, 08:06:31 pm
Hey, I know that this topic has not been posted on for a long time, but I was wondering if you could make this script more like Harvest Moon Tree of Tranquility.  In that game, you could view your relationship status with all people that you had met. Your relationship was measured in hearts.

So I was wondering if you could make a menu modification that allows you to view your status with all people (it doesn't need to be only the people you have met, but if you feel like going the extra mile, then go for it).  Your status would be measured with icons or pictures of hearts, or whatever you want to use.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: ForeverZer0 on March 30, 2012, 11:37:59 pm
You do realize that you just revived a 3 year old topic started by a member that has not been active for nearly 2 years don't you?
In the future, if you want a serious request, please don't do that, make a new topic instead.
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: The Amazing Link on March 31, 2012, 01:39:26 pm
Sorry  :shy:
But it is Aqua's script, and according to Aqua's profile, she was
QuoteAqua's Profile:
Last Active:    Today at 02:32:25 PM

Aqua is still around, though.  Also, for some reason yesterday I my computer would not let me PM Aqua, so I decided to add on to this topic instead.

I will start a new topic though...
Title: Re: Script for gifting items to NPCs... (resolved)
Post by: ForeverZer0 on March 31, 2012, 03:04:15 pm
Not really.

QuoteScript for gifting items to NPCs... (resolved)
«  on: November 14, 2009, 01:09:33 PM »


Quotehappyman's profile
Last Active:    August 26, 2010, 07:48:30 PM


Its not really up for argument or debate, its using common sense.