Skip to content

how can i change a module script when making a character enter an area?

sarevok57sarevok57 Member Posts: 6,002
so what i want to do is, when a character enters an area ( presumably the "last boss" area ) i need the module properties on character death script to be changed

how i have the on character death script to work is that whenever your character dies, they just get resurrected and teleported back to a main area, which works flawlessly until the last area

is there a way to perhaps put in area properties a script that basically goes;

when char enters area, change module on death script to "this script" instead

thanks

Comments

  • ProlericProleric Member Posts: 1,316
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    You can do it yes. It depends on what you are currently doing with your scripts and if you actually want to change the "OnPlayerDeath" or "OnPlayerRespawn" event but you will want to alter one of those. For "OnPlayerDeath", again it depends on some things, like if you are using the horse system or different systems in that script, etc, you just need to add a check for the area you are in when you die. Something like so:
    #include "x3_inc_horse"
    void main()
    {
        object oPlayer = GetLastPlayerDied();
    
        string sArea = GetTag(GetArea(oPlayer));
        if (sArea == "TagOfAreaToCheck")
        {
            //Either just put whatever you want to happen here instead of the regular
            //death stuff or if you want to run a specific script then:
            //ExecuteScript("custom_on_death", oPlayer);
            return;//End the OnPlayerDeath script here so nothing below this happens
        }
    }
    

  • sarevok57sarevok57 Member Posts: 6,002
    actually i found a way to get around it, but thanks for the heads up, i can always try this in the future if i need to
Sign In or Register to comment.