Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. [Support] How do I implement Overflow Fix in my code? ! Help

[Support] How do I implement Overflow Fix in my code? ! Help

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
2 Posts 2 Posters 518 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    wrote on last edited by Mr. Android
    #1

    I was reading that when text strings are handled, the Overflow of strings must be taken into account, and although I was reading this post in particular and it is the one that I understand the most:
    https://www.nextgenupdate.com/forums/black-ops-2-gsc-mods-scripts/915525-overflow-fix-cooljay-black-ops-iiutility.html

    I can't find where I should implement DestroyElement(); function inside my code, since obviously I didn't know about this problem and that's why I don't use the Destroy(); function

    healthPlayer ()
    {
    self endon ("disconnect");
    self.healthText = createFontString ("Objective", 1.7);
         self.healthText setPoint ("CENTER", "TOP", 300, "CENTER");
         while (true)
         {
             self.healthText setText ("^ 2HEALTH: ^ 7" + self.health);
             wait 0.25;
         }
    }
    
    TheHiddenHourundefined 1 Reply Last reply
    0
    • TheHiddenHourundefined Offline
      TheHiddenHourundefined Offline
      TheHiddenHour Contributor
      replied to Kalitos on last edited by TheHiddenHour
      #2

      Kalitos A bit off topic, but you should know that you can utilize a HUD element's label attribute in order to prevent unnecessary unique string usage. Here's an example of your code converted:

      healthPlayer ()
      {
      	self endon ("disconnect");
      
      	self.healthText = createFontString ("Objective", 1.7);
      	self.healthText setPoint ("CENTER", "TOP", 300, "CENTER");
      	self.healthText.label = &"^2 HEALTH: ^7";
      	
      	while (true)
      	{
      		self.healthText setValue(self.health);
      		wait 0.25;
      	}
      }
      

      As you can see, I assigned some text to your HUDs label attribute and replaced setText() with setValue(). This can be done because you only ever need to update the health value and not the text before it. Using this method, you're only using one unique string rather than a new one every time the player's health changes.

      1 Reply Last reply
      0

      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Donate