Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Getting an item via script., $game_party.gain_item isn't giving me an item
Titanhex
post Jan 12 2012, 10:34 AM
Post #1


Guru of Water
Group Icon

Group: Revolutionary
Posts: 1,096
Type: None
RM Skill: Masterful
Rev Points: 5




CODE
char = get_character(0)
$event_furnid[ev_id] = 1
char.character_name = '!Cabinets'
char.character_index = $event_furnid[ev_id] - 1
char.through = false
$game_party.gain_item($event_itemid[ev_id], 1)
$event_itemid[ev_id] = 105
$game_party.gain_item($event_itemid[ev_id], -1)
$game_map.need_refresh = true


That's what my script call looks like. I added the $event_itemid and furnid myself. They initialize at 0.

itemid returns the right number for the item id I want removed/added. But the item doesn't get removed or added. Sometimes I use 0 for the item ID to tell it don't take any items as well, but I doubt that's a problem.

So is there anything in my script call that's causing this problem? I've had problems with getting the charset to change through script calls as well (it works now for whatever reason)

The point of this is to let you place an item down in a spot and remove that item. It cycles through various items to do this, so as you switch out items it gives you back the item you're changing from and puts down the next item in the list.

This post has been edited by Titanhex: Jan 12 2012, 01:15 PM


__________________________
Go to the top of the page
 
+Quote Post
   
Resource Dragon
post Jan 12 2012, 02:56 PM
Post #2


Dragon has RAWR. So... RAWR.
Group Icon

Group: Local Mod
Posts: 984
Type: Developer
RM Skill: Masterful
Rev Points: 95




Sorry, i'm a little confused about the way it works. Let me open up VX.
If i'm right, I think your over-thinking it.

EDIT: Nevermind, I'm gonna have to sit this one out. I've confused myself to the point I don't recognize my own code..

I think i'm gonna go lie down... :S Sorry Titan.

This post has been edited by Resource Dragon: Jan 12 2012, 03:07 PM


__________________________
click me ->Signup for Digital Hijinks!<- click me
Go to the top of the page
 
+Quote Post
   
Titanhex
post Jan 12 2012, 03:42 PM
Post #3


Guru of Water
Group Icon

Group: Revolutionary
Posts: 1,096
Type: None
RM Skill: Masterful
Rev Points: 5




lmao for the last few hours that's how my head has felt. Finally decided to compromise on my code and use a less compact and less intuitive design. I originally wanted to store both the event id and map id in a parent and child key then store a value in those paired keys, but I don't know how to do that. sad.gif

Still, for whatever reason when I do:

@temp = 2
$game_party.gain_item(@temp, 1)

No item is given to me.

$game_party.gain_item(2, 1)

This line also doesn't work in Script Call.
This has been confirmed in a new project as well.

So what the hell is the problem? : \

This post has been edited by Titanhex: Jan 12 2012, 03:47 PM


__________________________
Go to the top of the page
 
+Quote Post
   
Ratty524
post Jan 12 2012, 04:07 PM
Post #4


Level NINE-THOUSAAAAND!
Group Icon

Group: Local Mod
Posts: 1,633
Type: Artist
RM Skill: Skilled
Rev Points: 5




Moved this to RGSS2 Support.

While I'm not an expert with this, could you tell us what exactly happens when you attempt to give the player an item? Does an error message pop up, or does it do nothing at all?


__________________________
The userbar links to the right thread this time. :P



Click here for other crap

QUOTE (gamezerstudios @ Jan 18 2010, 03:29 AM) *
i don't like blogs last time i got one my desktop blew up!

ROFL!!

Dragons and Eggs! Please click :3

Weird Dragon is weird.Pretty Dragon is pretty.
Midjet Dragon is a midget.Cool Dragon is cool.
Awesome Dragon is AWESOMEOkay Dragon is... Meh
UGLY DRAGON IS UGLY! >_<... Ok seriously WTF!?
Another Pretty DragonPrettier Dragon
WOAH BADASS!Woah... Same as before. >_>
Ooh it's a godly looking dragon!Ooh, it's a dragon prettier than the other two!
... Okay seriously what the hell is this thing?


thank you Holder for the card!


Feast your eyes on the failure!


Best Thread Ever Made
Go to the top of the page
 
+Quote Post
   
Titanhex
post Jan 12 2012, 04:45 PM
Post #5


Guru of Water
Group Icon

Group: Revolutionary
Posts: 1,096
Type: None
RM Skill: Masterful
Rev Points: 5




Nothing at all.

In all cases of it not working, this script is ran in an event on the map.

This post has been edited by Titanhex: Jan 12 2012, 04:48 PM


__________________________
Go to the top of the page
 
+Quote Post
   
Philip
post Jan 12 2012, 10:13 PM
Post #6


Nura (The Jade Ring)
Group Icon

Group: Revolutionary
Posts: 325
Type: Developer
RM Skill: Masterful




Your code is extremely confusing buuuuuut you're ALMOST correct.

The proper code is:

CODE
$game_party.gain_item($data_items[itemid], value)


__________________________
"If your mind goes blank don't forget to turn off the sound." Unknown Author

Phil


Go to the top of the page
 
+Quote Post
   
Titanhex
post Jan 12 2012, 11:28 PM
Post #7


Guru of Water
Group Icon

Group: Revolutionary
Posts: 1,096
Type: None
RM Skill: Masterful
Rev Points: 5




Thank you, Phillip!

It's always something simple like that. I just needed to look harder at the code in game_interperter. :\

This post has been edited by Titanhex: Jan 13 2012, 01:10 AM


__________________________
Go to the top of the page
 
+Quote Post
   
Philip
post Jan 13 2012, 07:08 AM
Post #8


Nura (The Jade Ring)
Group Icon

Group: Revolutionary
Posts: 325
Type: Developer
RM Skill: Masterful




QUOTE (Titanhex @ Jan 13 2012, 01:28 AM) *
Thank you, Phillip!

It's always something simple like that. I just needed to look harder at the code in game_interperter. :\


No problem!!

I use game interpreter for everything when I script. happy.gif

This post has been edited by Philip: Jan 13 2012, 07:08 AM


__________________________
"If your mind goes blank don't forget to turn off the sound." Unknown Author

Phil


Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 06:34 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker