PDA

View Full Version : 3 Triggers -> One Output (Brushmodel)



ElEmEnT
25th October 2013, 23:50
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 :

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.


521

___________________________________________
Need Help !

Thanks

ElEmEnT

IzNoGoD
26th October 2013, 00:04
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);
}
}

ElEmEnT
26th October 2013, 00:41
Ok, sorry i mean every trigger have get bashed to activate the Brushmodel.

IzNoGoD
26th October 2013, 10:00
Do they have to get bashed in a particular order?

ElEmEnT
26th October 2013, 11:16
Yes, if its possible.

IzNoGoD
26th October 2013, 11:23
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.

ElEmEnT
26th October 2013, 12:16
It work, Thanks ! :)

IzNoGoD
26th October 2013, 13:16
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

ElEmEnT
26th October 2013, 14:37
But One Question, where is the variable for the Brushmodel?
I have add the Brushmodel in the upper part:



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?

ElEmEnT
26th October 2013, 15:04
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);

IzNoGoD
26th October 2013, 15:25
yes, you did NOT use any of the scripts, you messed up and took 2 scripts and mixed them.

That doesnt work.

Look closely.

pollo
3rd November 2013, 18:08
Faster way:

Make 3 triggers with different targetnames (trig1, trig2, trig3) and a door (targetname: door), and set it NO_BASH only (look at the image).

532

Then, copy&paste this script:


main()
{
trig1 = getent("trig1","targetname");
trig2 = getent("trig2","targetname");
trig3 = getent("trig3","targetname");
door = getent("door","targetname");

while(1)
{
trig1 waittill("damage",dmg,user);
if(dmg >10)
{
trig2 waittill("damage",dmg);
if(dmg >10)
{
trig3 waittill("damage",dmg);
if(dmg>10)
{
//do door stuff
user iprintlnbold("Moving door");
door movez(100,2);
door waittill("movedone");
door movez(-100,2);
door waittill("movedone");
}
}

}
wait 0.5;
}
}