Problem - Identifying the Actor's WeaponTypeID [SOLVED]

● ARCHIVED · READ-ONLY
Started by Dobberman 9 posts View original ↗
  1. Dear friends,


    I am using the RPG MAKER MV and some plugins that allow me to call extra commands in the skill damage formula (Yanfly Damage Core and Ramza Dual Weild).

    I'm want to do a conditional formula skill: IF the Actor is using a WType 1 weapon in the first hand the damage formula will be 1000, otherwise it is 9999.

    WType is the type of weapon defined in the Database in the Types tab.
    The Actor has the Dual Wield trait, and formula "A" can only be used if the first hand equipped weapon is a Type 1 weapon, regardless of the weapon equipped on the second hand.

    This is the code i'm using, but whenever i use this ability, it deals 0 damage.

    Code:
    if(user.isWtypeEquipped(4)[0]) {value += 1000;} else {value += 9999;}

    If someone can help me to find the command that can be used in the IF condition to identify which WType is equipped in the first hand or know of some alternative way to solve this impasse, i will be very grateful!


    Thank you in advance for your attention.
    Hugs!
  2. var weapons = $gameActors(1).weapons(); // get actor 1's weapons
    var wtypeId = weapons[0].wtypeId; // save the wtypeId from the returned array. This should be the equipped weapon
    console.log(wtypeId); // logs the id of the weapon type found in the database.

    the wtypeId will give you the id of the weapon type. For example, a sword would be 2, an axe 4 by default.
  3. High Plains Design Studio said:
    var weapons = $gameActors(1).weapons(); // get actor 1's weapons
    var wtypeId = weapons[0].wtypeId; // save the wtypeId from the returned array. This should be the equipped weapon
    console.log(wtypeId); // logs the id of the weapon type found in the database.

    the wtypeId will give you the id of the weapon type. For example, a sword would be 2, an axe 4 by default.

    Hi there!


    I think I did not understand the command lines soo well, but that's the error log.
    If a change the code to: $gameActors.actor(1) ... the error log show: undefined ... VM1358:3.

    The Screenshot_1 is the error log, Screenshot_2 is YEP CommonEventMenu.js line 1290, 1291 and 1292, and the Screenshot_3 is the code undefined.


    Any idea?
    Thank you, anyway.
  4. Make sure it reads: $gameActors.actor(1)
    try,
    console.log($gameActors.actor(1));

    and see what it logs for you. it should log an object that shows the first character in the database.

    //EDIT: forgot a )
  5. High Plains Design Studio said:
    Make sure it reads: $gameActors.actor(1)
    try,
    console.log($gameActors.actor(1);

    and see what it logs for you. it should log an object that shows the first character in the database.

    Right. That's the log.

    Code:
    Game_Actor {_hp: 28, _mp: 4, _tp: 0, _hidden: false, _paramPlus: Array(8), …}_actionInputIndex: 0_actionState: ""_actions: []_actorId: 1_anchorX: undefined_anchorY: undefined_animations: []_assistCount: 0_baseParamCache: (2) [28, 4]_battleCount: 0_battlerName: "Actor1_1"_blockReduction: 0_buffTurns: (8) [0, 0, 0, 0, 0, 0, 0, 0]_buffs: (8) [0, 0, 0, 0, 0, 0, 0, 0]_cacheCanCBattleEquipChange: undefined_cacheChangeBattleEquipCooldown: undefined_cacheLimitedUseMax: {}_cacheParamBuffRate: {0: 1, 1: 1}_cacheWeaponAni: undefined_cacheWeaponHue: undefined_cacheWeaponImage: undefined_cacheWeaponMotion: undefined_cerBlockRate: 0_characterIndex: 0_characterName: "Actor1"_checkPassiveStateCondition: []_classId: 1_cooldownTickRate: {}_cooldownTurns: {}_counterTotalCache: undefined_damagePopup: false_deathCount: 0_disableDashing: false_effectType: null_equipReq: undefined_equips: Array(10)0: Game_Item_dataClass: "weapon"_itemId: 1__proto__: initialize: ƒ (item)arguments: nullcaller: nulllength: 1name: ""prototype: {constructor: ƒ}__proto__: ƒ ()[[FunctionLocation]]: rpg_objects.js:1109[[Scopes]]: Scopes[1]isArmor: ƒ ()arguments: nullcaller: nulllength: 0name: ""prototype: {constructor: ƒ}__proto__: ƒ ()[[FunctionLocation]]: rpg_objects.js:1133[[Scopes]]: Scopes[1]isEquipItem: ƒ ()arguments: nullcaller: nulllength: 0name: ""prototype: {constructor: ƒ}__proto__: ƒ ()[[FunctionLocation]]: rpg_objects.js:1137[[Scopes]]: Scopes[1]isItem: ƒ ()isNull: ƒ ()isSkill: ƒ ()isUsableItem: ƒ ()isWeapon: ƒ ()itemId: ƒ ()object: ƒ ()setEquip: ƒ (isWeapon, itemId)setObject: ƒ (item)constructor: ƒ Game_Item()__proto__: Object1: Game_Item {_dataClass: "", _itemId: 0}2: Game_Item {_dataClass: "", _itemId: 0}3: Game_Item {_dataClass: "armor", _itemId: 2}4: Game_Item {_dataClass: "", _itemId: 0}5: Game_Item {_dataClass: "", _itemId: 0}6: Game_Item {_dataClass: "", _itemId: 0}7: Game_Item {_dataClass: "", _itemId: 0}8: Game_Item {_dataClass: "", _itemId: 0}9: Game_Item {_dataClass: "", _itemId: 0}length: 10__proto__: Array(0)_exp: {1: 0, 2: 0, 3: 0, 4: 0}_faceIndex: 0_faceName: "Actor1"_flatReduction: 0_groupDefeat: false_hidden: false_hp: 28_isDMGCapped: undefined_isRowLocked: undefined_jp: {1: 0, 2: 0, 3: 0, 4: 0}_killCount: 0_lastBattleSkill: Game_Item {_dataClass: "", _itemId: 0}_lastCommandSymbol: ""_lastMenuSkill: Game_Item {_dataClass: "", _itemId: 0}_lastTargetIndex: 0_level: 1_locked: false_magBlockRate: 0_maxTpCache: 100_maximumDamage: undefined_maximumHealing: undefined_motionRefresh: false_motionType: null_mp: 4_name: "Carlos"_nickname: ""_paramLimitMax: (8) [0, 0, 0, 0, 0, 0, 0, 0]_paramLimitMin: (8) [0, 0, 0, 0, 0, 0, 0, 0]_paramPlus: (8) [0, 0, 0, 0, 0, 0, 0, 0]_partyLimitGaugeMax: undefined_partySwitchCooldown: 0_passiveStatesRaw: []_permBarrier: 0_phyBlockRate: 0_profile: ""_profileImage: ""_profileImgAlign: "right"_profileStatusText: [""]_replaceAttackSkillId: undefined_replaceGuardSkillId: undefined_requestRowStatesRefresh: true_required: false_result: Game_ActionResult {used: false, missed: false, evaded: false, physical: false, drain: false, …}_row: 1_rowStatesRaw: undefined_selected: false_skillLimitedUses: {13: 0}_skills: (14) [3, 10, 11, 12, 13, 20, 21, 22, 23, 31, 32, 33, 34, 41]_sparam: undefined_sparamPlus: (10) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]_speed: 0_stateCounter: {1: undefined}_stateSteps: {}_stateTurns: {}_states: []_subclassId: 0_summons: []_totalDamageDealt: 0_totalDamageTaken: 0_totalHealingDealt: 0_totalHealingTaken: 0_tp: 0_tpMode: 1_turnBarrier: []_unlockedClasses: (2) [0, 1]_unlockedTpModes: (4) [1, 2, 3, 4]_warmupTurns: {}_weaponImageId: 0_xparam: undefined_xparamPlus: (10) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]agi: (...)atk: (...)cerb: (...)cev: (...)cnt: (...)cri: (...)def: (...)eva: (...)exr: (...)fdr: (...)grd: (...)hit: (...)hp: (...)hrg: (...)level: (...)luk: (...)magb: (...)mat: (...)mcr: (...)mdf: (...)mdr: (...)mev: (...)mhp: (...)mmp: (...)mp: (...)mrf: (...)mrg: (...)pdr: (...)pha: (...)phyb: (...)rec: (...)tcr: (...)tgr: (...)tp: (...)trg: (...)__proto__: Game_Battler
  6. Great, that's working. Now,. go ahead and just add the weapons() to the actor like so:

    console.log($gameActors.actor(1).weapons());

    It should return an array
  7. High Plains Design Studio said:
    Great, that's working. Now,. go ahead and just add the weapons() to the actor like so:

    console.log($gameActors.actor(1).weapons());

    It should return an array
    Rigth. That's the log.

    (2) [{…}, {…}]0: afterStealEval: "target._paramPlus[0] -= item.params[0]↵target._paramPlus[1] -= item.params[1]↵target._paramPlus[2] -= item.params[2]↵target._paramPlus[3] -= item.params[3]↵target._paramPlus[4] -= item.params[4]↵target._paramPlus[5] -= item.params[5]↵target._paramPlus[6] -= item.params[6]↵target._paramPlus[7] -= item.params[7]↵"animationId: 6armorBuyPrice: {}armorBuyPrices: []armorSellPrice: {}armorSellPrices: []attackReplace: 0attackReplaceEval: ""augmentDataAttach: {}augmentDataDetach: {}augmentEvalAttach: {}augmentEvalDetach: {}augmentSlots: (4) ["Glyph", "Mark", "Orb", "Orb
    augmentTypes: []autoDebuff: truebarrierPenetrationFlat: 0barrierPenetrationFlatEval: ""barrierPenetrationRate: 0barrierPenetrationRateEval: ""barrierRegen: []barrierRegenEval: []battleStartBarrierPoints: []battleStartBarrierPointsEval: []blockReductionMod: 0boostCountValue: 1breakDamageCap: undefinedbreakEval: ""breakSound: {name: "Crash", volume: 100, pitch: 150, pan: 0}canDisassemble: truecanDiscard: truecanRename: truecanSell: falsecancelInstantItem: []cancelInstantSkill: []cannotSelect: []cannotSell: falsecerArmorPenFlat: 0cerArmorPenRate: 0cerArmorRedFlat: 0cerArmorRedRate: 0cerBlockRateMod: 0certainCritRateBonus: 0certainTaunt: falsechangeBattleEquipCooldown: 0cooldownChange: {}cooldownDuration: {}cooldownRate: {}counterSkills: []counterSkillsEval: ""counterTotal: 0counterTotalEval: ""critMultBonus: 0customDisassembledEval: ""customDisassemblerEval: ""customEquipReqCondition: ""customEquipReqText: ""customSynthEval: ""damageCap: undefineddescription: ""disableChangeBattleEquip: falsedisableDashing: falsedisassembleItems: {}disassembleSound: {name: "Break", volume: 100, pitch: 150, pan: 0}disassemblerRates: []disassemblerTypes: []durMax: 200durVariance: 5durability: 100elementAbsorb: []elementAmplify: {}elementForcedRate: {}elementMagnify: {}elementNull: falseelementReflect: {}equipRequirements: {atLeast: Array(9), atMost: Array(9), classes: Array(0), skills: Array(0), switches: Array(0), …}etypeId: 1evadeCounter: falseflatCritBonus: 0flatParams: (8) [0, 0, 0, 0, 0, 0, 0, 0]flatReductionMod: 0flatSParams: (10) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]flatXParams: (10) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]gauge1: "UNDEFINED"gauge2: "UNDEFINED"gauge3: "UNDEFINED"gaugeIcon1: "UNDEFINED"gaugeIcon2: "UNDEFINED"gaugeIcon3: "UNDEFINED"globalCooldownChange: 0globalCooldownDuration: 1globalCooldownRate: 1globalUseMax: 0globalUseMaxEval: ""globalWarmupChange: 0groupType: 1guardReplace: 0guardReplaceEval: ""guardUnleash: []guardUnleashRate: {all: 0}healCap: undefinedhitCounter: falseiconIndex: 96id: 2ignoreBlocking: falseignoreCertainTaunt: falseignoreMagicTaunt: falseignorePhysTaunt: falseinfoEval: ""infoTextBottom: ""infoTextTop: ""instantItem: []instantSkill: []itemBuyPrice: {}itemBuyPrices: []itemCategory: []itemGaugeColor1: 13itemGaugeColor2: 5itemGaugeText: "Adaga Desamolada"itemGaugeTextColor: 16itemSellPrice: {}itemSellPrices: []jpRate: 1lifeSteal: {hpPhysicalRate: 0, hpMagicalRate: 0, hpCertainRate: 0, hpPhysicalFlat: 0, hpMagicalFlat: 0, …}magArmorPenFlat: 0magArmorPenRate: 0magArmorRedFlat: 0magArmorRedRate: 0magBlockRateMod: 0magicTaunt: falsemagicalCritRateBonus: 0maskName: ""maxBuff: (8) [0, 0, 0, 0, 0, 0, 0, 0]maxDebuff: (8) [0, 0, 0, 0, 0, 0, 0, 0]maxItem: 99maxParams: []meta: {}minParams: []name: "Adaga Desamolada"nonIndependent: falsenote: ""nullCertainTaunt: falsenullMagicTaunt: falsenullPhysTaunt: falseonCreationEval: ""parameterEval: ""params: (8) [0, 0, 2, 0, 0, 0, 0, 0]partyLimitGaugePlus: 0partyLimitGaugeRate: 1passiveStates: []phyBlockRateMod: 0physArmorPenFlat: 0physArmorPenRate: 0physArmorRedFlat: 0physArmorRedRate: 0physTaunt: falsephysicalCritRateBonus: 0pictureHue: 0pictureImg: ""plusParams: (8) [0, 0, 0, 0, 0, 0, 0, 0]plusSParams: (10) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]plusXParams: (10) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]price: 2proxyBuy: 0randomVariance: 0rateParams: (8) [1, 1, 1, 1, 1, 1, 1, 1]rateSParams: (10) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]rateXParams: (10) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]recipeArmor: []recipeItem: []recipeWeapon: []reflectAnimationId: 0repairArmorType: [0]repairArmorUnbreakable: [false]repairDurabilityEval: ""repairSound: {name: "Skill2", volume: 100, pitch: 150, pan: 0}repairWeaponType: [0]repairWeaponUnbreakable: [false]replaceItemCost: {}rowLock: falsesellPrice: undefinedsetPriorityName: falseskillUseMax: {}skillUseMaxEval: {}slotsApplied: []spriteCannotMove: falsestealRateBonus: (5) [0, 0, 0, 0, 0]stealSound: {name: "Equip1", volume: 80, pitch: 120, pan: 0}stypeCooldownChange: {}stypeCooldownDuration: {}stypeCooldownRate: {}stypeUseMax: {}stypeUseMaxEval: {}stypeWarmupChange: {}synthCost: 0synthIngredients: []synthSeName: "Twine"synthSePan: undefinedsynthSePitch: 100synthSeVol: 100targetCounterFlat: 0targetCounterRate: 1targetCounterRateEval: ""textColor: 0traits: [{…}]types: ["ALL"]upgradeArmorType: [0]upgradeEffect: []upgradeItemType: []upgradeSlotCost: 1upgradeSlots: 0upgradeSlotsVariance: 1upgradeSound: "Heal2"upgradeWeaponType: [0]useArmorCostRate: {}useArmorCostSet: {}useItemCostRate: {}useItemCostSet: {}useWeaponCostRate: {}useWeaponCostSet: {}variableBuyPrice: {}variableBuyPrices: []variableSellPrice: {}variableSellPrices: []warmupChange: {}weaponAnimationId: 0weaponAttackMotion: undefinedweaponBuyPrice: {}weaponBuyPrices: []weaponHue: undefinedweaponImageIndex: 0weaponRanged: falseweaponSellPrice: {}weaponSellPrices: []weaponUnleash: []weaponUnleashRate: {all: 0}wtypeId: 4__proto__: Object1: {id: 1, animationId: 6, description: "", etypeId: 1, traits: Array(1), …}length: 2__proto__: Array(0)"]
  8. There seems to be a bunch of extra stuff in there. It might be other plugins you have installed. Either way. Add the 0 index and see what happens next.

    console.log($gameActors.actor(0).weapons()[0]);
  9. High Plains Design Studio said:
    There seems to be a bunch of extra stuff in there. It might be other plugins you have installed. Either way. Add the 0 index and see what happens next.

    console.log($gameActors.actor(0).weapons()[0]);

    Sorry about the others plugins, hehehe...

    PROBLEM SOLVED.

    Thank you for your patience and help. Thanks to you, i was able to solve.
    The code is: console.log($gameActors.actor(1).weapons()[0].wtypeId)
    And this code return the type of weapon equiped on first slot.

    Thank you soo much!
    Infinity hugs!