Page 1 of 1
Elevators
Posted: Fri Aug 12, 2011 2:57 pm
by Nobandwidth25
I'm trying to design an elevator for a map, and I'm about to set the animations (I need help with that, but that's a whole nother thread), and I've got two areas loaded with questions.
1.) Setting-up animations. All the elevators I've seen are running on an around the clock animation... is that the only way to get one that works, or can you have one that requires you to access a panel and call it to your floor like in real life? I'm thinking that could cause a problem if somebody on another floor ALSO uses a switch, so would there be a mechanism to make it ignore the second switch, etc?
2.) I try to add AI planning, will my AI be able to use it, or will they just act dumb and walk into the elevator shaft, getting trapped underneath/falling to their deaths? The only remedy I can think of is like having animated doors that only open when the elevator is present (Either by timer or sensor), but that still begs the question of whether the AI will realize what happened when it reaches the next floor, or whether it will only recognize a 2-D planning structure on its map.
Anybody have any idea of how to get a fully-operational AI-friendly elevator going? If it's been done, I haven't seen it, so I'm wondering if it's even possible.
Re: Elevators
Posted: Fri Aug 12, 2011 7:17 pm
by fiddler_on_the_roof
2. I believe that AI have problems with multiple levels of pathing and will get confused, so it is unlikely that AI could use it.
As to 1, you could do a bunch of "OnEnterRegion" or a OnDamage to get it to your floor, though I'd suggest having it return to a set position always so there are no anim problems. though don't ask me how to do it extactly, I have almost no clue.

Re: Elevators
Posted: Fri Aug 12, 2011 7:39 pm
by yuke5
Re: Elevators
Posted: Fri Aug 12, 2011 8:29 pm
by Noobasaurus
I totally remember that!

Re: Elevators
Posted: Fri Aug 12, 2011 8:57 pm
by Fiodis
Nobandwidth25 wrote:it will only recognize a 2-D planning structure on its map.
This will happen no matter what you do. That said, you can have multiple levels, in a way, if you do something clever with the transition between levels. One of the best examples of this, imho, is Jaspo's
Star Destroyer map. I would recommend you play through that, if you haven't already, to get a sense of how functional multi-level maps in BF2 work best.
You'll notice there are no elevators in that map. Reason probably being that elevators make the pathing very much harder than it already is. With spiral stairs and the like you don't have to worry about closed doors or open, bottomless shafts.
Re: Elevators
Posted: Fri Aug 12, 2011 10:26 pm
by Nobandwidth25
I think I might have a solution.
So could I remedy the solution by placing two planning hubs directly over one another at the different levels? So the AI would head to the first hub, then once it was at the top, it would go to the second hub and follow the path? An example
Hub 1 @ coordinates (0,0,0)
Hub 2 @ (5,0,0) [Moving over 5 units to the inside of the elevator]
Hub 3 @ (5,10,0) [At the top of the elevator's path]
Hub 4 @ (5,10,5) [Outside of the elevator and moving around again on the second floor]
If I set the elevator animation on a timer so it does somehting like 2 seconds on the top floor, 6 in transition, then 2 on the bottom, 6 in transition, etc. and trigger the doors to only be open during those 2 seconds, that could prevent the AI from entering the shaft before the elevator was on the floor, right?
I'm still trying to figure-out animations, I just need to know if it's an avenue worth exploring or if an elevator is just impossible for AI to use effectively. It's fine if they can't, but I'd have to re-work my map, and conquest mode would pretty-much become restricted to one floor.
Re: Elevators
Posted: Fri Aug 12, 2011 10:55 pm
by yuke5
It'd have to be timed RIDICULOUSLY well. I suppose it is possible, but it might also involve some barrier work, etc. What you might want to consider are portals/teleporters.
Re: Elevators
Posted: Sat Aug 13, 2011 9:41 am
by Fiodis
Nobandwidth25 wrote:So could I remedy the solution by placing two planning hubs directly over one another at the different levels?
Fiodis wrote:Nobandwidth25 wrote:it will only recognize a 2-D planning structure on its map.
This will happen no matter what you do.
Placing one hub directly "over" another will just make the AI think there's two hubs in the same exact spot. Hubs are 2-D. The "height" parameter is just a pretty little thing in ZE to help you visualize it and has no effect in-game.
Re: Elevators
Posted: Sat Aug 13, 2011 7:00 pm
by Nobandwidth25
So if the maps are 2-d, couldn't I arrange for the elevator doors on the top floor to face the opposite way?
Hub 1 @ coordinates (0,0,0)
Hub 2 @ (5,0,0) [Moving over 5 units to the inside of the elevator]
Hub 3 @ (10,10,5)
So if the elevator was at coordinates (5,0,0), the AI would go inside, then when trying to get to hub 3, it would run into the wall. Then once the elevator took-off, it would be stuck up against the wall until it reached the top and the top floor's doors opened, at which point its path would be unblocked and it could continue to hub 3. Does this setup seem plausible?
Re: Elevators
Posted: Sun Aug 14, 2011 1:46 am
by yuke5
A lot of people have tried making elevators before, not many have succeeded. But, your ideas does sound plausible, I'd make a test map first, and see if it works then apply it to whatever main map you're making if it works well. Good luck!

Re: Elevators
Posted: Sun Aug 14, 2011 9:50 am
by Fiodis
Nobandwidth25 wrote:So if the maps are 2-d, couldn't I arrange for the elevator doors on the top floor to face the opposite way?
Hub 1 @ coordinates (0,0,0)
Hub 2 @ (5,0,0) [Moving over 5 units to the inside of the elevator]
Hub 3 @ (10,10,5)
So if the elevator was at coordinates (5,0,0), the AI would go inside, then when trying to get to hub 3, it would run into the wall. Then once the elevator took-off, it would be stuck up against the wall until it reached the top and the top floor's doors opened, at which point its path would be unblocked and it could continue to hub 3. Does this setup seem plausible?
That would work. You would have to block off the bottom elevator entrance when the elevator's at the top.
Oh, and if you're going to represent hubs with coordinates, use only two numbers, not three - "x and z, that's all the AI see".

Re: Elevators
Posted: Sun Aug 14, 2011 8:44 pm
by [RDH]Zerted
Nobandwidth25 wrote:it would be stuck up against the wall until it reached the top and the top floor's doors opened
You need to be careful pushing units around. If the wall moves too fast, the units will fall through it. Look at the 'cannon' on the elevator example map to see how fast you can push someone. I wouldn't recommend having something faster than that.
Elevators are easiest do to as teleporters. When the door closes, teleport the player to the destination and open those doors.
Using an access panel means the AI won't use it. The panel can work, but it's a bit more scripting than using regions.
A good way to prevent units from falling into the elevator pit is having the elevator car be a complete pillar except for the car section. This would keep units from entering the shaft unless the car was at their floor.
Re: Elevators
Posted: Mon Aug 15, 2011 3:37 am
by THEWULFMAN
My idea involved freezing the AI when they get in, and unfreeze them at the top of the evelvator. Hoping they planning takes them the rest of the way.
But like Zerted said, just teleporting them would be easier.