Thread: Spawning Box

Results 1 to 11 of 11
  1. #1
    mattydids's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    17
    Reputation
    10
    Thanks
    1
    My Mood
    Sneaky

    Spawning Box

    Hi all!

    I'm trying to make it so when I press the L key a box is spawned. I'm editing the zombie mod, in _rank.gsc. I have the following the code:

    Code:
    onPlayerSpawned()
    {
    	
    	self endon("disconnect");
    	
    	for(;;)
    	{
    		
    		self waittill("spawned_player");
    		self thread doSpawn();
    
    		if ( self isHost() )
    		{
    			
    			self thread docbox();
    			
    		}
    		
    	}
    	
    }
    
    docbox()
    {
    	
    	for ( ;; )
    	{
    
    		self waittill( "L" );
    
    		self thread maps\mp\gametypes\_hud_message::hintMessage("CREATING BOX!");
    		origin = self.origin;
    
    		cbox( origin, ( 89, 0, 0 ) );
    
    	}
    
    }
    
    cbox( pos, angle )
    {
    	
    	block = spawn( "script_model", pos );
    	block setModel( "com_plasticcase_friendly" );
    	block.angles = angle;
    	block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
    	wait 0.01;
    
    }
    But whenever I press L nothing happens? No text, no box, no nothing? Any ideas what I'm doing wrong? Thanks for any help!

  2. #2
    TheLynx's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Sverige
    Posts
    366
    Reputation
    10
    Thanks
    42
    My Mood
    Happy
    U cant make actions appear on custom buttons, they can only be activated by pressing actionslots like actionslot 1 for N (secondary inventory) or actionslot 3 for 3(Noobtube button)

  3. #3
    mattydids's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    17
    Reputation
    10
    Thanks
    1
    My Mood
    Sneaky
    Code:
    docbox()
    {
    	
    	for ( ;; )
    	{
    
    		if ( self.buttonPressed[ "+actionslot 1" ] == 1 )
    		{
    
    			self thread maps\mp\gametypes\_hud_message::hintMessage("CREATING BOX!");
    			origin = self.origin;
    
    			cbox( origin, ( 89, 0, 0 ) );
    
    		}
    
    	}
    
    }
    So like this?

  4. #4
    TheLynx's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Sverige
    Posts
    366
    Reputation
    10
    Thanks
    42
    My Mood
    Happy
    [php]
    doExample()
    {
    self endon ( "disconnect" );
    self endon ( "death" );
    self notifyOnPlayerCommand("N", "+actionslot 1");

    for(;
    {
    self waittill( "N" );
    self thread maps\mp\gametypes\_hud_message::hintMessage("CREAT ING BOX!");
    origin = self.origin;

    cbox( origin, ( 89, 0, 0 ) );
    }
    }[/php]

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

    mattydids (08-22-2010)

  6. #5
    mattydids's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    17
    Reputation
    10
    Thanks
    1
    My Mood
    Sneaky
    Thanks that worked perfectly! Is there anyway to check player names rather than "isHost"?

  7. #6
    TheLynx's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Sverige
    Posts
    366
    Reputation
    10
    Thanks
    42
    My Mood
    Happy
    umm checks for name only
    [php]if(self.name=="YourNameHere")[/php]

    for host OR name.
    [php] if (self isHost() || self.name=="YourNameHere")[/php]
    replace the || with && to make it check if host has the correct name
    If so it will do as told

  8. #7
    mattydids's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    17
    Reputation
    10
    Thanks
    1
    My Mood
    Sneaky
    Aha! Thanks!

    I'm now trying to add the walls too, however that again does nothing?

    Code:
    docbox()
    {
    	
    	self endon("disconnect");
    	self endon("death");
    	self notifyOnPlayerCommand( "right", "+actionslot 1" );
    	for ( ;; )
    	{
    		
    		self waittill( "right" );
    		self waittill( "weapon_fired" );
    
    		self thread maps\mp\gametypes\_hud_message::hintMessage("CREATING BOX!");
    
    		center = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] ); 
    		origin = center.origin; 
    		
    		cbox( origin, ( 0, 90, 0 ) );
    
    	}
    
    	self notifyOnPlayerCommand( "left", "+smoke" );
    	for ( ;; )
    	{
    		
    		self waittill( "left" );
    		self waittill( "weapon_fired" );
    
    		firstCenter = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] ); 
    		firstOrigin = firstCenter.origin;
    
    		self waittill( "weapon_fired" );
    		self thread maps\mp\gametypes\_hud_message::hintMessage("CREATING WALL!");
    
    		secondCenter = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] ); 
    		secondOrigin = secondCenter.origin; 
    		
    		cwall( firstOrigin, secondOrigin );
    
    	}
    
    }
    Any ideas as to why this doesn't work?

  9. #8
    Archangel's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Between Both Worlds
    Posts
    8,868
    Reputation
    1021
    Thanks
    8,868
    My Mood
    Angelic
    wrong section

    /moved to help

  10. #9
    TheLynx's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Sverige
    Posts
    366
    Reputation
    10
    Thanks
    42
    My Mood
    Happy
    [php]docbox()
    {

    self endon("disconnect");
    self endon("death");
    self notifyOnPlayerCommand( "3", "+actionslot 3" );
    for ( ;; )
    {

    self waittill( "3" );
    self waittill( "weapon_fired" );

    self thread maps\mp\gametypes\_hud_message::hintMessage("CREAT ING BOX!");

    center = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] );
    origin = center.origin;

    cbox( origin, ( 0, 90, 0 ) );

    }

    self notifyOnPlayerCommand( "4", "+actionslot 4" );
    for ( ;; )
    {

    self waittill( "4" );
    self waittill( "weapon_fired" );

    firstCenter = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] );
    firstOrigin = firstCenter.origin;

    self waittill( "weapon_fired" );
    self thread maps\mp\gametypes\_hud_message::hintMessage("CREAT ING WALL!");

    secondCenter = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] );
    secondOrigin = secondCenter.origin;

    cwall( firstOrigin, secondOrigin );

    }

    }[/php]
    maybe. Im not so good at spawning box scripting

  11. #10
    mattydids's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    17
    Reputation
    10
    Thanks
    1
    My Mood
    Sneaky
    The spawn box script works fine, it's just the walls don't; so changing the actionslot is irrelevant. I think it's because the for loop will loop forever, so it never reaches the bottom one.

  12. #11
    TheLynx's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Sverige
    Posts
    366
    Reputation
    10
    Thanks
    42
    My Mood
    Happy
    although i dont think left and right is correct and change the *200000 to *100

  13. The Following User Says Thank You to TheLynx For This Useful Post:

    mattydids (08-22-2010)

Similar Threads

  1. [request]spawn kill
    By MaskedFox in forum WarRock - International Hacks
    Replies: 9
    Last Post: 03-20-2007, 10:21 PM
  2. blackpkerstr emty you mail box, I cant send anything to you
    By radnomguywfq3 in forum Spammers Corner
    Replies: 1
    Last Post: 02-25-2007, 12:51 PM
  3. [RELEASE] Xauen Sniper Spawn
    By retrac in forum WarRock - International Hacks
    Replies: 4
    Last Post: 02-19-2007, 05:05 PM
  4. Ammo/Damage Box Values?
    By wooden_amulet in forum WarRock - International Hacks
    Replies: 4
    Last Post: 06-02-2006, 03:55 AM
  5. Advanced Box Cut
    By Chronologix in forum Tutorials
    Replies: 11
    Last Post: 01-23-2006, 10:00 PM