• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Object disappear problem
#1
I have a weird problem. Objects created by functions or commands,?not in?global?OnGameModeInit(), disappear after some period of time.?
I've tried to use default CreateObject, but it hasn't worked.
  Reply
#2
Seems like you're messing up with some IDs. Maybe somewhere in your script you're using functions for deleting specific objects for any reason, isnt it? Do you currently check and reset the variables linked to those objects everytime you delete them?

I mean, do you do something like this?
Code:
if(object_id != -1) DestroyDynamicObject(object_id), object_id?= -1;


If not and if youre using functions such as?DestroyDynamicObject or DestroyObject, its most likely that?your problem is due to this bad handling. Everytime youre deleting something, you must first check the variable and then reset it after you have successfully deleted the item.
  Reply
#3
(2020-04-04, 09:26 PM)Ezio_Auditore Wrote: Seems like you're messing up with some IDs. Maybe somewhere in your script you're using functions for deleting specific objects for any reason, isnt it? Do you currently check and reset the variables linked to those objects everytime you delete them?



I mean, do you do something like this?

Code:
if(object_id != -1) DestroyDynamicObject(object_id), object_id?= -1;





If not and if youre using functions such as?DestroyDynamicObject or CreateObject, its most likely that?your problem is due to this bad handling. Everytime youre deleting something, you must first check the variable and then reset it after you have successfully deleted the item.



I will try that and let you know if that helped.
  Reply
#4
(2020-04-04, 09:26 PM)Ezio_Auditore Wrote: Seems like you're messing up with some IDs. Maybe somewhere in your script you're using functions for deleting specific objects for any reason, isnt it? Do you currently check and reset the variables linked to those objects everytime you delete them?



I mean, do you do something like this?

Code:
if(object_id != -1) DestroyDynamicObject(object_id), object_id?= -1;





If not and if youre using functions such as?DestroyDynamicObject or DestroyObject, its most likely that?your problem is due to this bad handling. Everytime youre deleting something, you must first check the variable and then reset it after you have successfully deleted the item.



Thank you so much. Now everything works !!
  Reply
#5
(2020-04-07, 11:38 AM)ChampDotChamp Wrote:
(2020-04-04, 09:26 PM)Ezio_Auditore Wrote: Seems like you're messing up with some IDs. Maybe somewhere in your script you're using functions for deleting specific objects for any reason, isnt it? Do you currently check and reset the variables linked to those objects everytime you delete them?



I mean, do you do something like this?

Code:
if(object_id != -1) DestroyDynamicObject(object_id), object_id?= -1;





If not and if youre using functions such as?DestroyDynamicObject or DestroyObject, its most likely that?your problem is due to this bad handling. Everytime youre deleting something, you must first check the variable and then reset it after you have successfully deleted the item.



Thank you so much. Now everything works !!



:)
  Reply
#6
I would suggest for the sake of standard compliance that you use INVALID_OBJECT_ID instead of -1 for this. As far as functionality goes the solution works either way, of course.
  Reply


Forum Jump: