Results 1 to 10 of 14

Thread: Trigger Bug

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    you should try this instead of renaming every trigger and its pair on your own:

    >new map
    >create a trigger_damage > targetname = "trigger_glass"
    >create your unbroken window > make it a scrpt_brushmodel
    >create your broken window > make it a scrpt_brushmodel
    >firstly select your trigger > secondly select your unbroken window > hit [W] to connect them (line poining from the trigger to the window should appear)
    >unselect all [i]
    >firstly select your unbroken > secondly select your broken window > hit [W] to connect them (again a line poining from the unbroken window to the broken one should be visible)
    >save it as a prefab

    now you can add this prefab whereever you want and how often you want in your map script (without renaming):

    Code:
    init()
    {
    	glassTriggers = getEntArray( "trigger_glass" , "targetname" );
    
    	if( isDefined( glassTriggers ) && glassTriggers.size )
    	{
    		for( i = 0 ; i < glassTriggers.size ; i++ )
    		{
    			if( isDefined( glassTriggers[i] ) )
    				glassTriggers[i] thread monitorGlassTrigger();
    			else
    				iPrintLn( "undefined glassTrigger found for some reason!" );
    		}
    	}
    	else
    	{
    		iPrintLn( "NO glassTriggers FOUND IN MAP!" );
    	}
    }
    
    monitorGlassTrigger()
    {
    	window = undefined;
    
    	if( isDefined( self.target ) )
    	{
    		window = getEnt( self.target , "targetname" );
    	}
    
    	if( !isDefined( window ) )
    	{
    		iPrintLn( "GlassTrigger at " + self.origin + " has no window as target!" );
    
    		return;
    	}
    
    	broken = undefined;
    
    	if( isDefined( window.target ) )
    	{
    		broken = getEnt( window.target , "targetname" );
    	}
    	
    	if( !isDefined( window ) )
    	{
    		iPrintLn( "window at " + window.origin + " has no broken window as target!" );
    	}
    
    	window show();
    	broken hide();
    
    	trigger waittill( "trigger" );
    
    	trigger delete();
    	window delete();
    	broken show();
    }
    i think izno may help you with the scripting abit more^^

    anyway, your better with using prefabs instead of naming every trigger / window pair by hand..

  2. The Following User Says Thank You to serthy For This Useful Post:

    kung foo man (8th February 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
  •