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

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

Previous topic - Next topic

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.