I was wondering if there is a way to make it in script to give a player exp.

I wrote my own custom code for ork to link to my custom 2d controller and in my code I manually deal damage to the enemy during a real time combat. For some reason the enemy dies using the orkframework death system, but the exp is not being given to the combatant. So is there a way to manually give exp in code using the api.
  • The exp would only automatically be given if the combatant dies in a running battle and you collect the battle loot/gains, either at death or in a battle end event.

    You can manually give exp by adding the value to the combatant's status value of the exp:
    combatant.Status[id].AddValue(exp, false, false, true, false, true, true, null);
    id is the ID/index of the status value, exp the experience that should be added (int value).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • So the reason I had asked about the adding custom exp was I am using ream time battles in my project. For my battles I am using the Real Time Battle Area. In the documentation it says these do no run the battle end or battle start events. Because of this I wasn't sure where to do the collect gain.

    For real time battles using the Real Time Battle Area component how would I add exp to a player on the death of an enemy.
  • Check out the Battle Gains Collection settings in Battle System > Real Time Battles. For area battles, you'll want to enable Collect Immediately to have a combatant's loot and exp be collected when they die instead of the end of a battle.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • So I have the option turned on already, but nothing. I checked to make sure enemy has an exp value in his stats and he does. Is there any other thing that I need in my scene for it to count as a battle. I have a real time battle arena in. When looking at the character GUI for the combatant component it shows him in battle. I am using the arena without a collier since that is supposed to make the whole scene a real time battle.

    I am not sure what else I could be missing. If I do the exp gain by code it works in reading the enemies exp stats.
  • I guess collecting loot and experience is also enabled - what about Show Gains? And how is your Loot Dialogue set up in Battle System > Battle End settings?

    Might be that the gains are collected, but just not shown.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.