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

Members Online

»
0 Active | 5 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: A small and Simple multiple door handling script
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Saturday, Oct. 7, 2006 12:49 pm
I see a lot of you making huge repetitive scripts for door control in here, so I thought I would whip up a simple small script that will handle any number of doors in a map.

I hope you find this usefull.

Regards Grassy
Quote:

//Multi door script
//By <|WHC|>Grassy
//This is to play sounds and rotate multiple doors, as many as you want!

//Place this in your map directory and call this script using
//maps\mp\doors::main();
//from your map.gsc

//NOTE You must name all your door triggers "doortrig"
//and you need to target your door from each trigger
//It dosnt matter what targetname the actual doors have.

main() {
doors = getentarray("doortrig", "targetname");
for(z = 0; z < doors.size; z ++) {
doors[z] thread LetsMoveTheDangDoor();
}
}

LetsMoveTheDangDoor() {
while(1) {
self waittill ("trigger");
ent = getent(self.target , "targetname");
ent playsound("open");
ent rotateYaw(90, 1.5, 0.7, 0.7);
ent waittill ("rotatedone");
wait (3);
ent playsound("close");
ent rotateYaw(-90, 1.5, 0.7, 0.7);
ent waittill ("rotatedone");
}
}
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Oct. 11, 2006 08:22 am
Hmm, no comments huh? [banghead]
Share |
sharkeh
General Member
Since: Sep 24, 2006
Posts: 20
Last: Dec 1, 2006
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Oct. 11, 2006 10:18 am
That's a good simple script but the reason a lot of people have more complex scripts is because they want more complex doors e.g. swinging both ways and not closing when someone is in the way. :)
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Oct. 11, 2006 11:36 am
Ahh the laws of relativity!
The more complex actions require complex scripts.

I understand what your saying, this script was intended to be generic and could easily be expanded to control extra options.

Regards Grassy
Share |
Big-Madman
General Member
Since: May 14, 2006
Posts: 197
Last: May 7, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Feb. 17, 2007 03:12 pm
[cool] thank you Grassy ....that'll help for sure .... [rocking]
Share |
Big-Madman
General Member
Since: May 14, 2006
Posts: 197
Last: May 7, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Feb. 17, 2007 04:16 pm
[cool]hmm , not working ...what you mean by .. (you need to target your door from each trigger)


how to do it ??.. thank you

[rocking]

edited on Feb. 17, 2007 11:16 am by Big-Mal
Share |
babycop
General Member
Since: Feb 18, 2006
Posts: 488
Last: Feb 27, 2010
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Saturday, Feb. 17, 2007 05:10 pm
he means close to every door is a trigger...should be a trigger_use...select that trigger and connect it to the door...do that for every door....

btw Grassy, very smart script if there's a lot of doors and saves space in the gsc by elminating all the threads for every single door.
Share |
Big-Madman
General Member
Since: May 14, 2006
Posts: 197
Last: May 7, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Feb. 17, 2007 06:11 pm
lol ok but what you mean by that ... select that trigger and connect it to the door...do that for every door....

put something in the entity , put it all over the door ...

sorry it's not clear...

----------------------------------

because i did that , i have it compiled and start the map but since i hit the trigger to open the door , the map shut down and it give me n error ...

something on this line (getent(self.target , "targetname");)
[banghead][banghead][banghead]
Share |
babycop
General Member
Since: Feb 18, 2006
Posts: 488
Last: Feb 27, 2010
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Saturday, Feb. 17, 2007 06:16 pm
um...i dont know how to make it clearer...basically, every door has its trigger...choose the trigger, then choose the door...so now both are highlighted....now press W and that will connect the trigger to the door...
Share |
Capt.Com
General Member
Since: Nov 14, 2004
Posts: 879
Last: Oct 6, 2007
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Feb. 17, 2007 06:50 pm
Code:
main() {
maps\mp\_load::main();

thread door1_rotate();
thread door2_rotate();
}


door1_rotate()
{
door1 = getent("door1", "targetname");
trig = getent("door_trigger1", "targetname");
while (1)
{
trig waittill("trigger");
door1 rotateYaw(90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
wait (3);
door1 rotateYaw(-90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
}
}

door2_rotate()
{
door2 = getent("door2", "targetname");
trig = getent("door_trigger2", "targetname");
while (1)
{
trig waittill("trigger");
door2 rotateYaw(90, 1.5, 0.7, 0.7);
door2 waittill("rotatedone");
wait (3);
door2 rotateYaw(-90, 1.5, 0.7, 0.7);
door2 waittill("rotatedone");
}
}
etc.....you make the same for each door.
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

»