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

Members Online

»
0 Active | 84 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

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 subscribe
Author Topic: Trapdoor goes up but not down
Shalkan
General Member
Since: May 14, 2006
Posts: 39
Last: Nov 13, 2006
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Thursday, Aug. 3, 2006 05:45 pm
i want to make a trapdoor that when you hit the use key it goes up and must must press the use key again for it to come down.

i've been trying multple scripts and when I hit the use key the door opens perfect sound and all but when i hit the use key to make it close nothing happens at all! heres the script i'm currently using and it worked great when i was using this script set up for elevators.

Code:
main() {
maps\mp\_load::main();

thread door1_start();
thread door1_think();
level.door1Down = true;
level.door1Moving = false; 
}

door1_start() { 
door1 = getentarray ("door_trigger1","targetname"); 
if ( isdefined(door1) ) 
for (i = 0; i < door1.size; i++)
door1[i] thread door1_think(); 
} 


door1_think(){ 
while (1) { 
self waittill ("trigger"); 
if (!level.door1Moving)
thread door1_move(); 
} 
}

door1_move(){ 
door1 = getent ("door1", "targetname"); 
level.door1Moving = true; 
wait (1); 
if (level.door1Down) { // moves to top 
door1 playsound ("dooropen"); 
wait (1); 
door1 rotateroll (90, 1.5, 0.7, 0.7); 
door1 waittill ("movedone"); 
level.door1Down = false; 
} 
else { // moves to bottom 
door1 playsound ("doorclose"); 
wait (1); 
door1 rotateroll (-90, 1.5, 0.7, 0.7); 
door1 waittill ("movedone"); 
level.door1Down = true; 
} 
level.door1Moving = false; 
} 



Is there something wrong with the script or do rotating door have to be set it close in a certain amount of time?
Share |
Shalkan
General Member
Since: May 14, 2006
Posts: 39
Last: Nov 13, 2006
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Thursday, Aug. 3, 2006 07:10 pm
the reason i'm using this complicated of a script to make a swinging door is because i want to to have two triggers
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 Scripting
Posted: Thursday, Aug. 3, 2006 08:05 pm
door1 waittill ("movedone");

try changing it to door1 waittill ("rotatedone"); (in both cases).. this MIGHT work.
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Aug. 4, 2006 12:08 pm
If caretakers's recommendation does not work, you could do what IW mostly does in its script.

They basically use a wait statement after each move/rotate with the duration that was specified on the motion function rather than waiting for a event notification with a waittill.

So instead of :

Code:
door1 rotateroll (90, 1.5, 0.7, 0.7); 
door1 waittill ("movedone"); 


replace the waittill with a wait of 1.5.

Code:
door1 rotateroll (90, 1.5, 0.7, 0.7); 
wiat (1.5);
Share |
Restricted Access Topic is Locked 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

»