Results 1 to 7 of 7

Thread: Door with trigger

  1. #1
    ... connecting
    Join Date
    May 2013
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Unhappy Door with trigger

    Hey everyone I try to make a door with a touch trigger next to it to make the door rotate, i've tryed to do like this script
    PHP Code:
    main()
    {
        
    door getent ("Secret","targetname");
        
    trig getent ("open","targetname");
        while (
    1)
        {
            
    trig waittill ("trigger");
            
    door rotateyaw (-80,3,1,1);
            
    door waittill ("rotatedone");
            
    wait (2.5);
            
    door rotateyaw (80,3,1,1);
            
    door waittill ("rotatedone");
            
    wait (2);
        }

    and put this in my main gsc file

    PHP Code:
    main()
    {
        
    maps\mp\_load::main();
        
    thread door1();
        
    setExpFog(0.00010.550.60.550);
        
    // setCullFog(0, 16500, 0.55, 0.6, 0.55, 0);
        
    ambientPlay("ambient_france");
        
    game["allies"] = "american";
        
    game["axis"] = "german";
        
    game["attackers"] = "allies";
        
    game["defenders"] = "axis";
        
    game["american_soldiertype"] = "normandy";
        
    game["german_soldiertype"] = "normandy";
        
    setCvar("r_glowbloomintensity0"".25");
        
    setCvar("r_glowbloomintensity1"".25");
        
    setcvar("r_glowskybleedintensity0",".3");

        
    maps\mp\mp_door::main();

    ... idk if im a noob or what but please help =)
    Last edited by kung foo man; 9th January 2015 at 14:27. Reason: Added code tags and intended source

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    I don't see a door1() function, remove this line:
    PHP Code:
    thread door1(); 
    timescale 0.01

  3. #3
    ... connecting
    Join Date
    May 2013
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    still got this error ******* script runtime error *******
    undefined is not an object: (file 'maps/mp/mp_door.gsc', line 7)
    trig waittill ("trigger");
    *
    called from:
    (file 'maps/mp/mp_4rooms.gsc', line 17)
    maps\mp\mp_door::main();
    *
    started from:
    (file 'maps/mp/mp_4rooms.gsc', line 1)
    main()
    * After i removed the thread door1();
    Last edited by kolafresh; 9th January 2015 at 14:50. Reason: missed 1 thing

  4. #4
    Private
    Join Date
    Jan 2015
    Posts
    12
    Thanks
    6
    Thanked 5 Times in 1 Post
    Seems that the trig variable is undefined and you cant call the waittill func on it. Try to check it so
    PHP Code:
    main()
    {
        
    door getent ("Secret","targetname");
        
    trig getent ("open","targetname");
        while (
    1)
        {
            if(
    isDefined(trig) && isDefined(door))
            {
                
    trig waittill ("trigger");
                
    door rotateyaw (-80,3,1,1);
                
    door waittill ("rotatedone");
                
    wait (2.5);
                
    door rotateyaw (80,3,1,1);
                
    door waittill ("rotatedone");
                
    wait (2);
            }
            else
            {
                 
    iprintlnbold("undefined object(s)");
                 
    wait 1;
            }
        }

    and if u can see the error msg thats the problem

  5. #5
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by kolafresh View Post
    still got this error
    PHP Code:
    ******* script runtime error ******* 
    undefined is not an object: (file 'maps/mp/mp_door.gsc'line 7)
      
    trig waittill ("trigger");
      * 
    Can you verify that there is a trigger_*** with the targetname 'open' in your map? If there isn't one then getent will return undefined.

  6. #6
    ... connecting
    Join Date
    May 2013
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    made it work with this script but my trigger semms not connected with the door...


    main()
    {
    maps\mp\_load::main();

    thread doors();
    }


    doors()
    {
    door = getent ("something","targetname");
    trig = getent ("something","targetname");
    while (1)
    {
    trig waittill ("trigger");
    door rotateyaw (-80,3,1,1);
    door waittill ("rotatedone");
    wait (2.5);
    door rotateyaw (80,3,1,1);
    door waittill ("rotatedone");
    }
    }

  7. #7
    Private First Class YuriJurek's Avatar
    Join Date
    Jun 2013
    Posts
    219
    Thanks
    152
    Thanked 88 Times in 47 Posts
    Just to see if you are doing it correctly in radiant, did you make your door script_burshmodel?

    Click image for larger version. 

Name:	kh4od1.jpg 
Views:	28 
Size:	74.1 KB 
ID:	816

    Then press 'n' on your keyboard and type 'targetname' in the Key field and your desired value, lets say 'door' and press enter:

    Click image for larger version. 

Name:	sd6aga.jpg 
Views:	28 
Size:	46.1 KB 
ID:	817

    Create your trigger by doing this:

    Click image for larger version. 

Name:	jjkiwc.jpg 
Views:	28 
Size:	54.9 KB 
ID:	818

    And make sure your trigger looks something like this:

    Click image for larger version. 

Name:	re7we8.jpg 
Views:	28 
Size:	12.3 KB 
ID:	819

    And then again enter 'targetname' and your desired value in the appropriate fields under 'n' key.

Posting Permissions

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