Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 7 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Elevator with automatic door
Reavensito
General Member
Since: Jul 22, 2006
Posts: 74
Last: Nov 21, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Jul. 28, 2007 10:58 am
I want to say that, do you know how make a elevator that, so that people enter, are needed to open an automatic door? That it opens herself towards the side.

Like this elevator but only 1 door.

I want to make it for avoid to people block the elevator.

Thanks.
Share |
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, Jul. 28, 2007 01:39 pm
Well it takes time, but my first qestion is, do you have multiple floors? it will be harder to open and close the doors for more than two floors, but with only two stops, it is much easier.
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.
Share |
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, Jul. 28, 2007 01:39 pm
ops dubble post


edited on Jul. 28, 2007 09:48 am by playername
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.
Share |
Reavensito
General Member
Since: Jul 22, 2006
Posts: 74
Last: Nov 21, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Jul. 28, 2007 03:04 pm
No, only has 2 stops (top and bottom)
Share |
codmp
General Member
Since: Feb 7, 2006
Posts: 905
Last: Aug 1, 2011
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Jul. 28, 2007 03:50 pm
Try this: http://www.modsonline.com/Downloads-full-2689.html

Its in CoD downloads section but it shud still work for CoD2.
Share |
Reavensito
General Member
Since: Jul 22, 2006
Posts: 74
Last: Nov 21, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Jul. 28, 2007 05:05 pm
Ok, thanks, I go now to test it.
Share |
Reavensito
General Member
Since: Jul 22, 2006
Posts: 74
Last: Nov 21, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Jul. 28, 2007 05:19 pm
The result is this one:



I textured which is seen like caulk, and don't work either.

PD: it isn't its original position. I placed it there to prove.
Share |
Reavensito
General Member
Since: Jul 22, 2006
Posts: 74
Last: Nov 21, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Jul. 28, 2007 05:31 pm
If I make my own elevator and I put this code? Will it work?

Quote:
main() {

thread door3_rotate(),
thread door4_rotate();
thread elevator_start();
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving

}

