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

Members Online

»
0 Active | 55 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 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked 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 01:41 pm
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");
}
}
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Friday, Nov. 27, 2009 09: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?
Share |
codmp
General Member
Since: Feb 7, 2006
Posts: 905
Last: Aug 1, 2011
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Friday, Nov. 27, 2009 11: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.
Share |
Norseman
General Member
Since: Aug 16, 2009
Posts: 30
Last: Jan 16, 2010
[view latest posts]
Level 2
Category: CoD2 MP Mapping
Posted: Saturday, Nov. 28, 2009 03:07 am
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.
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 MP Mapping
Posted: Saturday, Nov. 28, 2009 04:31 am
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;
}
}
}
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Saturday, Nov. 28, 2009 03:47 pm
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();
}
}
Share |
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 07: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.
Share |
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 05: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; 
}
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 29, 2009 11: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.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping

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

»