adding target rate to user of a spell/skill

● ARCHIVED · READ-ONLY
Started by Countyoungblood 3 posts View original ↗
  1. Id like to increase the target rate in the damage formula.. is this possible?

    ive tried a.tgr and a.sparam(0) gives me an error i dont understand.

    also, would adding to the target rate be permanent?

    update: ive found the random target function..

    Code:
    def random_target
        tgr_rand = rand * tgr_sum
        alive_members.each do |member|
          tgr_rand -= member.tgr
          return member if tgr_rand < 0
        end
        alive_members[0]
      end

    since it only returns if the result is below 0 im wondering if tgr for each character is actually a negative value.. but i really dont understand whats going on here. going to try a.tgr with -100 and see if anything changes.
  2. you completely misunderstood how the target rate works in that code section. The engine computes a random number between zero and all TGRs added together, and then substracts single target TGRs until the result is negative - and how many times the single tgrs were substracted then tells the engine the index of the target that fits that random number.

    However, you're completely overthinking this. What you want is to use a state that reduces the TGR, and have that state added to the user as part of the damage formula.

    At the moment when the damage formula is processed, there is no target selection - for the current skill that is in the past, and for the next skill that has not yet happened. So adding a state is completely sufficient and prevents a lot of other effects from going wrong.
  3. ah...i think i get it now. lets see.. rand * sum - your target rating.. again..again..again.. ok you're first so far..
    I appreciate the explanation it cleared it up a good bit. what i was going for is a "hate" rating for different attacks.. i wanted for example a heal spell to increase the chance for the user to be attacked but as I'm writing this out I'm realizing turn based combat isn't the best fit for such an idea. so adding just a basic "attack me" state to the mega heals would do enough.. and prompt a response from the player to protect or distract the enemy away from the healer.

    thanks for the reply, issue resolved.