0 registered members (),
1,459
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Falling Damage
[Re: txesmi]
#456968
12/17/15 11:22
12/17/15 11:22
|
Joined: Jan 2006
Posts: 968
EpsiloN
User
|
User
Joined: Jan 2006
Posts: 968
|
Gravity This one looks very good, but I have not used it yet. I think Superku wrote it. Listen, long posts wont help Drop the code you're using and start from scratch, if you cant understand what you're using. in your player, add a gravityMove function and in that function perform a c_trace as described in Superku's tutorial, check the distance and c_move down if needed. When you get to this simplest form, you can start building a method for counting time passed or distance or speed of falling...
Last edited by EpsiloN; 12/17/15 11:33.
|
|
|
Re: Falling Damage
[Re: EpsiloN]
#456969
12/17/15 11:38
12/17/15 11:38
|
Joined: Jun 2007
Posts: 1,337 Hiporope and its pain
txesmi
Serious User
|
Serious User
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
|
As for your my.z = NULL problem, I don't think my.z will become NULL while your entity is still existing, or maybe its the same if its 0, I haven't checked. But, I'd suggest never test position for NULL. I am pretty sure the execution of 'DEBUG_VAR ( my.z, ... )' is conditioned by 'if ( c_trace(...) > 0 )'... edited:
Last edited by txesmi; 12/17/15 11:39.
|
|
|
Re: Falling Damage
[Re: txesmi]
#456974
12/17/15 18:45
12/17/15 18:45
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
Okay, so when I put this code in my program:
action player_code()
{
...
if(my.z != NULL)
{
beep();
}
...
}
The game beeps like crazy while the player's feet are are the ground. If I press the space bar making the player jump in the air, or if the player steps off a ledge and falls in mid-air, the beeping sound stops taking place, until the player's feet land back on the ground. So, I would think that this would lead me to believe that my.z must equal NULL while the player is jumping or falling in mid-air. However, when I put this code in the above code's place:
action player_code()
{
...
if(my.z == NULL)
{
beep();
}
...
}
...no beeping takes place at all, whether the player's feet are on the ground, the player is jumping, or the player is falling in mid-air. So, this seems to indicate that the player's my.z is not equal to NULL while the player is jumping or falling in mid-air. If the player's my.z is not equal to NULL, I would think that the game would have been beeping like crazy in all the instances for the first scenario above, and not temporarily stopped while the player was jumping or falling in mid-air. I am sure hopefully someone has run into this kind of anomaly?
|
|
|
Re: Falling Damage
[Re: EpsiloN]
#456975
12/17/15 18:50
12/17/15 18:50
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
Gravity This one looks very good, but I have not used it yet. I think Superku wrote it. Listen, long posts wont help Drop the code you're using and start from scratch, if you cant understand what you're using. in your player, add a gravityMove function and in that function perform a c_trace as described in Superku's tutorial, check the distance and c_move down if needed. When you get to this simplest form, you can start building a method for counting time passed or distance or speed of falling... Thank you Epsilon. I will check your link out. Thanks again.
Last edited by Ruben; 12/17/15 18:52.
|
|
|
Re: Falling Damage
[Re: Ruben]
#456976
12/17/15 18:51
12/17/15 18:51
|
Joined: Feb 2012
Posts: 371
Dico
Senior Member
|
Senior Member
Joined: Feb 2012
Posts: 371
|
man what is the relation between damage and if(my.z == NULL) !!! my.z == 0 , you just know if the model is in origin z or not , this can't help you if you have a terrain or a map that have stairs ...
Last edited by Dico; 12/17/15 18:52.
|
|
|
Re: Falling Damage
[Re: Dico]
#456977
12/17/15 18:55
12/17/15 18:55
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
man what is the relation between damage and if(my.z == NULL) !!! my.z == 0 , you just know if the model is in origin z or not , this can't help you if you have a terrain or a map that have stairs ... If I knew that my.z = NULL, perhaps I can run a timer while this is true. Then depending on how much time it was, this will tell me how much damage to inflict on the player. That is why it seems like it might be helpful to know if my.z equals NULL or not. As far as the my.z value on stairs, I do see a my.z value in DEBUG_VAR() that quickly decrements as the player runs down the stairs. When the player runs off the side ledge of the stairs and falls in mid-air toward the bottom, the my.z value in DEBUG_VAR() disappears completely, until the player lands on the ground, to where I see a much lower my.z value in DEBUG_VAR().
Last edited by Ruben; 12/17/15 19:00.
|
|
|
Re: Falling Damage
[Re: Dico]
#456981
12/17/15 19:52
12/17/15 19:52
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
Okay, this is really weird. On another part of my program, I have a debugger z value on a panel, and it shows the player's z value at all times, even while it is in mid-air:
...
var player_z;
...
PANEL* pDisplay =
{
...
digits (180, 64, 5, *, 1, player_z); // DEBUGGER: POSITION COORDINATES
...
flags = SHOW;
}
function player_loc()
{
...
player_z = my.z;
...
}
For the DEBUG_VAR() debugger:
action player_code()
{
...
DEBUG_VAR(my.z, 300);
...
}
or
action player_code()
{
...
DEBUG_VAR(player_z, 300);
...
}
...the z value only shows up while the player is on the ground, and totally disappears while the player is in mid-air.
|
|
|
Re: Falling Damage
[Re: Ruben]
#456982
12/17/15 19:56
12/17/15 19:56
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
I am trying to make it so that if the player falls vertically a certain distance, the player will take damage to its health. So far, this is the code that causes the player to fall with gravity:
action player_code()
{
...
dtimer();
if(c_trace(my.x, vector(my.x, my.y, my.z - my.FEET_HEIGHT),
IGNORE_ME | IGNORE_PASSABLE | IGNORE_PASSENTS |
USE_POLYGON))
{
time_elapsed = dtimer();
my.z = target.z + (my.FEET_HEIGHT);
DEBUG_VAR(my.z, 150);
DEBUG_VAR(time_elapsed, 200);
gravity_var = 0;
jumplck = 0;
if(time_elapsed >= 20)
{
beep();
}
}
...
}
I am assuming that I would use the dtimer() function somehow, in that if the player falls within a certain amount of time, the player will take a certain amount of damage? Right now, I am trying to get the program to beep() while the player is falling in mid-air, and run the dtimer() during that period of falling. No beeping is occurring while the player falls in mid-air, with the above code. Does anyone know how I can measure how long the player falls? I notice that the time_elapsed and my.z values using the DEBUG_VAR() function above disappear to nothing (no value visible) while the player falls in mid-air. These values only show up when the player is walking on the ground without falling. Does anyone have an idea on how to make the player take damage while falling? I am trying different methods, but none seem to be working. Any help would be appreciated. Thank you. if you look at your code ruben , the condition under which you display the z value ,falls under the condition that the player is on the ground ,therefore it will only show when on the ground ...
Compulsive compiler
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|