Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 12,420 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Multi-Stage-Elevator [Re: Inestical] #63918
02/16/06 22:34
02/16/06 22:34
Joined: Mar 2005
Posts: 725
USA
TeutonicDarkness Offline OP
User
TeutonicDarkness  Offline OP
User

Joined: Mar 2005
Posts: 725
USA
Quote:

well.. I got idea that would work or then not. make blocks top of the floor, passable if not the floor selected. that works if going up.

at going down, put the block as the floor, passable if going up or not the floor.

much code? nope, readable? yes, fps? low.




Have no idea what you mean about making blocks
top of floor passable?

The script is designed to work with A tunnel cut out
going from top to bottom through all 6 stages.

Then use your cutting block... scale down
its .z values and use it as your elevator.

There is not need at all to set up passable blocks ...
Your elevator will travel up and down the shaft/tunnel
just fine.



*** Teutonic Darkness ***

Re: Multi-Stage-Elevator [Re: ] #63919
02/16/06 22:53
02/16/06 22:53
Joined: Mar 2005
Posts: 725
USA
TeutonicDarkness Offline OP
User
TeutonicDarkness  Offline OP
User

Joined: Mar 2005
Posts: 725
USA
Quote:


The "problem" with time is, that you multiply you distances with a varying value (depending at the framerate) and you will never get the exact stoppoint (e.g obj.y=1200, but obj.y=1200.04). So you have to stop at the position, the lift is higher/lower your stop-position (depending of the direction).




