Script for gifting items to NPCs... (resolved)

Started by happyman, November 14, 2009, 01:09:33 pm

Previous topic - Next topic

happyman

November 14, 2009, 01:09:33 pm Last Edit: November 15, 2009, 03:09:52 pm by game_guy
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

Aqua

November 14, 2009, 01:25:45 pm #1 Last Edit: November 14, 2009, 01:29:13 pm by Aqua
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?

happyman

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 :)

Aqua

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)

happyman

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 :)

Aqua

I can make them show up as grey or not show up at all...
Which do you want? :p

happyman

November 14, 2009, 04:16:22 pm #6 Last Edit: November 14, 2009, 04:19:15 pm by happyman
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?

Aqua

Spoiler: ShowHide

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

happyman


Aqua

It's a combination of a script & event system...
Do you want me to comment the event parts?

happyman


Aqua

Still working on it...
Basically... it's done... I just wanna make it look better XD

happyman

November 14, 2009, 07:46:22 pm #12 Last Edit: November 14, 2009, 08:22:58 pm by happyman
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?

Aqua

November 15, 2009, 11:40:42 am #13 Last Edit: November 15, 2009, 12:54:55 pm by Aqua
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]

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.

element

nice !
great work aqua !
this is veary handy for making quests :p

G_G


happyman

Wow!  Aqua, this is awesome!  And it's perfect!  Just what I needed!

Aqua

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

legacyblade

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

Aqua

If I use a common event, then it won't be customized to each event... :P

legacyblade

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.

Aqua

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*

legacyblade

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)

Aqua

November 15, 2009, 10:22:01 pm #23 Last Edit: November 15, 2009, 10:23:03 pm by Aqua
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

legacyblade

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.

happyman

November 16, 2009, 03:01:11 am #25 Last Edit: November 16, 2009, 03:42:01 am by happyman
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?

legacyblade

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.

Aqua

Yeah, having page two point to a common event should be the easiest way to do it.

legacyblade

But then again having your script just call a common event would increase speed, shorten the script, and cause greater compatibility :P

happyman

Have page 2 point to a common event instead?  I can do that.  Didn't think of that either.

happyman

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?

Aqua

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]

happyman

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.

Aqua

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?

happyman

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.

Aqua


happyman

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.

G_G


happyman

November 21, 2009, 12:42:14 am #38 Last Edit: November 21, 2009, 12:21:37 pm by happyman
Thanks for the tip, gameguy :)

Okay Aqua, so here's a little demo: 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! :)

Aqua

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.

happyman

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 :)

The Amazing Link

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.
Spoiler: ShowHide
*leaves without sword* *beats game anyways*

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

The Amazing Link

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...
Spoiler: ShowHide
*leaves without sword* *beats game anyways*

ForeverZer0

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.


I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.