Hello, is there a trigger for 'OnEquip' or 'UnEquip' in scripting? I'm creating a script that will be triggered when an item is equipped. The script should check if the weapon, armor, shoes, and garment have the same refine level. If the condition is met, a bonus will be applied. Can you suggest any possible methods for this scenario?
the code above is sample (AI Generated, just to show the algorithm)"
- script CheckRefineLevel -1,{
OnEquip:
// Variables to store refine levels
set .@refine_weapon, getequiprefinerycnt(EQI_HAND_R); // Main hand weapon
set .@refine_armor, getequiprefinerycnt(EQI_ARMOR); // Armor
set .@refine_shoes, getequiprefinerycnt(EQI_SHOES); // Shoes
set .@refine_garment, getequiprefinerycnt(EQI_GARMENT); // Garment
// Check if all items have the same refine level and meet the desired level (e.g. +10)
if (.@refine_weapon == 10 && .@refine_armor == 10 && .@refine_shoes == 10 && .@refine_garment == 10) {
// Apply bonus if all conditions are met
bonus bAtkRate,10; // Increase attack by 10%
bonus bMaxHP,5; // Increase MaxHP by 5%
dispbottom "All your equipment is refined to +10! Bonus applied.";
} else {
// Remove bonus if not all equipment are at +10
bonus bAtkRate,0; // Remove attack bonus
bonus bMaxHP,0; // Remove MaxHP bonus
dispbottom "Not all your equipment is refined to +10. No bonus applied.";
}
OnUnequip:
// Remove bonus when equipment is unequipped
bonus bAtkRate,0; // Remove attack bonus
bonus bMaxHP,0; // Remove MaxHP bonus
dispbottom "Equipment unequipped, bonus removed.";
end;
}
Question
zanjetopakin
Hello, is there a trigger for 'OnEquip' or 'UnEquip' in scripting? I'm creating a script that will be triggered when an item is equipped. The script should check if the weapon, armor, shoes, and garment have the same refine level. If the condition is met, a bonus will be applied. Can you suggest any possible methods for this scenario?
the code above is sample (AI Generated, just to show the algorithm)"
- script CheckRefineLevel -1,{ OnEquip: // Variables to store refine levels set .@refine_weapon, getequiprefinerycnt(EQI_HAND_R); // Main hand weapon set .@refine_armor, getequiprefinerycnt(EQI_ARMOR); // Armor set .@refine_shoes, getequiprefinerycnt(EQI_SHOES); // Shoes set .@refine_garment, getequiprefinerycnt(EQI_GARMENT); // Garment // Check if all items have the same refine level and meet the desired level (e.g. +10) if (.@refine_weapon == 10 && .@refine_armor == 10 && .@refine_shoes == 10 && .@refine_garment == 10) { // Apply bonus if all conditions are met bonus bAtkRate,10; // Increase attack by 10% bonus bMaxHP,5; // Increase MaxHP by 5% dispbottom "All your equipment is refined to +10! Bonus applied."; } else { // Remove bonus if not all equipment are at +10 bonus bAtkRate,0; // Remove attack bonus bonus bMaxHP,0; // Remove MaxHP bonus dispbottom "Not all your equipment is refined to +10. No bonus applied."; } OnUnequip: // Remove bonus when equipment is unequipped bonus bAtkRate,0; // Remove attack bonus bonus bMaxHP,0; // Remove MaxHP bonus dispbottom "Equipment unequipped, bonus removed."; end; }
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.