Yanfly's Skill Cost Manager and Selchar's Item Charges

Status
Not open for further replies.

Mawichan

Veteran
Veteran
Joined
Jan 24, 2018
Messages
55
Reaction score
6
First Language
Spanish
Primarily Uses
RMVXA
Hello there! I have a question about custom skill costs for Yanfly's Skill Cost Manager ... (github link).
I'd like to create a skill for bow/crossbow-type weapons that costs arrows/bolts.

I know how to make a skill use items as "fuel", however, I'm using Selchar's Item Charges... (google drive link). This means I have Tsukihime's Instance Items as required by the former. With Instance Items, every single arrow appears as a separate element in the inventory, instead of stacking together, so I'm worried it will make the inventory be messy and cluttered, considering how many arrows the player may need to carry around.

I figured that it would be more convenient to have the player carry a quiver as a single item, and the arrows it carries would be represented by charges. Then the bow skills would have to cost one charge of the item, and not the instance of the item itself.
Now the question is, how do I set that up?

For example this is how to set the skill to cost an item via skill notetags

<custom cost requirement>
$game_party.item_number($data_items[1]) >= 1
</custom cost requirement>

<custom cost perform>
$game_party.lose_item($data_items[1], 1)
</custom cost perform>

But how do I make the skill cost one charge of an item? What do I write instead of "$game_party.item_number($data_items[1]) >= 1" and "$game_party.lose_item($data_items[1], 1)"?

Well, that's all I want to know, thank you for your time.
 

Mawichan

Veteran
Veteran
Joined
Jan 24, 2018
Messages
55
Reaction score
6
First Language
Spanish
Primarily Uses
RMVXA
EDIT: Good sir Selchar helped me and wrote how the appropiate notetags should be. Everything seems to be working fine now, so I'll get this thread closed. But not before quoting Selchar's solution, for reference for future users who may be looking for achieving something similar.
----------------------------------------------------------------------------------
*reads other thread as well* Under the assumption that the item(quiver) would simply be in your invenory the following should work.

Code:
<custom cost requirement>
$game_party.find_instance_item($data_items[X])
</custom cost requirement>

<custom cost perform>
$game_party.consume_item($game_party.find_instance_item($data_items[X]))
</custom cost perform>
The above of course doesn't work properly(negative charge o.o) if you use the <no charge keep> notetag but in the event that you do use it then add the following to the bottom of my script.

Code:
class Game_Party < Game_Unit
def find_instance_item_wc(template_item)
container_list = item_container_list(template_item)
return container_list.find {|obj| obj.template_id == template_item.template_id && obj.current_charge > 0 }
end
end
Then use...

Code:
<custom cost requirement>
$game_party.find_instance_item($data_items[X])
</custom cost requirement>

<custom cost perform>
$game_party.consume_item($game_party.find_instance_item($data_items[X]))
</custom cost perform>
In both cases X would be the ID of your item who's charge you wish to consume.
Once again, thanks a lot to Selchar, praised be him and his projects. And I hope this gets to help others in a similar situation.
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
[closed]IgnoreMe[/closed]
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top