So I recently decided to add a "simple" gifting system to my game using Galv's Use Item On Event Script using this script;
I was wondering if there is a way to make the Event take the Item once it's used on them;
E.G. I give an event an apple, The event removes that apple from my inventory. How would I do this?
Eventing: giving gifts to NPC
● ARCHIVED · READ-ONLY
-
-
In the same way an event would give you an item: use the change item command.
That command can both increase or decreas the number of items in your inventory. -
but how would I get it to take whatever the player gives?In the same way an event would give you an item: use the change item command.
That command can both increase or decreas the number of items in your inventory.
I can't just;
Code:Change Item [keyc?(:item)] - 1 -
Why do you need to use a script to change the number of items? There is a command in the event editor that does this. Maybe I'm not understanding something about the script?
-
I am well aware of the event command, However, That takes a specific Item.
I'm trying to take any item the player gives. Understand?
So I tried to do this;
$game_party.lose_item(keyc?:)item), 1)but the event didn't take the item. -
mlogan is right. Simply add a 'change items' command in your conditional branch to decrease the amount of apples by one or however many you want.
-
Are you people even reading?
I'm sorry, stress is getting to me. -
I think the issue is that the dev cannot know if the player will choose to give an apple or a potion or a diamond to the NPC, and therefore cannot know which item to specify in the 'Change Item' command. If the player is free to give any item of their choice to the NPC, then we are in the world of massive numbers of variables and conditionals and all sorts of complications that I cannot begin to see how to sort.
@Hero
I know it can be exasperating when people do not get what one thinks is a clear and simple point, but actually your expression was not 100% clear. I don't think being rude to those people who potentially might be the ones to help you is a very productive way to go about things. -
First off, there is no need to be rude. We are trying to help based on the information you had given us.
I see what you are saying now. The reason that doesn't work is because where you have the 1 in that last bit of script, 1 tells which item you are referring to. So whatever you have as item 1 in the database is what will be affected.
If you want the player to be able to give any item, you would need some bit of script that would check the item id the player chose, and then store that where you have the 1. Unfortunately, I do not have the skills to quickly supply you with that. But perhaps if you were to put a post in script requests, someone with more scripting knowledge might be able to help you. -
I don't get the point of this script, because it's in basic the "use key item" from the editor.
You also need to decrease items by event with this script.
So it only checks for:
key?:)category,item_id)
If you want to use it, you may need to add:
use_key?
But not sure. Only sure, to do it with an event would be more easier to do.
It also use a variable for this, like the eventing to do. :/
I guess it's not a simple plug'n'play one, that spares you a lot of work... (\s/) -
That is what the script is forI think the issue is that the dev cannot know if the player will choose to give an apple or a potion or a diamond to the NPC, and therefore cannot know which item to specify in the 'Change Item' command. If the player is free to give any item of their choice to the NPC, then we are in the world of massive numbers of variables and conditionals and all sorts of complications that I cannot begin to see how to sort.
-
Yes, we are. That is why we are responding to you.
You should probably ask people to help teach you to use the script, not ask how to remove an item from your inventory. It is a completely different question. I think your problem is that you did not read the script's instruction properly.
In which case, a sample simple eventing using 'Potion' in the first item slot as a 'Key Item' type would be as follows:
Under Contents:
- Create a Conditional Branch;
- Click on 'Tab 4';
- Click on the 'Script' button;
- type in 'key?:)key_item, 1)' without the inverted commas then click Ok;
- In the space directly below that, add in a 'Show Text' command saying 'Potion given';
- In the directly below that one, add in a 'Change Items' command to decrease 'Potion' by '1'.
- Save your project and playtest. -
That is what the script is forNot so sure about that. :/Spoiler# This script allows you to bring up the "Use Key Item" box on the press of a
# button. When you select an item, it then activates the event directly in
# front of the player.
# Using EVENTING knowledge, you can set up conditional branches that contain
# 'script' condition to tell the event what to do when the item the player
# selected was used on that event.
I think you kinda need to write it that way:
key?:)item,1)
key?(:item,2)
... and so on.And then you need to add the conditional branch if item 1 is used give a gift.
If item 2 is used get EXP.
How else should the game know, what happens if you use it?
The script only "helps" with it, not take all the work from you. ;) (\s/) -
-
That was actually my first method, I thought there'd be an easier way, Guess not, Thanks a lot, Again I Apologise for my attitude. It's stressful.
-
Like I said earlier, it is possible that someone could write you a bit of script to check which item is used and then insert that number into that position. But you would need to put that into script requests.
-
This script allows you to use a key item on an event.
http://himeworks.com/2014/11/key-item-trigger-labels/
If you want the event to respond to any key item, you would create a label
keyitem?(ANY)And the commands under it will be executed.The variable is stored in a specific variable that you set in the configuration so you have access to which item was used. -
I'm sorry, I don't understand how to use that script.This script allows you to use a key item on an event.
http://himeworks.com/2014/11/key-item-trigger-labels/
If you want the event to respond to any key item, you would create a label
keyitem?(ANY)And the commands under it will be executed.The variable is stored in a specific variable that you set in the configuration so you have access to which item was used. -
Read the tutorial http://himeworks.com/2014/11/using-key-items-to-trigger-events/
-
Got this Error:

My Event
Spoiler
