RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[Solved] Remove item by variable (script call help)

0 Members and 2 Guests are viewing this topic.

*
The Hero of Rhyme
Rep:
Level 83
( ͡° ͜ʖ ͡°)
2014 Queen of RMRKProject of the Year 20142014 Best RPG Maker User - Story2011 Best Newbie2014 Kindest Member2014 Best RPG Maker User - Creativity2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best RPG Maker User (Creativity)2012 Best Yuyubabe Smiley;o
Hi, friends. :)

I've been working on a system for giving NPCs gifts, but seem to have run into a bit of a wall with MV's script calls. Does anyone know how to have items removed by variable? When using "select item" the item's id is stored in variable #12 and I would like to have a script call automatically remove the item by the id stored in that variable.

Here is what I tried (along with many variations of this):
$gameParty.loseItem($dataItems[$gameVariables[12]], 1);

I feel like I'm missing something simple. ;9 It didn't crash or anything...just didn't work. ;_;


On another note...I may just be calling MV scripts wrong or something? I tried to also have a script call within a conditional branch check variable values between numbers and that didn't seem to work either.

For example:
$gameVariables[12] >= 35 && $gameVariables[12] <= 40;

It's tough to get used to the script calls in a new engine. ;___;
« Last Edit: December 21, 2015, 11:15:54 PM by yuyu! »
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Zero to Hero2013 Biggest Drama WhoreParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
$gameParty.gainItem($dataItems[$gameVariables[12]], -1);
&&&&&&&&&&&&&&&&

*
The Hero of Rhyme
Rep:
Level 83
( ͡° ͜ʖ ͡°)
2014 Queen of RMRKProject of the Year 20142014 Best RPG Maker User - Story2011 Best Newbie2014 Kindest Member2014 Best RPG Maker User - Creativity2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best RPG Maker User (Creativity)2012 Best Yuyubabe Smiley;o
I had no luck with that, either... ;9
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


*
The Hero of Rhyme
Rep:
Level 83
( ͡° ͜ʖ ͡°)
2014 Queen of RMRKProject of the Year 20142014 Best RPG Maker User - Story2011 Best Newbie2014 Kindest Member2014 Best RPG Maker User - Creativity2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best RPG Maker User (Creativity)2012 Best Yuyubabe Smiley;o
This is solved now. :3 Apparently you have to add ".value" and use parenthesis. I guess it's a JS thing. :B In case someone else tries this (you can also use "loseItem"):

Code: [Select]
$gameParty.gainItem($dataItems[$gameVariables.value(6)], -1);

The same goes for the conditional variables I tried to use:

Code: [Select]
$gameVariables.value(var) == 1 && $gameVariables.value(var) == 3;

Many thanks to boe and an RPGMakerWeb user by the name of Tommy Gun. ^_^
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


*
Rep: +0/-0Level 24
RMRK Junior
A topic that is very special I can not stop myself to read it. It's nothing new for me and many people.

*
The Hero of Rhyme
Rep:
Level 83
( ͡° ͜ʖ ͡°)
2014 Queen of RMRKProject of the Year 20142014 Best RPG Maker User - Story2011 Best Newbie2014 Kindest Member2014 Best RPG Maker User - Creativity2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best RPG Maker User (Creativity)2012 Best Yuyubabe Smiley;o
I'm glad the topic that is very special could not stop yourself to read it. But sorry to hear it's nothing new for you and many people.

(Spambot banned) ;o
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Zero to Hero2013 Biggest Drama WhoreParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
Not going to lie I was then not at the right forum. Thank you for sharing this post for the world I'll post it in my blog.
&&&&&&&&&&&&&&&&