elevator_start() {
elevator = getentarray ("elevatorswitch3","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}

elevator_think() {
while (1) {
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();
}
}

elevator_move()
{
elevator2 = getent ("elevator3", "targetname");
level.elevatorMoving = true;

speed = 3; // * Velocidad a la que se mueve el brushmodel.
height = 280; // * Distancia que recorre el brushmodel en unidades.

if (level.elevatorDown) {
wait (1);
elevator3 playsound ("elevador");

elevator3 moveZ (height, speed); // * Direccion del movimiento, ejes X, Y o Z

elevator3 waittill ("movedone");
elevator3 playsound ("bell");

door4_rotate()
{
door4 = getent("door4", "targetname");
trig = getent("door_trigger3", "targetname");
while (1)
{
trig waittill("trigger");
door4 rotateYaw(90, 1.2, 0.4, 0.4);
door4 playsound ("dooropen");
door4 waittill("rotatedone");
wait (3);
door4 rotateYaw(-90, 1.2, 0.4, 0.4);
door4 playsound ("doorclose");
door4 waittill("rotatedone");
}
}

level.elevatorDown = false;
}
else { // moves to bottom
wait (1);
elevator3 playsound ("elevador");

elevator3 moveZ (height - (height * 2), speed); // * Direccion delmovimiento, ejes X, Y o Z

elevator3 waittill ("movedone");
elevator3 playsound ("bell");

door3_rotate()
{
door3 = getent("door3", "targetname");
trig = getent("door_trigger3", "targetname");
while (1)
{
trig waittill("trigger");
door3 rotateYaw(90, 1.2, 0.4, 0.4);
door3 playsound ("dooropen");
door3 waittill("rotatedone");
wait (3);
door3 rotateYaw(-90, 1.2, 0.4, 0.4);
door3 playsound ("doorclose");
door3 waittill("rotatedone");
}
}

level.elevatorDown = true;
}
level.elevatorMoving = false;
}
Share |
Scharfschuetze
General Member
Since: Dec 23, 2006
Posts: 162
Last: Jul 7, 2011
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Jul. 30, 2007 04:58 am
Reavensito,

I am assuming that this is the topic you wanted me to read? The link was only to the index and did not lead to this one, but seems to be the one you wanted.

Exactly what are you asking? I have a working elevator, it has only been slightly tested, as it goes up and down and has separate doors at each level and also a door on the elevator itself.

I have not worked on it for a while, as I have too many projects open at once.

Let me know what you are looking for.

[sniper]
Share |
Reavensito
General Member
Since: Jul 22, 2006
Posts: 74
Last: Nov 21, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Jul. 30, 2007 11:00 am
Well, look, i had an idea. I am using "wait" for control doors when the trigger is activated.

Code:
// Scripted by Reaven

main()
{
thread door1();
thread door2();
thread door3();
thread door4();
}

door1()
{
door = getent("puerta1", "targetname");
trig = getentarray("ascensor_trigger", "targetname");
dest_org = ( 58, 0, 0);
dest_org2 = ( -57, 0, 0);
dest_org3 = ( -58, 0, 0); 
dest_org4 = ( 57, 0, 0);

while (1)
{
self waittill("trigger");
door moveX ( 58, 1.5, 0.7, 0.7);
//door rotateYaw(dest_org, 1.5, 0.7, 0.7);
//door playsound ("dooropen"); 
door waittill("rotatedone");
self waittill("trigger");
wait (10);
door moveX ( -58, 1.5, 0.7, 0.7);
//door rotateYaw(dest_org3, 1.5, 0.7, 0.7);
//door playsound ("doorclose");
door waittill("rotatedone"); 

}
}

door2()
{
door2 = getent("puerta2", "targetname");
trig = getentarray("ascensor_trigger", "targetname");
dest_org = ( 58, 0, 0);
dest_org2 = ( -57, 0, 0);
dest_org3 = ( -58, 0, 0); 
dest_org4 = ( 57, 0, 0);

while (1)
{
self waittill("trigger");
door2 moveX ( -57, 1.5, 0.7, 0.7);
//door2 rotateYaw(dest_org2, 1.5, 0.7, 0.7);
//door playsound ("dooropen"); 
door2 waittill("rotatedone");
self waittill("trigger");
wait (10);
door2 moveX ( 57, 1.5, 0.7, 0.7);
//door2 rotateYaw(dest_org4, 1.5, 0.7, 0.7);
//door playsound ("doorclose");
door2 waittill("rotatedone"); 

}
}

door3()
{
door3 = getent("puerta3", "targetname");
trig = getentarray("ascensor_trigger", "targetname");
dest_org = ( 58, 0, 0);
dest_org2 = ( -57, 0, 0);
dest_org3 = ( -58, 0, 0); 
dest_org4 = ( 57, 0, 0);

while (1)
{
self waittill("trigger");
wait (10);
door3 moveX ( 58, 1.5, 0.7, 0.7);
//door3 rotateYaw(dest_org, 1.5, 0.7, 0.7);
//door playsound ("dooropen"); 
door3 waittill("rotatedone");
self waittill("trigger");
door3 moveX ( -58, 1.5, 0.7, 0.7);
//door3 rotateYaw(dest_org3, 1.5, 0.7, 0.7);
//door playsound ("doorclose");
door3 waittill("rotatedone"); 

}
}

door4()
{
door4 = getent("puerta4", "targetname");
trig = getentarray("ascensor_trigger", "targetname");
dest_org = ( 58, 0, 0);
dest_org2 = ( -57, 0, 0);
dest_org3 = ( -58, 0, 0); 
dest_org4 = ( 57, 0, 0);

while (1)
{
self waittill("trigger");
wait (10);
door4 moveX ( -57, 1.5, 0.7, 0.7);
//door4 rotateYaw(dest_org2, 1.5, 0.7, 0.7);
//door playsound ("dooropen"); 
door4 waittill("rotatedone");
self waittill("trigger");
door4 moveX ( 57, 1.5, 0.7, 0.7);
//door4 rotateYaw(dest_org4, 1.5, 0.7, 0.7);
//door playsound ("doorclose");
door4 waittill("rotatedone"); 

}
}


The problem is that the elevator works but doors no. They are using the same trigger. The_Caretaker told me that I must specify what array are using doors, but I'm spanish, and I don't know what does mean "array":
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»