Auto-translated
Hello everyone, I need help writing a script. The idea is that any random hero enters a specific building, and this building checks if the hero has a perk and gives him a bonus for that perk. The problem is that I need to check if the hero has multiple perks and give him multiple bonuses if he has them. I've only learned how to write code to check for one perk, and the game doesn't read any further. I'm asking coders for help; I need a simple script of this type: function perksF(heroname) if "hero has skill" (heroname, for example, the skill "Archery") then "add creatures to hero" (heroname, for example, "Archers," quantity 1) also if "hero has skill" (heroname, for example, "Expert Logistics") then "add artifact to hero" (heroname, for example, "Shackles of Fate," non-transferable) also if "hero has skill" (heroname, for example, "Advanced Logistics") then "change hero stat" (heroname, for example, "Defense," +2) also if "hero has skill" (heroname, for example, "Advanced Light Magic") then "teach hero spell" (heroname, for example, "Slow," expert level) end end Trigger (hero touches object named "tttt," launch function perksF) The examples themselves can be different; the principle and logic of writing the code are important, so that one touch trigger checks a large number of perks and gives the hero creatures, an artifact, or a spell. It also needs to include a "nil" check, so that the touch works only once and doesn't give bonuses a hundred times. I would be grateful for an explanation. Another question: I need a script that will work at the start of a battle. StartCombat: if a Necromancer hero is present in the battle and has the "Leadership" perk, then the enemy hero receives -1 to morale, and similarly for the advanced and expert levels, -2 and -3 morale. Thank you for your help.