Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: 3 Triggers -> One Output (Brushmodel)

  1. #1
    Private ElEmEnT's Avatar
    Join Date
    Aug 2013
    Posts
    22
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Question 3 Triggers -> One Output (Brushmodel)

    Hey KillTube-Community,

    I try to make a Brushmodel with 3 Triggers,
    but i dont have the experience to script it.
    I use this script :
    Code:
    elevator()
    
    {
    elevator = getent("elevator","targetname");
    trig = getent("elevator_trigger","targetname");
    while(1)
    {
    trig waittill ("trigger");
    elevator movez (5,7,3,3);
    elevator waittill ("movedone");
    wait(3);
    elevator movez (-5,7,3,3);
    elevator waittill ("movedone");
    }
    }
    I have try to connect the 3 Triggers, but i dont changed the script.
    So it doesn't work.


    Click image for larger version. 

Name:	Test.png 
Views:	47 
Size:	158.7 KB 
ID:	521

    ___________________________________________
    Need Help !

    Thanks

    ElEmEnT

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Code:
    elevator()
    {
    	trigs = getentarray("sometrig", "targetname"); //name all your triggers "sometrig"
    	for(i = 1; i < trigs.size; i++)
    		trigs[i] thread relay_notify(trigs[0]);
    	while(true)
    	{
    		trigs[0] waittill("trigger", player);
    		//do elevator stuff here
    	}
    }
    
    relay_notify(parent)
    {
    	while(true)
    	{
    		self waittill("trigger", player);
    		parent notify("trigger", player);
    	}
    }

  3. #3
    Private ElEmEnT's Avatar
    Join Date
    Aug 2013
    Posts
    22
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Ok, sorry i mean every trigger have get bashed to activate the Brushmodel.

  4. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Do they have to get bashed in a particular order?

  5. #5
    Private ElEmEnT's Avatar
    Join Date
    Aug 2013
    Posts
    22
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Yes, if its possible.

  6. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Code:
    elevator()
    {
    	trig1 = getent("sometrig_first", "targetname"); 
    	trig2 = getent("sometrig_second", "targetname"); 
    	trig3 = getent("sometrig_third", "targetname"); 
    	while(true)
    	{
    		trig1 waittill("trigger");
    		trig2 waittill("trigger");
    		trig3 waittill("trigger");
    		//elevator stuff goes here
    	}
    }
    Does not reset if someone bashes them in the wrong order though.

  7. The Following 2 Users Say Thank You to IzNoGoD For This Useful Post:

    ElEmEnT (26th October 2013),kung foo man (26th October 2013)

  8. #7
    Private ElEmEnT's Avatar
    Join Date
    Aug 2013
    Posts
    22
    Thanks
    9
    Thanked 0 Times in 0 Posts
    It work, Thanks !

  9. #8
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Code:
    stuff()
    {
    	trigs = [];
    	trigs[trigs.size] = getent("trig_first", "targetname");
    	trigs[trigs.size] = getent("trig_second", "targetname");
    	trigs[trigs.size] = getent("trig_third", "targetname");
    	
    	for(i = 0; i < trigs.size; i++)
    		trigs[i] thread dotrig(i, trigs[0]);
    	nextnum = 0;
    	while(true)
    	{
    		trigs[0] waittill("triggernum", num);
    		if(num == nextnum)
    		{
    			nextnum++;
    			if(nextnum == trigs.size)
    			{
    				nextnum = 0;
    				//do elevator
    			}
    		}
    		else
    			nextnum = 0; //failed to do correct order
    	}
    }
    
    dotrig(num, parent)
    {
    	while(true)
    	{
    		self waittill("trigger");
    		parent notify("triggernum", num);
    	}
    }
    Now added with press-wrong-button-you-have-to-start-again functionality

  10. #9
    Private ElEmEnT's Avatar
    Join Date
    Aug 2013
    Posts
    22
    Thanks
    9
    Thanked 0 Times in 0 Posts
    But One Question, where is the variable for the Brushmodel?
    I have add the Brushmodel in the upper part:

    Code:
            trigs = [];
    ->      BrushModel = getent("BrushModel","targetname");      <-
    	trig1 = getent("secdoor1trig", "targetname"); 
    	trig2 = getent("secdoor2trig", "targetname"); 
    	trig3 = getent("secdoor3trig", "targetname");
    I thought i need it for the Elevator part, is that wrong?

  11. #10
    Private ElEmEnT's Avatar
    Join Date
    Aug 2013
    Posts
    22
    Thanks
    9
    Thanked 0 Times in 0 Posts
    And I get an Error, idk what i have to fix?

    undefined is not an object: (file 'maps/mp/mp_blackbox.gsc', line 114)
    trigs[0] waittill("triggernum", num);

Posting Permissions

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