Removing weapon, armor, accessory by ID numer taken from variables

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
Hi is there a way to remove weapon, accessory armour from Inventory by using the numer taken from variable?

Im trying something like this but its not working ... 
$game_party.gain_item($data_weapons[$game_variable<74>], -1)
 
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
$game_party::gain_item($data_weapons[$game_variables[1]], 1)


# or


$game_party::lose_item($data_weapons[$game_variables[1]], 1)
 

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
$game_party::gain_item($data_weapons[$game_variables[1]], 1)# or$game_party::lose_item($data_weapons[$game_variables[1]], 1)
That was really quick answer thank you!!

and If I want to equip this item by variable ID ? what kind of formula will be ? 
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
slot = 0item = $data_weapons[$game_variable[1]]$game_actors[1]::change_equip(slot, item)the slot determines which equipment slot to try put the equipment it - this of course needs to match the weapon/armor from the variable, so ou could do something like this instead...

item = $data_weapons[$game_variable[1]]slot = item::etype_id$game_actors[1]::change_equip(slot, item)That would automatically check the equipment type and put it in the correct slot. :)
 
Last edited by a moderator:

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
Thanks! Yeah but Im getting the weapon ID of the character that was equiped to variable by this command
$game_actors[1].equips[0].id

so Im getting the ID of weapon and I just want to equip by the number it's not possible by any command ? when I got this ID stored in variable ? ?
(making custom EQ)
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
Ahhh, so you have a custom equipment system in place that is altering the id of the equipment item?  So for example, you could have 2 weapon id 1 (database id), but their internal id's are (for example) 61 and 62?? 

If you are getting the id of the weapon already equipped, why do you need to equip it? 
 

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
Ahhh, so you have a custom equipment system in place that is altering the id of the equipment item?  So for example, you could have 2 weapon id 1 (database id), but their internal id's are (for example) 61 and 62?? 
If you are getting the id of the weapon already equipped, why do you need to equip it? 

ah its because its custom menu with only four items max and when You are full (inventory) when You take off the weapon and you have no free room its will ask You if You want to drop that items which code I've got from you and... If You want to keep it then Its gonna go equip again... Its uses original Equip scene

If there is no such command Im gonna make common event call which will check by command branch if Variable is ID 1 then use Change Weapon, Rpg maker Option
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
why not just, not unequip the weapon until they have confirmed that they want to drop it, then, unequip it and remove the item from inventory, otherwise do nothing. :)
 

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
why not just, not unequip the weapon until they have confirmed that they want to drop it, then, unequip it and remove the item from inventory, otherwise do nothing. :)
It's not possible because Im using also a Equip Scene from Original Rpg maker so... when You remove there weapon it comes automaticaly to inventory and my custom inventory shows check the free space of "backpack" and if there is any it ask if You want to drop it or keep it :p

hah I've foud somehting like this but I need to get ID from variable here:

$game_actors[id].change_equip_by_id(slot, equip) if $game_actors[id]
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
For that script call you could do this.. 

a = $game_actors[1] id = a::equips[0]::id a::change_equip_by_id(0, id) :)
 

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
a = $game_actors[1]
id = a::equips[#game_varibale[74]]::id  
a::change_equip_by_id(0, id)
 

where put here variable number XD?
 
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
What value does variable 74 hold? Didnt you say it was holding the value gained from '$game_actors[1].equips[0].id' ?

If it is, then its not required because you can get that same value from the second line in the snippet i posted above: 

a = $game_actors[1] id = a::equips[0]::id # < same as $game_actors[1].equips[0].id a::change_equip_by_id(0, id)Which means there is no need for any variable. :)
 

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
What value does variable 74 hold? Didnt you say it was holding the value gained from '$game_actors[1].equips[0].id' ?

If it is, then its not required because you can get that same value from the second line in the snippet i posted above: 

a = $game_actors[1] id = a::equips[0]::id # < same as $game_actors[1].equips[0].id a::change_equip_by_id(0, id)Which means there is no need for any variable. :)
Im using this Script in Variable Option by Script : $game_actors[1].equips[0].id i put this code there and so 74 variable got weapon ID :D
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
Ok, I guess if you have your heart set on using the variable you could do this: 

$game_actors[id]::change_equip_by_id(0, $game_variables[74])How is that? :p
 

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
Ok, I guess if you have your heart set on using the variable you could do this: 

$game_actors[id]::change_equip_by_id(0, $game_variables[74])How is that? :p
working awesome thank You for all of Your help :)  

I finished with weapons setup... now armor.. and accessory xd and Im finished with scripts in my game xD
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
no worries ^_^
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,040
Members
137,569
Latest member
Shtelsky
Top