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
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 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 1 of 2 1 2
Fall damage #308278
02/02/10 17:57
02/02/10 17:57
Joined: Dec 2009
Posts: 74
Romania,Bucharest
Ted22 Offline OP
Junior Member
Ted22  Offline OP
Junior Member

Joined: Dec 2009
Posts: 74
Romania,Bucharest
Hello!I would like to know how can i make my character die after he falls a specified time or a specified distance and then colides with someting(my char should take damage when colides with something but also if it falls more than 5 seconds for instance,it dies)...How can i do this?Any examples?
Thanks!

Last edited by Ted22; 02/02/10 18:02.
Re: Fall damage [Re: Ted22] #308352
02/02/10 21:49
02/02/10 21:49
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I'm also interested, how to create simple damage from falling... I tryed many examples, but all of them are too buggy... frown you can find what you need in user contributions...


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Fall damage [Re: 3run] #308430
02/03/10 10:34
02/03/10 10:34
Joined: Dec 2009
Posts: 74
Romania,Bucharest
Ted22 Offline OP
Junior Member
Ted22  Offline OP
Junior Member

Joined: Dec 2009
Posts: 74
Romania,Bucharest
action stair()
{
VECTOR temp;
while (1)
{
c_move (my, vector(0, 0, -5 * time_step), nullvector, GLIDE);
player = me;
camera.x = player.x - 100 * cos(player.pan);

camera.y = player.y - 100 * sin(player.pan);

camera.pan = player.pan; // the camera and the player have the same pan angle

camera.z = player.z + 70; // place the camera above the player, play with this value

camera.tilt = -25;
vec_set(temp, my.x);
temp.z -= 5; // trace downwards 500 quants below
c_trace (my.x,temp,IGNORE_ME);
if(c_trace == 0)
fall = 1;
if(c_trace >= 0)
fall = 5;
wait(1);
}
}

What is wrong hereeeeeeeeeeeeee????I got just an entity in my level but fall = 5(c_trace detected something)

Re: Fall damage [Re: Ted22] #308437
02/03/10 10:54
02/03/10 10:54
Joined: Mar 2007
Posts: 112
MikeS Offline
Member
MikeS  Offline
Member

Joined: Mar 2007
Posts: 112
what happens with your entity? does it fall, does it not fall?

Re: Fall damage [Re: MikeS] #308439
02/03/10 10:55
02/03/10 10:55
Joined: Dec 2009
Posts: 74
Romania,Bucharest
Ted22 Offline OP
Junior Member
Ted22  Offline OP
Junior Member

Joined: Dec 2009
Posts: 74
Romania,Bucharest
yes,it falls
c_move (my, vector(0, 0, -5 * time_step), nullvector, GLIDE);

Re: Fall damage [Re: Ted22] #308445
02/03/10 10:59
02/03/10 10:59
Joined: Mar 2007
Posts: 112
MikeS Offline
Member
MikeS  Offline
Member

Joined: Mar 2007
Posts: 112
and where is your Problem?

Bzw. Wo liegt denn genau dein Problem?

Last edited by MikeS; 02/03/10 10:59.
Re: Fall damage [Re: MikeS] #308446
02/03/10 11:03
02/03/10 11:03
Joined: Dec 2009
Posts: 74
Romania,Bucharest
Ted22 Offline OP
Junior Member
Ted22  Offline OP
Junior Member

Joined: Dec 2009
Posts: 74
Romania,Bucharest
The c_trace detects something but it is no other model or sprite or terain etc.

Re: Fall damage [Re: Ted22] #308466
02/03/10 11:48
02/03/10 11:48
Joined: Mar 2007
Posts: 112
MikeS Offline
Member
MikeS  Offline
Member

Joined: Mar 2007
Posts: 112
ah, ok, i think your problem is this line:

if(c_trace >= 0) //if c trace hits something ( ctrace > 5) or ctrace hits nothing (ctrace = 0)

so, if there is nothing under the model, ctrace will always return a 0, and your fall damage will always be 5.

try it with

if(c_trace > 0)

Re: Fall damage [Re: MikeS] #308467
02/03/10 11:53
02/03/10 11:53
Joined: Dec 2009
Posts: 74
Romania,Bucharest
Ted22 Offline OP
Junior Member
Ted22  Offline OP
Junior Member

Joined: Dec 2009
Posts: 74
Romania,Bucharest
lol,unbelivele newbie mistake...Yes,now works!Thanks

Re: Fall damage [Re: Ted22] #308484
02/03/10 13:00
02/03/10 13:00
Joined: Dec 2009
Posts: 74
Romania,Bucharest
Ted22 Offline OP
Junior Member
Ted22  Offline OP
Junior Member

Joined: Dec 2009
Posts: 74
Romania,Bucharest
i managed to make a code:

var life = 100;
var life2 = life;
var fall = 0;
var life_for_fall = 100;
var fall_prec = 1;
ENTITY* stair;

PANEL* pDisplayy =
{
pos_x = 10;
pos_y = 20;
digits (10, 10, 5, *, 1, fall);
flags = VISIBLE;
}

PANEL* pDisplayyy =
{
pos_x = 10;
pos_y = 40;
digits (10, 10, 5, *, 1, life_for_fall);
flags = VISIBLE;
}

PANEL* pDisplay =
{
pos_x = 10;
pos_y = 30;
digits (10, 10, 5, *, 1, life);
flags = VISIBLE;
}

function main()
{
video_mode = 7;
level_load ("work.wmb");
fps_max = 150;
wait (2); // wait until the level is loaded
}

action stair()
{
VECTOR temp;
while (1)
{
c_move (my, vector(0, 0, -25 * time_step), nullvector, GLIDE);
player = me;
camera.x = player.x - 100 * cos(player.pan);

camera.y = player.y - 100 * sin(player.pan);

camera.pan = player.pan; // the camera and the player have the same pan angle

camera.z = player.z + 70; // place the camera above the player, play with this value

camera.tilt = -25;
vec_set(temp, my.x);
temp.z -= 5; // trace downwards 500 quants below
c_trace (my.x,temp,IGNORE_ME);
if(c_trace (my.x,temp,IGNORE_ME) == 0)
fall += fall_prec * time_step;
if(c_trace(my.x,temp,IGNORE_ME) > 0)
fall = 0;
if (fall > 100)
life = 0;
if (fall += fall_prec * time_step)
life_for_fall -= 1 * time_step;
if (c_trace(my.x,temp,IGNORE_ME) > 0)
life = life2 - life_for_fall;
if (c_trace(my.x,temp,IGNORE_ME) > 0)
fall_prec = 0;
if (life < 0)
life = 0;
wait(1);
}
}

tested and works fine but i'm not sure if it is very logical...so the ideea is:If it falls more than 100 metters it dies...if it falls a metter life -= 1

Last edited by Ted22; 02/03/10 13:06.
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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