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

Members Online

»
0 Active | 65 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: elevator problem!?
flev93
General Member
Since: Oct 12, 2010
Posts: 21
Last: Jan 20, 2013
[view latest posts]
Level 1
Category: CoD2 MP Mapping
Posted: Thursday, Aug. 2, 2012 03:49 pm
ok so i made a simple elevator to learn to script it for 2 levels, just to learn before i put it in my map, i want it to start from bottom floor, then just go to top floor, i want a trigger and bottom so you have to press "F" to go up, i want the elevator to stay at top, unless a player pressed the trigger at the top to go down, or if a player calls it at bottom, atm it just keeps going up and down on its own, ive made two triggers, the use_touch ones! here is my scripts!

this one is my GSC file:-

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

setExpFog(0.0001, 0.55, 0.6, 0.55, 0);
// setCullFog(0, 16500, 0.55, 0.6, 0.55, 0);
ambientPlay("ambient_france");

game["allies"] = "american";
game["axis"] = "german";
game["attackers"] = "allies";
game["defenders"] = "axis";
game["american_soldiertype"] = "normandy";
game["german_soldiertype"] = "normandy";

setCvar("r_glowbloomintensity0", ".25");
setCvar("r_glowbloomintensity1", ".25");
setcvar("r_glowskybleedintensity0",".3") ;

maps\mp\elevator::main();

}


then this is my elevator GSC file:-

main()
{
thread elevator();
}

elevator()
{
elevator=getent("elevator","targetname");
trig=getent("trig_elevator","targetname");
while(1)
{
trig waittill ("trigger");
elevator movez (500,7,1.9,1.9);
elevator waittill ("movedone");
wait(1);
elevator movez (-500,7,1.9,5);
elevator waittill ("movedone");
}
}

thanks
Share |
CodModder
General Member
Since: Aug 15, 2012
Posts: 4
Last: Aug 17, 2012
[view latest posts]
Level 0
Category: CoD2 MP Mapping
Posted: Friday, Aug. 17, 2012 01:54 pm
Hi,

This may not be possible with your current script and trigger set up.
The script you are using is a very basic up and down system which doesn't take into account the elevator's current position.

As far as I can tell, your script would work if the elvator returned to a default starting position everytime but because you want the elvator to stay where it was last sent, it causes confusion and the script eventually loses track of the elevators position resulting in the elevator moving outside of it's scripted path.

What you really need is an intelligent elevator script that is aware of where the elevator is starting from and then keeps track of the elevators position so it can decide where to send the elevator depending on which trigger is activated.

There is such a script around, somewhere but I can't find it at the moment.
I came across it a few days back when looking for ideas for my own elevator system in my map. It is called the intelligent elevator script or something like that and it will do exactly what you want. It may take a little bit of time to figure out how the script works and how to apply it to your map but I'm pretty sure it will do precicely what you're asking.

If I find the script again I'll post the link (if it's allowed here) or I'll PM you with it. Sorry I don't have it to hand but when I found it, I dismissed it since it wasn't what I wanted when I found it.


EDIT:

Here we go, I've found what looks like the script in a tutorial here at modsonline..

http://modsonline.com/Tutorials-read-169.html

THE CODE:

Code:

main() {
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
}

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

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

elevator_move() {
elevatormodel = getent ("elevatormodel", "targetname");
level.elevatorMoving = true;
speed = 2;
height = 192;
wait (1);
if (level.elevatorDown) { // moves to top
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else { // moves to bottom
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1);Â  // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height - (height * 2), speed);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;
} 


If you look through the script, you'll see that it makes use of this Boolean to track where the elevator is..

Code:

level.elevatorDown = true; // elevator starts at bottom: true/false



Hope this points you in the right direction!


Regards,


edited on Aug. 17, 2012 06:58 am by CodModder
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

»