YEP SKILL CORE QUESTIONS

Could you elaborate on how you implemented your weapon mastery system? I'd love to have such a feature for my game. This is off topic, so I wouldn't mind doing this over PM if need be.

I could just post a mini tutorial as a new thread...what do you think about that?
Could you elaborate on how you implemented your weapon mastery system? I'd love to have such a feature for my game. This is off topic, so I wouldn't mind doing this over PM if need be.

I could make a mini tutorial as a new thread...what do you think about that?


Hey one more question all. So I am working on my Reload skill, and it dawned on me. What if players have more or less ammo than what the weapon can hold? for example gun holds 8 rounds and player has 3 rounds. or vice versa.

I think I have thought of a cleaver way to check it, compare the ammo player has to 'max ammo' variable of said weapon.

if ammo >= max ammo.. changes variable to eaqual 'max ammo' variable
if ammo <= max ammo. changes variable to equal amount of bullets in inventory.

I cobbled the below code together, but i feel i went wrong somewhere....



Spoiler: THE CODE
if ($gameParty.hasItem($dataItems[5]) >= ($gameVariables.value(221)) { {

$gameVariables.setValue(222, $gameVariables.value(221));

} else {

$gameVariables.setValue(222, $dataItems[5]);

}

</Custom Execution>


What did I do wrong here?

Just FYI
Variable 222 = Current Ammo count
Variable 221 = Magazine/ Ammo Max
Data Item 5 = small rounds

Seems like there's an extra open curly brace after your first it statement.

EDIT- I didnt realize my first message went through, sorry for double posting.
I could just post a mini tutorial as a new thread...what do you think about that?
Sure a tutorial would be awesome!
Sure a tutorial would be awesome!

Well, now that I think about it...my last tutorial took some time to be approved so maybe that's not the best plan lol. I'll just do both, I'll post and PM you.
I could make a mini tutorial as a new thread...what do you think about that?




Seems like there's an extra open curly brace after your first it statement.

EDIT- I didnt realize my first message went through, sorry for double posting.


Checked the double } sadly that wasnt the issue. Right now, variable 222 is still returning as 0.
I have updated the code to try and determine properly the number of items. It currently looks like this, but still doesn't work.

Spoiler: New Code
<Custom Execution>


var item = $dataItems[5];

if($gameParty.numItems(item) >= ($gameVariables.value(221)) {

$gameVariables.setValue(222, $gameVariables.value(221));

} else {

$gameVariables.setValue(222, $gameParty.numItems(item);

}





</Custom Execution>
Maybe this thread will help.


Have you looked at Yanfly skill cost item plugin? It allows you to set a skill to need an item before you cast, it shows this item cost in the battle skill menu, etc. I'm sure you could still link the item to your variables that you show for ammo count. This may be easier to use than controlling the ammo reload within the skill note tag with script calls. This may do away with the need for a reload skill.
Maybe this thread will help.


Have you looked at Yanfly skill cost item plugin? It allows you to set a skill to need an item before you cast, it shows this item cost in the battle skill menu, etc. I'm sure you could still link the item to your variables that you show for ammo count. This may be easier to use than controlling the ammo reload within the skill note tag with script calls. This may do away with the need for a reload skill.

Edit:

already using YEP skill item cost .It handles the of item consumption skills in my game.

I’m trying to update the variables for the “gun” at this point. I’m using YEP <Custom cost> Eval. So there is a number that tells you shots remaining before reloading.

But currently it will only change the “current ammo” to equal the max the weapon can hold” which is fine if the party has more ammo than can be placed int the firearm.

However in the case that the party has 3 rounds and the firearm holds 8. If the player were to reload. I would like for the ammo to to whatever the inventory, showing 3/8 shots.
I'm kinda stumped at this point myself. It may just be that the script language is off somehow. Or sometimes Yanfly note tag uses slightly different script calls. If I figure anything out I'll post it though.

edit:

maybe try:

Code:
if ($gameParty.hasItem($dataItems[5]) && $dataItems[5] >= ($gameVariables.value(221)) { {
$gameVariables.setValue(222, $gameVariables.value(221));
} else {
$gameVariables.setValue(222, $dataItems[5]);
}
Edit:

already using YEP skill item cost .It handles the of item consumption skills in my game.

I’m trying to update the variables for the “gun” at this point. I’m using YEP <Custom cost> Eval. So there is a number that tells you shots remaining before reloading.

But currently it will only change the “current ammo” to equal the max the weapon can hold” which is fine if the party has more ammo than can be placed int the firearm.

However in the case that the party has 3 rounds and the firearm holds 8. If the player were to reload. I would like for the ammo to to whatever the inventory, showing 3/8 shots.
Have you considered using state counters instead?
Have you considered using state counters instead?

Yeah but I’ll use them for enemies , I want players to get a clear picture of how many shots remaining
Yeah but I’ll use them for enemies , I want players to get a clear picture of how many shots remaining

That and I’m 90% completed with this system. Just need the condition to handle when player holds less ammo than the gun carries

@HumanNinjaToo I’ll try this when I get off work
I'm at work rn too I will definitely try again when I get home tonight.

Also, just noticed a missing closed parenthesis in you if statement:

if($gameParty.numItems(item) >=

Try:
if($gameParty.numItems(item)) >=
That and I’m 90% completed with this system. Just need the condition to handle when player holds less ammo than the gun carries

@HumanNinjaToo I’ll try this when I get off work
You can keep the same info displayed in the same format you have now if u used the counters. You would simply reference user.getStateCounter(stateId) instead. No pressure tho, just throwing the idea out there as last resort if u cant get ur current method working.
You can keep the same info displayed in the same format you have now if u used the counters. You would simply reference user.getStateCounter(stateId) instead. No pressure tho, just throwing the idea out there as last resort if u cant get ur current method working.

I think I would still run into the same problem with state ID's as the current issue I am having is converting the number (quantity) of an item to an integer.

I have solved part of my problem. It was two fold first was the format. It has to be written as:

Partial code:
Spoiler: Partial Code
if ($gameParty.hasItem($dataItems[5]) && $dataItems[5] >= ($gameVariables.value(221)) {

<Custom Execution>

$gameVariables.setValue(222, $gameVariables.value(221));

</Custom Execution>

The problem I am having is this.

$gameVariables.setValue(222, $dataItems[5]);

Its not the correct way to reference the amount of items in category 5 I think
I think I would still run into the same problem with state ID's as the current issue I am having is converting the number (quantity) of an item to an integer.

I have solved part of my problem. It was two fold first was the format. It has to be written as:

Partial code:
Spoiler: Partial Code
if ($gameParty.hasItem($dataItems[5]) && $dataItems[5] >= ($gameVariables.value(221)) {

<Custom Execution>

$gameVariables.setValue(222, $gameVariables.value(221));

</Custom Execution>

The problem I am having is this.

$gameVariables.setValue(222, $dataItems[5]);

Its not the correct way to reference the amount of items in category 5 I think

You're attempting to reference a specific item category? Also, I am confused at the <Cutstom Execution> Notetag within an if statement, I didn't know that was possible...

@staf00 I am working on the guide for my weapon mastery system currently
You're attempting to reference a specific item category? Also, I am confused at the <Cutstom Execution> Notetag within an if statement, I didn't know that was possible...

@staf00 I am working on the guide for my weapon mastery system currently

I finally figured it out! I ended up just changing my methods.

First I created a parallel common event that is always converting the # of ammo in a inventory into a variable.

next in the reload skill, I have a <Custom Execution> Command that only sets the variable for current ammo to equal the number for the variable of ammo of said firearm.
So if a player has 3 rounds they’d get 3 /8 shots but if they have 15 they’d get 15/8.

lastly the skill calls a common event named ammo corrector

this common event is simple. Says if users current ammo count is > ammo max count. Change current to max count. This prevents having any numbers above what the magazine of the gun can carry.
Code:
$gameVariables.setValue(222, $gameParty.numItems($dataItems[5]));
Just for future reference,
I used this code in the console and was able to set the value of variable 222 to the amount of Item 5 the party currently held
Code:
$gameVariables.setValue(222, $gameParty.numItems($dataItems[5]));
Just for future reference,
I used this code in the console and was able to set the value of variable 222 to the amount of Item 5 the party currently held

AH! That makes sense. It's just the <Custom Execution> code seems to be particular of what it accepts and how. This way is simpler. but I will keep that snippet in handy in case I need it Thanks
AH! That makes sense. It's just the <Custom Execution> code seems to be particular of what it accepts and how. This way is simpler. but I will keep that snippet in handy in case I need it Thanks
I'm glad you were able to figure this out, happy game making!
I'm glad you were able to figure this out, happy game making!

might still add in the snippet of code in the morning as it may save me a step and processing power of having to always calculate the number of item into a variable.(Tired from beating my head into a wall over this )

in any case, thank you and everyone else greatly .

edit: @xDRAGOONx updated using your snippet of code. Have eliminated the need to have a common event for ammo counting. Now I just change the variable to the amount of ammo in inventory, and then call the common event to correct it if it goes over carrying capacity.

This can be closed now as it’s solved

Original thread: https://forums.rpgmakerweb.com/threads/yep-skill-core-questions.122710/