Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Gravity Script #72061
04/24/06 21:30
04/24/06 21:30
Joined: Jan 2006
Posts: 968
EpsiloN Offline OP
User
EpsiloN  Offline OP
User

Joined: Jan 2006
Posts: 968
Add the script before ent (or c) _move if you want to prevent your entity from walking in the air.
Falling & Falltime ... to know when the entity is falling. (Player or whatever)
In "my.health -= falltime * 10" you could change health to your skill for the entity health and 10 to the multiply factor...10 because when testing in game without multiplying for 1500 quants it took only 20 health wich for my entity seemed too high to survive...so I changed it to 10 and the player died.
Also , I used falling to identify when the player is falling so he wont be able to 'walk' in the air I suggest you use it that way too.
Hope you can use it. Jumping wont be hard to add...

Code:

function gravity()
{
var trace1[3];
var trace2[3];
vec_set(trace1,my.x);
trace1.z -= 28;
vec_set(trace2,my.x);
trace2.z -= 5000;
trace_mode = ignore_me + ignore_passable + glide;
result = trace(trace1,trace2);
if(result > 10)
{
falling = 1;
falltime += 0.1;
my.z -= 10 + (falltime / 10) * time;
goto(end);
}
if(result < 0)
{
my.z += 20 * time;
}
my.health -= falltime * 10;
falltime = 0;
falling = 0;
end:
}




Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Gravity Script [Re: EpsiloN] #72062
04/24/06 21:42
04/24/06 21:42
Joined: Dec 2000
Posts: 4,608
mk_1 Offline

Expert
mk_1  Offline

Expert

Joined: Dec 2000
Posts: 4,608
better use "return();", not a goto mark. This is old language style.


Follow me on twitter
Re: Gravity Script [Re: mk_1] #72063
04/24/06 22:11
04/24/06 22:11
Joined: Feb 2006
Posts: 371
New England
Rad_Daddy Offline
Senior Member
Rad_Daddy  Offline
Senior Member

Joined: Feb 2006
Posts: 371
New England
this is nice, up until now, I have been using cheesey gravity (player.z decresses as long as a button is pushed ). This is mostly becaues I havent taken the time to write my movement code properly. But now I can modify this for use. Thanks a lot.


"Read not to contradict and confute, nor to find talk and discourse, but to weigh and consider." Sir Francis Bacon www.deckscapedesign.com
Re: Gravity Script [Re: EpsiloN] #72064
04/25/06 11:04
04/25/06 11:04
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
A usefull script if you ask me
but( there 's allways a but isn't it )
if my interpretation is right ofcoure,
in your script you're saying that when the player
falls from a stair, the player should lose life but
this would be bad if the player stands on the
first step of the stair, and when you fall off it, the height would
be that minimum because it's just the first step of the stair, the life
decreasement should be 0.
but I could be wrong ofcourse


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: Gravity Script [Re: frazzle] #72065
04/25/06 17:25
04/25/06 17:25
Joined: Jan 2006
Posts: 968
EpsiloN Offline OP
User
EpsiloN  Offline OP
User

Joined: Jan 2006
Posts: 968
mk_1 , dunno if thats old code or not but I think both work fine in this case so it doesnt matter realy wich is used atleast for me...

Rad_Daddy , you mean player.z decreases only if you pressed a movement key ?

frazzle , I'm not shure if I understanded you
If the player moves down on a stairs he will lose life,is this what you ment? I fixed this , I improved the script because I needed much more realistic gravity In my new script if you fall from 2-3 meters it wont decrease your health , also I just improved the movement up on slopes because it was 'bumpy'...
But I will let you improve the script for yourself because I will give away my entire project if I continue to contribute you will understand...I hope.
In a few days maby I will post my database script (for inventory & stuff like that...) , all in C-Script , no dlls needed , but...the word 'maby' I dunno , if I'm in a good mood.
Cya later all.

PS: If you find anything buggy in this script please post it so to be fixed. Still havent tested it if the entity is in a block in theory it should move it up but , dunno...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Gravity Script [Re: EpsiloN] #72066
04/25/06 18:13
04/25/06 18:13
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
Thxn for the further explenation EpsiloN
Well the script that you posted on your first post
isn't the code when the player falls form 2-3 meters high ,
the player doens't loses life, or am I wrong again

I'm curious to your other scripts you'll gonna post on this topic !!
If the scripts are as good as the gravity scripts you posted out on this
topic, ... you get the point

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: Gravity Script [Re: frazzle] #72067
04/25/06 19:07
04/25/06 19:07
Joined: Jan 2006
Posts: 968
EpsiloN Offline OP
User
EpsiloN  Offline OP
User

Joined: Jan 2006
Posts: 968
No in this script that I posted the player looses health even if he falls from the 'edge of his carpet' if he falls from higher than 10 quants he will lose health...but it wont be always visible because some times he will lose 0.1 for example and you wont see it...The script that I mentioned is the same that I posted but improved. Its almost doubled in lines

Quote:

I'm curious to your other scripts you'll gonna post on this topic !!
If the scripts are as good as the gravity scripts you posted out on this
topic, ... you get the point




I will post another script for reading from a file maby even create a plugin for mIRC to write in this file...(mIRC because I know the language and it has a great text editing functions...) the data base files will be arranged Diablo II style... or Excel ... And I dunno if this gravity script is good because its my first try to make a gravity , and I think that the database reading is very easy once you understand how to use str_ instructions the harder part is to get them into an inventory. Ok , going off-line now because I've got a lot of scripting to do. See you in another post in a few hours/days


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Gravity Script [Re: EpsiloN] #72068
04/25/06 20:29
04/25/06 20:29
Joined: Jan 2006
Posts: 968
EpsiloN Offline OP
User
EpsiloN  Offline OP
User

Joined: Jan 2006
Posts: 968
I've decided to post the improved script I wont explain what is what and for what is it. Its not hard to understand and it should be easy to add to your own scripts. Posting it here to keep the old script if someone wants to use it.
Here it is :
Code:

function gravity()
{
while(1)
{
var trace1[3];
var trace2[3];
vec_set(trace1,my.x);
trace1.z -= 28;
vec_set(trace2,my.x);
trace2.z -= 5000;
trace_mode = ignore_me + ignore_passable + glide;
result = trace(trace1,trace2);
if(result >= 30)
{
if(falltime > 0.6) { falling = 1; }
falltime += 0.1;
my.z -= (6 + (falltime / 10) * time);
goto(end);
}
if(result > 10 && result < 30)
{
my.z -= 5 * time;
}
if(result <= 0)
{
my.z += 10 * time;
}
if(falltime > 1)
{
my.health -= falltime * 4;
}
falltime = 0;
falling = 0;
end:
wait(1);
}
}


I wont improve it any more and wont add jumping because I dont need jumping. Its exactly as I wanned it , so I'm leaving it to all of you to improve it. See you later all.


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Gravity Script [Re: EpsiloN] #306961
01/26/10 06:15
01/26/10 06:15
Joined: May 2009
Posts: 5,365
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,365
Caucasus
Please, can you add a damage sound? And, why player loses health when he is in air? Before he reach the ground... Is there any way to make him get damaged only after he get on ground, and play damage sound?

Last edited by 3run; 01/26/10 06:17.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Gravity Script [Re: 3run] #306972
01/26/10 10:47
01/26/10 10:47
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Decrease the value of result, and place a 'snd_play([insert the needed things for playing a sound file here]);' after 'my.health -= falltime * 4;':

Page 1 of 2 1 2

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | 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