Yes thats why I added this line:
if (elevator_pnt.z >= 3169.667) {elevator_pnt.z =3169.667
as before that it would go right through the
roof and keep going..


Quote:


The most important thing why you have to use time*speed_constant is: on you pc it looks cool - on an other the elevator maybe needs 10 times longer or 30 timer less time.




Yes ... I perfectly understand how it would
be benificial to implement.

Just don't think I'm going to be advanced enough
to figure this one out!


By all means if anyone wants to take and enhance
I'm all for it!

I have done all that is in "My knowledge" to do.
Exect make add sounds and Have positions Settable in skills.

I think a lot would probally appreciate it more if all
they had to change was
The skill for each stage



*** Teutonic Darkness ***

Re: Multi-Stage-Elevator [Re: ] #63920
02/16/06 23:52
02/16/06 23:52
Joined: Mar 2005
Posts: 725
USA
TeutonicDarkness Offline OP
User
TeutonicDarkness  Offline OP
User

Joined: Mar 2005
Posts: 725
USA

I looked over your code really good... I'm sure it would work fine.
Just wont do what mine is intended to do?

I assume this is more of a tourist elevator?
just stopping ocasionally....?

Quote:

define _destination, skill20;




where are all the destinations for the other floors?
you only have 1? Or maybe I missed something.

Quote:

var gc_elestop[5] = 0, 200, 400, 600, 800;




I'm not sure how exactly your implementing this
I know its for the stop pints but I just don't
understand how your using it?

I'm guessing you just have 1 destination stop
but several frquent stops on the way?

On another note...
I tried using "time" pretty much the same
Quote:

my._destination



except figuring that factor in
unless you count elevator_pnt.z as the
equuilivalent to my._destination?

Also I'm trying to make compatible with A5 as I still use
it often. I don't think:
Quote:

time*speed_constant



is an A5 feature though there are some similar I beleive that
I might be able to substitute. Just wanted it to
be more Universal

I do thank you for all your input!

Maybe if I can scan through your code here I can
find a better way to implement my own "button contolled"
elevator.



*** Teutonic Darkness ***

Re: Multi-Stage-Elevator [Re: TeutonicDarkness] #63921
02/17/06 08:55
02/17/06 08:55

A
Anonymous
Unregistered
Anonymous
Unregistered
A



...

you have 5 stop-positions (can be varied).
var gc_elestop[5] = 0, 200, 400, 600, 800;

The Property ._destination is set to the wanted destination and the moving is activated by setting the flag ._moving=on.

You want to level 3? ent_elevator._destination=3;ent_elevator._moving=on;

time: use time to have a universal gamplay (meening of time).
time*speed_constant is a factor and will just vary the speed of the animation. (Warks also with A5).

mercuryus

Re: Multi-Stage-Elevator [Re: ] #63922
02/17/06 20:20
02/17/06 20:20
Joined: Mar 2005
Posts: 725
USA
TeutonicDarkness Offline OP
User
TeutonicDarkness  Offline OP
User

Joined: Mar 2005
Posts: 725
USA
Quote:

...

you have 5 stop-positions (can be varied).
var gc_elestop[5] = 0, 200, 400, 600, 800;

The Property ._destination is set to the wanted destination and the moving is activated by setting the flag ._moving=on.

You want to level 3? ent_elevator._destination=3;ent_elevator._moving=on;

time: use time to have a universal gamplay (meening of time).
time*speed_constant is a factor and will just vary the speed of the animation. (Warks also with A5).

mercuryus




Ok I'm unstanding "your" code a little better now...

However I still dont understand this:

Quote:

// direction (up or down?) my._direction=1-2*(my.z>gc_elestop[my._destination]); // go up if not my.z>my._destination (over the dest.point)




Were did you make a function/instruction for "direction"?

I see at the top you have:
Quote:

[define _direction, skill21;



However I can't see anywhere in your code where you
tell the engine what direction Does?

Also on another note:

Quote:

ent_elevator._destination=0



Dosn't this somehow need to be reset when you reach the
destination?

For example If my New Destination is 2.
Wont The Script still be calling from Destination 0?
I havn't seen where your resetting it...

Perhaps You should start with a Destination of 1
So you can call 0 (which would do nothing)
when it reaches "Each destination".



I'm sure you have proabally figured in somehow the
re-setting of destination ..

I'm just trying to understand so I can better
implement things.



*** Teutonic Darkness ***

Re: Multi-Stage-Elevator [Re: TeutonicDarkness] #63923
02/18/06 09:55
02/18/06 09:55

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Hi!

Here's some little description:

my._direction=1-2*(my.z>gc_elestop[my._destination]); // go up if not my.z>my._destination (over the dest.point)
ok - this part is havy to understand.
rule no.1 in programming fast code is to use methematic!

At the beginning our evelator (ele) has a arbitrary z-position.
Triggert by an event (in my case the 1-,2-,3-,4-,5-key) i tell the ele his destination(-index of the stop-position-array) and tell him also to move on (_moving=on).

In the action you can see that ele is waiting until _moving==on. (//wait for activating)
Now he calculates the direction he needs to move:
(read the line from behind to the beginning!)

1. gc_elestop[my._destination], this is one of the stop-positions declared at the top. An array always begins with index 0, so the first value is gc_elestop[0], the second gc_elestop[1], a.s.o...
(example: let say ele has the z-pos 0 and _desination is 3 -> gc_elestop[my._destination] = 600)

2. (my.z>gc_elestop[my._destination]), is a logical comparison like "if my.z>gc_elestop[my._destination]" and has 0 (off) or 1 (on) as result, what we can use for calculation!
(example: my.z>gc_elestop[my._destination] -> 0 > 600 = 0)

3. 1-2*(my.z>gc_elestop[my._destination]), (multiplication comes bevor substraction): I want have 1 if the ele should go up, and -1 to move down.
take the 1: this means go up
take the -2*(my.z>gc_elestop[my._destination]: this means substract 2 times the result of the comparison. (2 times to get not 0 as the total result but -1)
(example: 1-2*(0>600) = 1-2*(0) = 1)
(example it ele is upper the destination: 1-2*(800>600) = 1-2*(1) = -1)

So we have the direction.

What does _direction?

Look at line my.z+=time*gc_ele_speed*my._direction
It means: move ele (at the z-axis) in the _direction multiplied my time and speed_constant. (of cause there is NO collision-detection.)

Where to stop?
In the loop where the ele moves we constanly ask if the ele has passed the actual stop-position depending of his both possible directions.
If he has passed (after the loop), we set the exact position and stop the ele (_moving=off), so he will wait again until _moving=on is set (by a trigger).

hope I could help?

mercuryus

Re: Multi-Stage-Elevator [Re: ] #63924
02/19/06 22:58
02/19/06 22:58
Joined: Mar 2005
Posts: 725
USA
TeutonicDarkness Offline OP
User
TeutonicDarkness  Offline OP
User

Joined: Mar 2005
Posts: 725
USA
Thanks,

Really appreciate the breakdown of everything!
I actually began messing around with trying this after
studying it real closely.

I came across a major problem when you actually
reach the destination though!

Apparantly when you reach the destination
The
Quote:

ent_elevator._moving==on



Is not being set to off...

So a a result it does nothing and will only sit there and
Shake real funny.

I'm sure this is a easy fix... and
I'm going to look into it
Probally just need to add ent_elevator._moving==off.

just letting you know!




*** Teutonic Darkness ***

Re: Multi-Stage-Elevator [Re: ] #63925
08/23/06 21:24
08/23/06 21:24
Joined: Nov 2005
Posts: 149
Vienna, Austria
E
Edgecrusher Offline
Member
Edgecrusher  Offline
Member
E

Joined: Nov 2005
Posts: 149
Vienna, Austria
Hi mercuryus, I've found a little bug. I assigned the elevator action from your script to my entity ( mdl ), everything works, I adjusted the numbers in the array, it can also travel from level to level, BUT when i stand on it and press for example, the 2, it goes up, but passes right through the player. Ive checkmarked the polygon flag in the main options, not in the script, tried with only checking Bbox, and tried adding my.polygon = on in the script, nothing happens, the same with the line my.passable = off, and I recompiled the level after each time. Please help.


A6 Commercial A7 Commercial
Re: Multi-Stage-Elevator [Re: Edgecrusher] #63926
08/24/06 08:54
08/24/06 08:54

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Hi Edgecrusher!

The elevator-script only handles the entity (mdl/mapentity) of the elevator-platform, not the addicted objects.
If you want to move an object (e.g. the player) with the elevator you have to handle this separate.

There are many solutions for doing this, depending on the way you move your player. A simple way to move the player addicted from other objects is to use forces and the absolute vector of c_move(....

Here you can see one idea of moving the player with the elevator. The elevator-script is modified to use and share z-forces. At the end there is a draft how to implement the forces to your player-script.

have fun, mercuryus

Re: Multi-Stage-Elevator [Re: ] #336721
08/05/10 20:27
08/05/10 20:27
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Hi, mercuryus can you upload that .txt file again, please? I'm looking for good way to make an elevator. Thank you.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Page 2 of 3 1 2 3

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1