MODSonline Subscriptions
View in iTunes
Please help us to raise in the ranks of podcasting and subscribe to our itunes feed using the link above.
The next MODSonair show will air LIVE on:
03/21/2010 12:03 EDT

Time remaining:
We Dontated to PixelEquity
"Modding refers to the act of modifying a piece of hardware or software or anything else for that matter, to perform a function not originally conceived or intended by the designer." 4
 
Site News   |   Aggregated News   |   Forums   |   Tutorials   |   Downloads   |   Projects   |   Weblinks
Latest Forum Threads 
CoD2 MP Mapping.. Posts: (12) Views: (92) by StrYdeR
CoDUO Mapping.. Posts: (5) Views: (67) by sternkaa
MODSon-air.. Posts: (1) Views: (16) by foyleman
CoD4 Scripting.. Posts: (7) Views: (202) by DemonSeed
General Gaming.. Posts: (4) Views: (94) by techno2sl
CoD4 General.. Posts: (92) Views: (116) by Samuel033
CoD4 MP Mapping.. Posts: (1) Views: (25) by Infern4ll
CoDWW MP Mapping.. Posts: (5) Views: (83) by [ZCT]CoDMapper
CoD4 MP Mapping.. Posts: (10) Views: (155) by [IBS]MattY
CoD4 Map + Mod R.. Posts: (32) Views: (229) by sam_fisher3000
Back to Home Page
MODSCON 2010 L4D2 Contest
 
Forums
MODSonline.com 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 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, StrYdeR, techno2sl, batistablr, Welshy, Rasta, supersword, batistablr, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access subscribe
Author Topic: Tweaking my elevator
Norseman
General Member
Since: Aug 16, 2009
Posts: 30
Last: Jan 16, 2010
[view latest posts]
Level 2
Category: CoD2 MP Mapping
Posted: Wednesday, Nov. 25, 2009 08:41 am
I have this elevator script that is very simple and works well except for one problem. If the trigger is activated while the elevator is already in motion the position of the elevator gets out of whack. I was wondering if it is possible to add a command to the script that makes the elevator ignore all triggers until the elevator is done moving or done with the current script? Any help would be great, thank you. Here is the script:



elevator1.gsc



main()
{
thread elevator();
}

elevator()
{
elevator=getent("elevator1","targetname");
trig=getent("trig_elevator1","targetname");
while(1)
{
trig waittill ("trigger");
elevator movez (-1204,3,1,1);
elevator waittill ("movedone");
wait(2);
elevator movez (1204,3,1,1);
elevator waittill ("movedone");
}
}
liltc64
General Member
Since: Feb 12, 2007
Posts: 272
Last: Mar 17, 2010
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Friday, Nov. 27, 2009 04:32 pm
what do u mean get out of wack??? im looking at the code and i see nothing wronge could u explain more of what happends?
codmp
General Member
Since: Feb 6, 2006
Posts: 900
Last: Dec 27, 2009
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Friday, Nov. 27, 2009 06:34 pm
Code:
main()
{
thread elevator();
}

