Good morning everyone. I would like to know how (and if it possible) run a custom script every time the player dies. I currently work on a project for Android and I would like to pop an ad video every time the player will die in my game. Is it possible to do so? If yes, how can I do it?
I know how to do it in "normal" code but as everything is set up by the framework, how can I integrate the ad script?

Many thanks beforehand for your help.
  • edited July 2017
    I guess you can make an event to call a function with your custom script when the player is dead, I m not on my dev PC, but if you search at your combatant, there is a place that you can call a death event.
    Post edited by dlevel on
  • Thanks for your answer.
    Yes, there is a Death Setting in Combatants->Combatants but I can't see where I can run my custom script.
    There are few option to tick: "No Revive", "Leave on death", "Keep Prefabs", "Sympathy change", "Earn log text".
    Then there is "Variable changes"->Variable Origin that could be Global Combatant or Spawner and then you can add a new Change variable that could be Value, Game value, Player Prefs or Scene Name.
    I really can't see the option to run a custom script.
    Can you please tell me how can you do it?
    Many thanks
  • I'm sure you have already created a death event for your player. In it, just add a Call Function node to call the function responsible for showing the ads.
  • As the others already explained - this can be handled in the death battle event of your combatant by using a Call Function node in that battle event.

    In case you don't didn't go through the game tutorials yet, I'd highly recommend doing so, as all these basic ORK workflow/knowledge things are explained there :)
    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!
  • Many thanks for your answer! I now have another question and before to dive in I would like to know if it possible or no to do so:
    I would like to make a game for Android and I would like to use a control from Control Freak 2 (https://www.assetstore.unity3d.com/en/#!/content/11562).
    As your character is set up by a framework using DLL and not proper c# code, is it possible the integration of my "custom" control instead of the "standard" control from the framework?
    Thanks again for your answer.
  • Yes, that should be possible - ORK's input keys support using custom control solutions.

    Set up an input key using the Custom input origin, this allows you to define static functions for button and axis values through reflection. Depending on how Control Freak 2 works, you might need to write a small wrapper class with compatible functions.
    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.