Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Maximum Parent Script Variables
#11
(11-18-2012, 22:02)DidUknowiPwn Wrote: Okay whatever my only conclusion it's the Custom HUD we have. Anyone mind checking this?
Code:
weaponHudInit()
{
    level.weaponicon = [];
    // precache
    precacheShader("hud_us_grenade");
    precacheShader("hud_us_semtex");
    precacheShader("hud_icon_claymore");
    precacheShader("hud_icon_c4");
    precacheShader("weapon_attachment_tactical");
    // equipment
    level.weaponicon["frag"] = "hud_us_grenade";
    level.weaponicon["semtex"] = "hud_us_semtex";
    level.weaponicon["claymore"] = "hud_icon_claymore";
    level.weaponicon["c4"] = "hud_icon_c4";
    level.weaponicon["throwingknife"] = "weapon_attachment_tactical";
}

getWeaponIcon(name)
{
    base = strtok(name , "_")[0];
    ret = level.weaponicon[base];
    if(!isDefined(ret))
        return "None";
    return ret;
}

AmmoHud()
{
    self endon("disconnect");
    self endon("death");
    if(!isDefined(self.ammoBoard))
    {
        self.ammoBoard = self createFontString( "default", 1.7 );
        self.ammoBoard setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -55, -40);
        self.ammoBoard.HideWhenInMenu = true;
    }
    if(!isDefined(self.stockBoard))
    {
        self.stockBoard = self createFontString( "default", 2 );
        self.stockBoard setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -18, -40);
        self.stockBoard.HideWhenInMenu = true;
    }
    if(!isDefined(self.slash))
    {
        self.slash = self createFontString( "default", 1.9 );
        self.slash setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -45, -40);
        self.slash.HideWhenInMenu = true;
    }
    
    if(!isDefined(self.nadeseperator))
    {
        self.nadeseperator = self createFontString( "default", 1.9 );
        self.nadeseperator setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -43, -60);
        self.nadeseperator.HideWhenInMenu = true;
        self.nadeseperator.sort = -9999999;
    }
    if(!isDefined(self.equipmentcount))
    {
        self.equipmentcount = self createFontString( "default" , 1.9);
        self.equipmentcount setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -30, -60);
        self.equipmentcount.HideWhenInMenu = true;
        self.equipmentcount.sort = -9999999;
    }
    
    // do every time you spawn to make sure it resets
    self.nadeicon destroy();
    self.grenade = level.nadetypes[self.nadetype];
    self.nadeicon = self createIcon(getWeaponIcon(self.grenade), 16, 16);
    self.nadeicon setPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -55, -60);
    self.nadeicon.alpha = 1;
    self.nadeicon.sort = -9999999;
    self.nadeicon.HideWhenInMenu = true;
    lastequipment = self.grenade;
    
    while(1)
    {
        self.grenade = level.nadetypes[self.nadetype];
        if(self.team == "axis")
        {
            self.grenade = "throwingknife_mp";
            self.nades = 0;
        }
        self.Clip = self getWeaponAmmoClip(self getCurrentWeapon());
        self.Stock = self getWeaponAmmoStock(self getCurrentWeapon());
        if(self.Stock >= 100)
        {
            self.stockBoard.fontscale = 1.7;
        }
        else
        {
            self.stockBoard.fontscale = 2;
        }
        self.ammoBoard setValue(self.Clip);
        self.stockBoard setValue(self.Stock);
        //self.slash setText("/");
        self.nadeseperator setText("x\n/");
        
        nadeclip = self getWeaponAmmoClip(self.grenade);
        if(!isDefined(self.nades))
            self.equipmentcount setValue(0);
        else if (!isDefined(nadeclip))
            self.equipmentcount setValue(self.nades);
        else
            self.equipmentcount setValue(self.nades + nadeclip);
        
        if(lastequipment != self.grenade)
        {
            self.nadeicon destroy();
            self.nadeicon = self createIcon(getWeaponIcon(self.grenade), 16, 16);
            self.nadeicon setPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -55, -60);
            self.nadeicon.alpha = 1;
            self.nadeicon.sort = -9999999;
            self.nadeicon.HideWhenInMenu = true;
        }
        
        wait 0.1;
    }
}
Or http://pastebin.com/shgVQLbm

Dude, do you know what does Parent Script Variables even mean?
I don't Troll

@EDIT: Ok now I know what does this means,
It means that you too have many parent variables(level.thing, or self.thing) for the game to handle, try to reduce those kind of variables and you may replace them with child script variable:

Code:
MAMA = mother.thing
PAPA = father.thing

//MAMA and PAPA are child script variables now


And AFAIK, parent variables are variables that you can use in the whole mod, child variables are the one that is only used in the same function, or else there will be unidentified variable error
Reply

#12
(11-20-2012, 16:31)Ra3shed Wrote:
(11-18-2012, 22:02)DidUknowiPwn Wrote: Okay whatever my only conclusion it's the Custom HUD we have. Anyone mind checking this?
Code:
weaponHudInit()
{
    level.weaponicon = [];
    // precache
    precacheShader("hud_us_grenade");
    precacheShader("hud_us_semtex");
    precacheShader("hud_icon_claymore");
    precacheShader("hud_icon_c4");
    precacheShader("weapon_attachment_tactical");
    // equipment
    level.weaponicon["frag"] = "hud_us_grenade";
    level.weaponicon["semtex"] = "hud_us_semtex";
    level.weaponicon["claymore"] = "hud_icon_claymore";
    level.weaponicon["c4"] = "hud_icon_c4";
    level.weaponicon["throwingknife"] = "weapon_attachment_tactical";
}

getWeaponIcon(name)
{
    base = strtok(name , "_")[0];
    ret = level.weaponicon[base];
    if(!isDefined(ret))
        return "None";
    return ret;
}

AmmoHud()
{
    self endon("disconnect");
    self endon("death");
    if(!isDefined(self.ammoBoard))
    {
        self.ammoBoard = self createFontString( "default", 1.7 );
        self.ammoBoard setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -55, -40);
        self.ammoBoard.HideWhenInMenu = true;
    }
    if(!isDefined(self.stockBoard))
    {
        self.stockBoard = self createFontString( "default", 2 );
        self.stockBoard setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -18, -40);
        self.stockBoard.HideWhenInMenu = true;
    }
    if(!isDefined(self.slash))
    {
        self.slash = self createFontString( "default", 1.9 );
        self.slash setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -45, -40);
        self.slash.HideWhenInMenu = true;
    }
    
    if(!isDefined(self.nadeseperator))
    {
        self.nadeseperator = self createFontString( "default", 1.9 );
        self.nadeseperator setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -43, -60);
        self.nadeseperator.HideWhenInMenu = true;
        self.nadeseperator.sort = -9999999;
    }
    if(!isDefined(self.equipmentcount))
    {
        self.equipmentcount = self createFontString( "default" , 1.9);
        self.equipmentcount setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -30, -60);
        self.equipmentcount.HideWhenInMenu = true;
        self.equipmentcount.sort = -9999999;
    }
    
    // do every time you spawn to make sure it resets
    self.nadeicon destroy();
    self.grenade = level.nadetypes[self.nadetype];
    self.nadeicon = self createIcon(getWeaponIcon(self.grenade), 16, 16);
    self.nadeicon setPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -55, -60);
    self.nadeicon.alpha = 1;
    self.nadeicon.sort = -9999999;
    self.nadeicon.HideWhenInMenu = true;
    lastequipment = self.grenade;
    
    while(1)
    {
        self.grenade = level.nadetypes[self.nadetype];
        if(self.team == "axis")
        {
            self.grenade = "throwingknife_mp";
            self.nades = 0;
        }
        self.Clip = self getWeaponAmmoClip(self getCurrentWeapon());
        self.Stock = self getWeaponAmmoStock(self getCurrentWeapon());
        if(self.Stock >= 100)
        {
            self.stockBoard.fontscale = 1.7;
        }
        else
        {
            self.stockBoard.fontscale = 2;
        }
        self.ammoBoard setValue(self.Clip);
        self.stockBoard setValue(self.Stock);
        //self.slash setText("/");
        self.nadeseperator setText("x\n/");
        
        nadeclip = self getWeaponAmmoClip(self.grenade);
        if(!isDefined(self.nades))
            self.equipmentcount setValue(0);
        else if (!isDefined(nadeclip))
            self.equipmentcount setValue(self.nades);
        else
            self.equipmentcount setValue(self.nades + nadeclip);
        
        if(lastequipment != self.grenade)
        {
            self.nadeicon destroy();
            self.nadeicon = self createIcon(getWeaponIcon(self.grenade), 16, 16);
            self.nadeicon setPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -55, -60);
            self.nadeicon.alpha = 1;
            self.nadeicon.sort = -9999999;
            self.nadeicon.HideWhenInMenu = true;
        }
        
        wait 0.1;
    }
}
Or http://pastebin.com/shgVQLbm

Dude, do you know what does Parent Script Variables even mean?
I don't Troll

@EDIT: Ok now I know what does this means,
It means that you too have many parent variables(level.thing, or self.thing) for the game to handle, try to reduce those kind of variables and you may replace them with child script variable:

Code:
MAMA = mother.thing
PAPA = father.thing

//MAMA and PAPA are child script variables now


And AFAIK, parent variables are variables that you can use in the whole mod, child variables are the one that is only used in the same function, or else there will be unidentified variable error
Well shiieeet okay thanks I'll check on those...
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Who can create this script First_Semyon 3 4,258 09-24-2013, 18:19
Last Post: First_Semyon
  [Release] Advanced timed messages with script support DePa95 0 4,071 08-07-2013, 19:35
Last Post: DePa95
  Help Run Infinity Script on Teknogods? Bandarigoda123 6 7,506 07-14-2013, 17:27
Last Post: surtek
  can't find script engine "VBScript" for script "C:\Windows\system32\slmgr.vbs" ddaavvee 6 24,644 06-18-2013, 03:46
Last Post: dylankrajewski
  Simple flyable helicopter script port, could use help! akillj 0 2,537 06-15-2013, 09:20
Last Post: akillj
  What script controls the "random" aspect to care packages? akillj 2 3,267 06-05-2013, 11:24
Last Post: akillj
  [Tutorial] How to use variables as long as server runs Justin 4 4,214 05-04-2013, 20:54
Last Post: Nekochan
  Help Server Script Compile Error when loading ExtremeBunkerMaker lolmoon 3 3,929 04-09-2013, 03:11
Last Post: lolmoon
  [News] BO2 uses havok script kokole 19 11,389 02-05-2013, 10:04
Last Post: Pozzuh
Information [Tutorial] [CHAPTER 2]C++ Crash Course - Variables Ich1994 0 1,945 02-04-2013, 18:47
Last Post: Ich1994

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.