elevator()
{
elevator=getent("elevator1","targetname");
trig=getent("trig_elevator1","targetname");
while(1)
{
oldpos = trig.origin;
trig waittill ("trigger");
trig.origin = (0,0,10000);
elevator movez (-1204,3,1,1);
elevator waittill ("movedone");
wait(2);
elevator movez (1204,3,1,1);
elevator waittill ("movedone");
trig.origin = oldpos;
}


This should move the trigger 10,000 units up in the sky after being triggered. Then moved back to its original position after the elevator has completed moving.

There is TriggerOn and TriggerOff functions that i believe do this exact same thing with moving the trigger origins. I just can't remember where they are located in the iwd files, so i cant thread them.
Norseman
General Member
Since: Aug 16, 2009
Posts: 30
Last: Jan 16, 2010
[view latest posts]
Level 2
Category: CoD2 MP Mapping
Posted: Friday, Nov. 27, 2009 10:07 pm
liltc64 writes...
Quote:
what do u mean get out of wack??? im looking at the code and i see nothing wronge could u explain more of what happends?


If a player activates either trigger while the elevator is moving it starts the script in the middle of the elevator moving. The elevator then loses it's original position because it started running the script in the middle of moving with the original script. The elevator sometimes leaves the map never to return until the map is over.


Thank you codmp,I'll give this a try.It looks like it moves the trigger used but not the other trigger but it will help with my problem. thank you again for your response.
clanhelio
General Member
Since: Aug 30, 2008
Posts: 113
Last: Feb 28, 2010
[view latest posts]
Level 4
Category: CoD2 MP Mapping
Posted: Friday, Nov. 27, 2009 11:31 pm
That script actually looks airtight, don't know why it would allow a trigger while it's moving, you can try this though, I just added a variable 'eleismoving'

Code:
main()
{
thread elevator();
}

elevator()
{
eleismoving = 0;
elevator=getent("elevator1","targetname");
trig=getent("trig_elevator1","targetname");
while(1)
{
trig waittill ("trigger");
if( eleismoving == 0 )
{
eleismoving = 1;
elevator movez (-1204,3,1,1);
elevator waittill ("movedone");
wait(2);
elevator movez (1204,3,1,1);
elevator waittill ("movedone");
eleismoving = 0;
}
}
}
liltc64
General Member
Since: Feb 12, 2007
Posts: 272
Last: Mar 17, 2010
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Saturday, Nov. 28, 2009 10:47 am
yeah like clanhelio said ur orginal code looks fine... u can try there 2 codes i also got a trigger on and off code u can try if those dont work but they should.

Code:
#include maps\mp\_utility;

main()
{
thread elevator();
}

elevator()
{
elevator=getent("elevator1","targetname");
trig=getent("trig_elevator1","targetname");
while(1)
{
trig waittill ("trigger");
trig triggerOff();
elevator movez (-1204,3,1,1);
elevator waittill ("movedone");
wait(2);
elevator movez (1204,3,1,1);
elevator waittill ("movedone");
trig triggerOn();
}
}
Norseman
General Member
Since: Aug 16, 2009
Posts: 30
Last: Jan 16, 2010
[view latest posts]
Level 2
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 29, 2009 02:01 am
I have tried all of these and they work great, if there is one trigger. Maybe I'm looking at this sideways. I would like a elevator that has a trigger at the bottom and the top. I have tried making the trigger identical top and bottom and that does not work, I have tried making them different, trig_bottom & trig_top with seperate scripts but that leads to problems. I need instructions or a tutorial on how to make an elevator with a trigger at the top and bottom and that will not lose it's position if triggered from the top and moving you can not use the bottom trigger until the motion is complete and visa versa. One trigger ele's are working great for me, no problem, but I'm hoping to get a 2 trigger elevator. I'm not sure if I'm explaining this right so it can be understood but I hope so.
Norseman
General Member
Since: Aug 16, 2009
Posts: 30
Last: Jan 16, 2010
[view latest posts]
Level 2
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 29, 2009 12:52 pm
I have given up on using the original script with 2 triggers, I can not get it to work the way I want with this script. If I name the triggers the same at the top and bottom the elevator becomes an always moving elevator. I wanted the elevator to go down and then back to the original position but I'm not good enough at this to make this work without flaws that happen in positioning. I have decided to use this script were the elevator only goes up or down, it seems my best option at this time. It works great, does not get out of position if you trigger it mid operation and I can make as many triggers with the same name and it still works great. Thanks for all the help everyone.


Code:
main() { 
level.elev1Down = true; // elev1 starts at bottom: true/false 
level.elev1Moving = false; // elev1 is not currently moving 
thread elev1_start(); 
} 

elev1_start() { 
elev1 = getentarray ("elev1switch","targetname"); 
if ( isdefined(elev1) ) 
for (i = 0; i < elev1.size; i++) 
elev1[i] thread elev1_think(); 
} 

elev1_think() { 
while (1) { 
self waittill ("trigger"); 
if (!level.elev1Moving) 
thread elev1_move(); 
} 
} 

elev1_move() { 
elev1model = getent ("elev1model", "targetname"); 
level.elev1Moving = true; 
wait (2); 
if (level.elev1Down) { // moves to top 
elev1model moveZ (1204,5,2,2); 
elev1model waittill ("movedone"); 
level.elev1Down = false; 
} 
else { // moves to bottom 
elev1model moveZ (1204 - (1204 * 2), 5,2,2); 
elev1model waittill ("movedone"); 
level.elev1Down = true; 
} 
level.elev1Moving = false; 
}
liltc64
General Member
Since: Feb 12, 2007
Posts: 272
Last: Mar 17, 2010
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 29, 2009 06:06 pm
sorry i wasnt on modsonline when u needed help with the 2 triggers could have helped u basicly all u do is make the triggers then select both of them and give them the targetname : trig, then in ur .gsc all u would have to do is.
Code:
#include maps\mp\_utility;


main()
{
thread elevator();
}

elevator()
{
elevator=getent("elevator1","targetname");
trigger=getentarray("trig","targetname");
while(1)
{
trigger waittill ("trigger");
trigger triggerOff();
elevator movez (-1204,3,1,1);
elevator waittill ("movedone");
wait(2);
elevator movez (1204,3,1,1);
elevator waittill ("movedone");
trigger triggerOn();
}
}


and that should work fine.
Restricted Access Restricted Access subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping