Author |
Topic: script help needed plz |
pallchrn |
General Member Since: Feb 12, 2004 Posts: 31 Last: Feb 16, 2010 [view latest posts] |
|
|
Category: CoDUO Mapping Posted: Friday, Nov. 2, 2007 02:46 pm |
|
ok what im having trouble with is one door + two triggers
i have tried copying the 1st trigger and giving the 2nd trigger the same targetname ( all i get is the door repeatadly going up and down)
as the triggers was opposite through the wall i tried making the trigger big to go through the wall for it to work. but as it touches a brush dosnt work.
therefore i thought i would script it.
so what i need is trigger 1 to activate (door goes up)
Or trigger 2 goes up if activate
trigger 2 OR trigger 1 for next sequence = triggered and goes down
so they kind of work with each other knowing if the door = up or down.
this is what i have so far
##################################
main()
{
thread electricdoor();
}
electricdoor()
{
trigger = getent("door_sequence_trigger", "targetname");
trigger waittill("trigger");
thread activate_the_door();
}
activate_the_door()
{
aufzug = getent("updowndoor", "targetname");
movingdoor = getent("doorsound", "targetname");
wait 1;
movingdoor playsound("gantrys");
aufzug moveZ(170, 5);
aufzug waittill("movedone");
thread electronicdoor2();
}
electronicdoor2()
{
trigger = getent("door_sequence_trigger", "targetname");
trigger waittill("trigger");
thread activate_the_door2();
}
activate_the_door2()
{
aufzug = getent("updowndoor", "targetname");
movingdoor = getent("doorsound", "targetname");
wait 1;
movingdoor playsound("gantrys");
aufzug moveZ(-170, 5);
wait 1;
aufzug waittill("movedone");
thread electricdoor();
}
#####################################
trigger 2 is called "door_sequence_2"
but not added yet
any help will be appreciated. thankyou...
|
|
|
|
The_Caretaker |
General Member Since: Jun 8, 2004 Posts: 11625 Last: Jul 7, 2009 [view latest posts] |
|
|
|
playername |
|
Preferred Member Since: Aug 24, 2006 Posts: 821 Last: Apr 15, 2011 [view latest posts] |
|
|
|
Category: CoDUO Mapping Posted: Friday, Nov. 2, 2007 07:25 pm |
|
TC you didn't notice he didn't use getentarray...
Here you go
Code:
main()
{
thread electricdoor();
}
electricdoor()
{
level.doormoving=false;
level.doorup=false;
trigger = getentarray("door_sequence_trigger", "targetname"); //triggers
if(!isdefined(trigger)
{
iprintln("Trigger not found!");
}
thread activate_the_door(trigger);
}
activate_the_door(other)
{
if(!level.doorup)
{
//if door is down, go up.
other waittill("trigger");
aufzug = getent("updowndoor", "targetname"); //door
level.doormoving=true;
movingdoor = getent("doorsound", "targetname"); //sound
aufzug moveZ(170, 5);
wait 1;
movingdoor playsound("gantrys");
aufzug waittill("movedone");
level.doorup=ture;
level.doormoving=false;
}
else
{
//if door is up, go down.
other waittill("trigger");
aufzug = getent("updowndoor", "targetname"); //door
level.doormoving=true;
movingdoor = getent("doorsound", "targetname"); //sound
aufzug moveZ(-170, 5);
wait 1;
movingdoor playsound("gantrys");
aufzug waittill("movedone");
level.doorup=false;
level.doormoving=false;
}
}
If that doesn't work let me go, I did this with coppy paste really fast. |
nullFew tips for coding.
1. Keep the script as short as possible.
2. Don't comment every line. Only comment portions where they may be needed to point something out.
3. Don't over complicate the script, keep it organized and easy to read.
These help you find simple errors and makes it easy to make changes. |
|
|
|
The_Caretaker |
General Member Since: Jun 8, 2004 Posts: 11625 Last: Jul 7, 2009 [view latest posts] |
|
|
|
pallchrn |
General Member Since: Feb 12, 2004 Posts: 31 Last: Feb 16, 2010 [view latest posts] |
|
|
|
pallchrn |
General Member Since: Feb 12, 2004 Posts: 31 Last: Feb 16, 2010 [view latest posts] |
|
|
|
The_Caretaker |
General Member Since: Jun 8, 2004 Posts: 11625 Last: Jul 7, 2009 [view latest posts] |
|
|
|
pallchrn |
General Member Since: Feb 12, 2004 Posts: 31 Last: Feb 16, 2010 [view latest posts] |
|
|
|
pallchrn |
General Member Since: Feb 12, 2004 Posts: 31 Last: Feb 16, 2010 [view latest posts] |
|
|
|