Author Topic: How to destroy an object type creature OnClientLeave?  (Read 672 times)

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« on: August 01, 2014, 10:46:10 pm »


               

Description: There is just one player with the variable "fighting". I would like to kill oBoss if the player with variable "fighting" leaves the game. 



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #1 on: August 01, 2014, 10:52:02 pm »


               

I tried to use oPC = GetExitingObject() on module event leaving, but oPC isn't an object valid.


 


    object oBoss; //this is my object I would like to kill

    object oPC = GetExitingObject();

    if(GetLocalInt(oPC, "fighting") == TRUE) DestroyObject(oBoss);


               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #2 on: August 01, 2014, 11:10:46 pm »


               

You would need to identify what oBoss is (such as by GetObjectByTag()).  Also, I'm not sure if locals stay on PCs when they get to the OnClientLeave event.  You might want to test for that.  GetExitingObject() does return the PC, but there is little data left to the PC at this point. See the Lexicon.



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #3 on: August 01, 2014, 11:11:04 pm »


               

Is possible to check onclientleave if there is no players with variable "fighting" and then destroyobject(oBoss)?


 


//I just know to check if someone has the variable like this



    object oAny = GetFirstPC();

    while (GetIsObjectValid(oAny))
    {
    if(GetLocalInt(oAny, "fighting") == TRUE) doAction();
    oAny = GetNextPC();
    }


               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #4 on: August 01, 2014, 11:14:08 pm »


               


You would need to identify what oBoss is (such as by GetObjectByTag()). 




 


my oBoss is just occult (object oBoss) from the script above


 


I need to use something like this to destroy my boss 


 


    object oPointElazul = GetObjectByTag("Point_Object_Elazul");

    object oArea = GetArea(oPointElazul);

    object oBoss = GetFirstObjectInArea(oArea);

 


while(GetIsObjectValid(oBoss))

    {

        if((GetTag(oBoss) == "Batalha_Moric") || (GetTag(oBoss) == "Batalha_Toro") || (GetTag(oBoss) == "Batalha_Gina") || (GetTag(oBoss) == "Batalha_Bauguro") || (GetTag(oBoss) == "Batalha_Kenshin") || (GetTag(oBoss) == "Batalha_Gramish") || (GetTag(oBoss) == "Batalha_Iris") || (GetTag(oBoss) == "Batalha_Boxer") || (GetTag(oBoss) == "Batalha_Tentaclus"))

        {

        DestroyObject(oBoss);

        }

    oBoss = GetNextObjectInArea(oArea);

    }


               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #5 on: August 01, 2014, 11:20:42 pm »


               


Also, I'm not sure if locals stay on PCs when they get to the OnClientLeave event.  You might want to test for that.




Yes, should be this. I cant find the locals of the player that logged out



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #6 on: August 01, 2014, 11:23:40 pm »


               

Would you be able to do this through the Area's OnExit event instead?  That is, when the last player exits the area, you would then destroy all the bosses.  Or do these bosses move from area to area?



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #7 on: August 01, 2014, 11:27:55 pm »


               


Would you be able to do this through the Area's OnExit event instead?  That is, when the last player exits the area, you would then destroy all the bosses.  Or do these bosses move from area to area?




 


may be an solution, i need test


               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #8 on: August 01, 2014, 11:29:35 pm »


               

The bosses can not leave their areas. I am using a trigger with OnExit event to destroy bosses, but this not occurs when player leave the game. I don't know if using the exit event area will occurs.



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #9 on: August 01, 2014, 11:35:31 pm »


               
//EDITED 1

The exiting area event works when player leave, I just need to test if this identifies the locals (testing...)

 

//EDITED 2

OnExiting area does not identifies locals for leaving players =/ 


               
               

               


                     Modifié par WhiteTiger, 02 août 2014 - 12:05 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #10 on: August 02, 2014, 12:38:58 am »


               


//EDITED


The exiting area event works when player leave, I just need to test if this identifies the locals (testing...)




 


Should work.


 


The order of entry is Client Enter -> Module Enter -> Area Enter


 


The order of exit is Area Exit -> Module Exit -> Client Leave


 


That is, when a player logs out, he first exits the area normally before anything regarding exiting the module takes place.


               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #11 on: August 02, 2014, 12:42:59 am »


               

Does not work =/


 


can't check LocalInt "fighting" 



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #12 on: August 02, 2014, 01:06:54 am »


               

Does our last resource is to use Area OnHeartbeat?


 


//edited


bad idea 



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #13 on: August 02, 2014, 01:15:44 am »


               

Local variables are still present on client exit. It's just that the PC is no longer a PC so all the GetIsPC() related things fail.   One of the workarounds for this is to save the CD key and player name and such on the PC as variables so they are available during client exit.  The static lexicon has a typo there when it says "you can get any information off..." It should say "can't".


               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
How to destroy an object type creature OnClientLeave?
« Reply #14 on: August 02, 2014, 01:19:51 am »


               


Local variables are still present on client exit.




 


Thanks for the verification.  I have just tested the area exit from my dedicated server which also works.  I just didn't know when the PC and items were stripped of their variables in a server setting (they are not stripped in SP module).


 


EDIT: Meaglyn,  I am getting a negative for Client Leave, and a positive for Area Exit.  It would appear the locals are stripped in between.