Page 2 of 2

Re: Will this work?

Posted: April 24th, 2011, 12:25 am
by Lawless
megazor wrote:try this and tell us what it says

Code: Select all

main()
{
   	thread self_closing_doors();
}

self_closing_doors()
{
   	doors = getentarray("bounce_trig", "targetname");
   	for(i = 0; i < doors.size; i++)
      		doors[i] thread door_think();
}

door_think()
{
   	self.doormoving = false;
   	self.doormodel = getent(self.target, "targetname");
   	if (isDefined(self.doormodel))
		iprintln("model defined");

   	while(1)
   	{
      		self waittill("trigger");
      		if(!self.doormoving)
         		self thread door_move();
   	}
}

door_move()
{
  	self maps\mp\_utility::triggerOff();
   	self.doormoving = true;
  	if (isDefined(self.count))
		iprintln("rotating");
   	self.doormodel rotateyaw(self.count, 2, .5, .5);
   	self.doormodel waittill("rotatedone");
   	wait 60;
   	self.doormodel rotateyaw((self.count * -1), 2, .5, .5);
   	self.doormodel waittill("rotatedone");
   	self maps\mp\_utility::triggerOn();
   	self.doormoving = false;
}
Didn't work ='[

Re: Will this work?

Posted: April 24th, 2011, 12:26 am
by Lawless
Drofder2004 wrote:
megazor wrote:he said it was defined in radiant:

key = count
value = 90
Didn't see that.

for the sake of testing, I would enter a value in the script and NOT in radiant.
Where would i enter this in the script?

Re: Will this work?

Posted: April 24th, 2011, 2:22 am
by iCYsoldier
Lawless wrote:Where would i enter this in the script?
Where you see 'self.count', replace it with 90:

Code: Select all

door_move()
{
    self maps\mp\_utility::triggerOff();
    self.doormoving = true;
    self.doormodel rotateyaw(90, 2, .5, .5);
    self.doormodel waittill("rotatedone");
    wait 60;
    self.doormodel rotateyaw((90 * -1), 2, .5, .5);
    self.doormodel waittill("rotatedone");
    self maps\mp\_utility::triggerOn();
    self.doormoving = false;
}

Re: Will this work?

Posted: April 24th, 2011, 9:26 am
by IzNoGoD
Seems to me you have a door and a trigger, and are trying trigger commands on your door.
They dont work then.

Re: Will this work?

Posted: April 24th, 2011, 11:29 pm
by Drofder2004
IzNoGoD wrote:Seems to me you have a door and a trigger, and are trying trigger commands on your door.
They dont work then.

Code: Select all

self_closing_doors()
{
   	doors = getentarray("bounce_trig", "targetname");
   	for(i = 0; i < doors.size; i++)
      		doors[i] thread door_think();
}
From that line of code, I would assume door is actually a trigger. and self.doormodel is an entity, representing a door.

Although, honestly, I do not like the fact the door entity is a variable attached to the trigger. I would (at least while testing) make these two independant variables [door and trig].