Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Giant & Shrink mod

  1. #11

    Default

    For this example the command is just 'shrink' and then the player number. E.g. shrink 0 or shrink 1 etc...

  2. #12

    Default

    thankx
    Last edited by Old Fox; March 25th, 2019 at 10:56 PM.

  3. #13

    Default

    Quote Originally Posted by 1337Smithy View Post
    Thanks, DK. Maybe if you want to incorporate a timer (also you had entnumb instead of entnum):

    Code:
    check_shrink:
    
    	while (1)
    	{
    		local.shrink_player = getcvar "shrink"
    
    		if (local.shrink_player != "")
    		{	
    			for (local.i = 1;local.i <= $player.size;local.i++)
    			{
    				local.player = $player[local.i]
    				
    				if ((local.player == NULL) || (local.player.shrink == 1))
    					continue
    				
    				if (local.player.entnum == int(local.shrink_player))
    					thread shrink_player local.player
    			}
    			setcvar "shrink" ""
    		}
    
    		waitframe
    	}
    end
    
    shrink_player local.player:
    	
    	local.player.shrink = 1
    	local.player scale 0.5
    
    	thread check_alive local.player
            thread shrink_duration local.player 60 // these could be merged
    end
    
    
    check_alive local.player:
    	
    	while ((isAlive local.player) && (local.player.shrink == 1))
    		wait .5
    
    	if ((local.player) && (local.player.shrink == 1))
    		local.player.shrink = 0
    		
    end
    
    shrink_duration local.player local.time:
    
    	while ((local.player.shrink == 1) && (local.time > 0) && (local.player))
    	{
    		wait 1
    		local.time--
    	}
    			
    	if ((local.player.shrink == 1) && (local.player))
    	{
    		local.player.shrink = 0
    		local.player.scale = 1
    	}
    end
    I did it quickly so might be naff... I'm tired this morning lol.
    thankx
    Last edited by Old Fox; March 25th, 2019 at 10:56 PM.

  4. #14

    Default

    I noticed an error in the code. It should be:

    Code:
    shrink_duration local.player local.time:
    
    	while ((local.player.shrink == 1) && (local.time > 0) && (local.player))
    	{
    		wait 1
    		local.time--
    	}
    			
    	if ((local.player.shrink == 1) && (local.player))
    	{
    		local.player.shrink = 0
    		local.player scale 1 // removed the '=' sign
    	}
    end

    If you want to change the time, find in the code where I've put the number of seconds in a minute to wait. Change that to however many seconds you want.

    If they aren't resetting on death add:

    Code:
    check_alive local.player:
    	
    	while ((isAlive local.player) && (local.player.shrink == 1))
    		wait .5
    
    	if ((local.player) && (local.player.shrink == 1))
            {
    		local.player.shrink = 0
    		local.player scale 1
    	}		
    end
    If you're finding it difficult searching the code for values, you can also add global variables at the top of your script e.g.:

    Code:
    level.shrinkDuration = 60
    level.shrinkScale = 0.5
    level.resetScale = 1
    And have:

    Code:
    shrink_player local.player:
    	
    	local.player.shrink = 1
    	local.player scale level.shrinkScale
    
    	thread check_alive local.player
            thread shrink_duration local.player level.shrinkDuration // these could be merged
    end
    
    
    check_alive local.player:
    	
    	while ((isAlive local.player) && (local.player.shrink == 1))
    		wait .5
    
    	if ((local.player) && (local.player.shrink == 1))
            {
    		local.player.shrink = 0
                    local.player scale level.resetScale
    	}	
    end
    
    shrink_duration local.player local.time:
    
    	while ((local.player.shrink == 1) && (local.time > 0) && (local.player))
    	{
    		wait 1
    		local.time--
    	}
    			
    	if ((local.player.shrink == 1) && (local.player))
    	{
    		local.player.shrink = 0
    		local.player scale level.resetScale
    	}
    end
    Then you just need to tweak values at the top of your script how you like.
    Last edited by 1337Smithy; May 24th, 2018 at 02:03 PM.

  5. #15

    Default

    thankx and good luck
    Last edited by Old Fox; March 25th, 2019 at 10:57 PM.

  6. #16

    Default

    Code:
    check_shake:
    
    	while(1)
    	{
    		local.shake = getcvar "shake"
    		if (local.shake)
    		{	
    			if (local.shake == small)
    				waitthread shake_small
    			else if (local.shake == medium)
    				waitthread shake_medium
    			else if (local.shake == large)
    				waitthread shake_large	
    				
    			setcvar "shake" ""
    		}				
    		waitframe
    	}
    end
    
    shake_small:
    	waitexec global/earthquake.scr .3 1 0 0
    	waitexec global/earthquake.scr .3 .75 0 0
    	waitexec global/earthquake.scr 1.25 .3 0 0
    end
    
    shake_medium:
    	waitexec global/earthquake.scr .23 2 0 0
    	waitexec global/earthquake.scr 1 1 0 0
    	waitexec global/earthquake.scr 1.25 .3 0 1
    end
    
    shake_large:
    	waitexec global/earthquake.scr .25 3 0 0
    	waitexec global/earthquake.scr .4 1.25 0 0
    	waitexec global/earthquake.scr 1 .75 0 0
    	waitexec global/earthquake.scr 1.25 .3 0 1
    end
    I'm sure you can figure out the commands by looking at this.
    Last edited by 1337Smithy; May 25th, 2018 at 04:40 AM.

  7. #17

    Default

    thanks for ur help smithy
    Last edited by Old Fox; March 25th, 2019 at 10:57 PM.

Posting Permissions

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