Results 1 to 8 of 8

Thread: Plus score

  1. #1
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts

    Plus score

    So I have tried to install "plusscore" from iznos cod4mod, but it gets some error when developer is set to 1,
    Code:
    ******* script runtime error *******
    pair 'undefined' and '2' has unmatching types 'undefined' and 'float': (file 'maps/mp/gametypes/_plusscore.gsc', line 7)
     while(self.scoresize<2.0 && isdefined(self.hud_plusscore))
                         *
    I did all stuff just like needed:
    Code:
    onPlayerConnect();
    
                    self.scoretoshow=0;
    Code:
    onPlayerSpawned();
                    
                    self.scoretoshow=0;
    
                    self.scoresize=0.5;
    
                    self.scorealpha=0.3;
    And called the hud:
    Code:
    precacheString(&"IZNO_PLUS");
    So whats wrong?

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Do you call the plusscore() thread on a player? Show how it's called.

  3. The Following User Says Thank You to IzNoGoD For This Useful Post:

    firefox (8th January 2013)

  4. #3
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    I am not entirely sure what you mean, but I tried adding something in the tdm.gsc, but still same

  5. The Following User Says Thank You to EvoloZz For This Useful Post:

    firefox (8th January 2013)

  6. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Show where you have self plusscore(10); or w/e.

  7. #5
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    I tried something like this
    Code:
    				attacker thread maps\mp\gametypes\_plusscore::plusscore();
    				attacker.plusscore+=10;
    				attacker.scoretoshow=10;

  8. The Following User Says Thank You to EvoloZz For This Useful Post:

    firefox (8th January 2013)

  9. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    ok, are the onplayerconnect() and onplayerspawned() threads called in the correct way? (called at all?)

  10. The Following User Says Thank You to IzNoGoD For This Useful Post:

    firefox (8th January 2013)

  11. #7
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Just updated code. Use this instead:

    http://codepad.org/isAcUNgK

    Only call the init() and the plusscore(score) at the appropriate times (plusscore on a player AND threaded)

    Remove all other (old plusscore-related) self.variables from your script

    Code:
    init()
    {
    	precachestring(&"");
    	precachestring(&"+");
    	game["precached_plusscore_strings"] = true;
    }
    
    plusscore(score)
    {
    	if(!isdefined(game["precached_plusscore_strings"]))
    	{
    		iprintln("Plusscore strings not precached. Call init() on startgametype...");
    		return;
    	}
    	if(!isplayer(self))
    	{
    		iprintln("Plusscore not called on a player. Go fix this before you try anything else!");
    		return;
    	}
    	if(!isdefined(self.izno_plusscore)) //first run
    	{
    		self.izno_plusscore = newclienthudelem(self);
    		self.izno_plusscore.instance = 0;
    		self.izno_plusscore.score = score;
    		self.izno_plusscore.horzAlign = "center";
    		self.izno_plusscore.vertAlign = "middle";
    		self.izno_plusscore.alignX = "center";
    		self.izno_plusscore.alignY = "middle";
    		self.izno_plusscore.x = 0; //middle of screen
    		self.izno_plusscore.y = -40; //just above middle of screen
    		self.izno_plusscore.alpha = 0.3;
    		self.izno_plusscore.fontscale = 0.5;
    	}
    	else //not first-run
    	{
    		if(self.izno_plusscore.alpha < 0.3 || self.izno_plusscore.score == 0)
    			self.izno_plusscore.alpha = 0.3;
    		if(self.izno_plusscore.fontscale < 0.5 || self.izno_plusscore.score == 0)
    			self.izno_plusscore.fontscale = 0.5;
    		self.izno_plusscore.instance++;
    		self.izno_plusscore.score += score;
    	}
    	if(self.izno_plusscore.score < 0)
    	{
    		self.izno_plusscore.color = (235/255,10/255,10/255); //negative scores are red
    		self.izno_plusscore.label = &"";
    	}
    	else
    	{
    		self.izno_plusscore.color = (1,230/255,125/255); //yellow-ish
    		self.izno_plusscore.label = &"+";
    	}
    	self.izno_plusscore setvalue(self.izno_plusscore.score);	
    
    	current_instance = self.izno_plusscore.instance;
    	make_bigger = true;
    	more_opaque = true;
    	steady_opaque_timer = 0;
    	alpha_done = false;
    	size_done = false;
    	while(isdefined(self) && current_instance == self.izno_plusscore.instance && !(alpha_done && size_done))
    	{
    		if(make_bigger && self.izno_plusscore.fontscale < 2)
    			self.izno_plusscore.fontscale += 0.35;
    		else if(make_bigger)
    			make_bigger = false;
    		else if(self.izno_plusscore.fontscale > 2)
    			self.izno_plusscore.fontscale -= 0.2;
    		else
    		{
    			size_done = true;
    			self.izno_plusscore.fontscale = 1.5;
    		}
    
    		if(more_opaque && self.izno_plusscore.alpha <= 0.9) //dont overflow this
    			self.izno_plusscore.alpha += 0.1;
    		else if(more_opaque && steady_opaque_timer == 20)
    			more_opaque = false;
    		else if(more_opaque)
    			steady_opaque_timer++;
    		else if(self.izno_plusscore.alpha >= 0.1) //dont underflow this
    			self.izno_plusscore.alpha -= 0.1;
    		else
    		{
    			alpha_done = true;
    			self.izno_plusscore.alpha = 0;
    		}
    		wait 0.05;
    	}
    	if(!isdefined(self))
    		return;
    	if(current_instance == self.izno_plusscore.instance)
    	{
    		wait 0.5;
    		if(isdefined(self) && self.izno_plusscore.instance == current_instance)
    			self.izno_plusscore.score = 0;
    	}
    }
    Last edited by IzNoGoD; 27th December 2012 at 23:56.

  12. The Following 4 Users Say Thank You to IzNoGoD For This Useful Post:

    EnergY (16th June 2013),EvoloZz (28th December 2012),firefox (8th January 2013),kung foo man (28th December 2012)

  13. #8
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    It works now, thanks for helping me out!

  14. The Following User Says Thank You to EvoloZz For This Useful Post:

    firefox (8th January 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •