Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Petra, AndrewAMD, VoroneTZ, 2 invisible), 822 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 4 1 2 3 4
Re: Falling Damage [Re: txesmi] #456968
12/17/15 11:22
12/17/15 11:22
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
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 laugh

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.

Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
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 Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Originally Posted By: EpsiloN
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: crazy

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 Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Okay, so when I put this code in my program:

Code:
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:

Code:
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 Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Originally Posted By: EpsiloN
Gravity
This one looks very good, but I have not used it yet. I think Superku wrote it.

Listen, long posts wont help laugh

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 Offline
Senior Member
Dico  Offline
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 Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Originally Posted By: Dico
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: Ruben] #456978
12/17/15 19:00
12/17/15 19:00
Joined: Feb 2012
Posts: 371
Dico Offline
Senior Member
Dico  Offline
Senior Member

Joined: Feb 2012
Posts: 371
if you can send to me image that show me your level i will tell you if that work for you or not and i will understand too what you want to do exactly.

Re: Falling Damage [Re: Dico] #456981
12/17/15 19:52
12/17/15 19:52
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline 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:

Code:
...

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:

Code:
action player_code()
{
   ...

   DEBUG_VAR(my.z, 300);

   ...
}


or
Code:
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
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
Originally Posted By: Ruben
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:

Code:
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
Re: Falling Damage [Re: Wjbender] #456983
12/17/15 20:04
12/17/15 20:04
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Thank you Wjbender! I placed the DEBUG_VAR(my.z, 150) before the c_trace, and now the z value is showing at all times! Wow, I feel embarrassed. :-)

Page 2 of 4 1 2 3 4

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