Duke4.net Forums: Breaking stuff when you fall on them - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Breaking stuff when you fall on them

User is offline   Maisth 

#1

Hi, is this possible to do in Duke3D?

An example:

When the player falls into a Vent, i want the Vent to Break once the Player falls onto it
0

User is offline   Zaxtor 

#2

There could be a trick to make it work.

I Never tried it but I believe it should work.

When player impact when he falls he make sound of boots hitting ground when you fall from a certain height.


Let say
-----------
useractor notenemy BREAKABLE_VENT

getactor[THISACTOR].sectnum temp
getplayer[THISACTOR].cursectnum temp2
ifvarvare temp temp2
{
ifpdistl 700
{
ifsound DUKE_LAND
{
sound VENT_BUST
debris SCRAP1 3
debris SCRAP2 2
killit
}
}
}
ifhitweapon
{
sound VENT_BUST
debris SCRAP1 3
debris SCRAP2 2
killit
}
enda
---------------

ifpdist is vital so if you're far from it and you fall it doesn't break it.
if the distance 700 is too low, rise it a bit.

*
getactor[THISACTOR].sectnum temp
getplayer[THISACTOR].cursectnum temp2
ifvarvare temp temp2 { othercodes inside }


*Code is to make that it only works if the player is in the same sector as the sprite.



PS
My mod has a scene you carry hydrazine hydrate.
Stuff is soo sensitive that if you fall and impact, it blows the player to pieces.
uses the ifsound PLAYERIMPACTSOUND { *explosion event code* }

This post has been edited by Zaxtor: 23 October 2017 - 11:00 AM

0

User is online   Hendricks266 

  • Weaponized Autism

  #3

You can't use ifsound to perform game logic, as it will break if sound is disabled, or if the sound is not played due to a small maximum number of voices.

Someone else might be able to chime in with a good way to detect when the player hits the ground.
0

User is offline   Zaxtor 

#4

Yes the drawback can be like Hendricks said if is disabled it can prevent from break it to work.

There is a thing that works on sprites when it falls to the floor "Iffloordistl xx { killit }" thing like my mod has some tiles that falls and break.
And the thing if a player falls from a great height it hurts him/her.

But I dunno if there's code to work the other way around.
if a player falls a certain height on a sprite it will break it.

This post has been edited by Zaxtor: 23 October 2017 - 11:07 AM

0

User is offline   Perro Seco 

#5

I think "ifsound DUKE_LAND" could be replaced by something related with falling_counter.
0

User is offline   Jblade 

#6

http://wiki.eduke32.com/wiki/Sbs

You can use this to get the sprite id of whatever the player is standing on; in this case, you can check to see if it's the grate actor and then manually try damaging it. don't have time to try it myself at this moment but I'll give it an attempt if you can't figure it out tomorrow.
0

User is offline   Zaxtor 

#7

how high velocity has to be for the boots to impact "DUKE_LAND" sound without dmg?

cus at 8 it will do some dmg.

This post has been edited by Zaxtor: 23 October 2017 - 11:40 AM

0

User is offline   Danukem 

  • Duke Plus Developer

#8

View PostJblade, on 23 October 2017 - 11:36 AM, said:

http://wiki.eduke32.com/wiki/Sbs

You can use this to get the sprite id of whatever the player is standing on; in this case, you can check to see if it's the grate actor and then manually try damaging it. don't have time to try it myself at this moment but I'll give it an attempt if you can't figure it out tomorrow.


Yeah you could have the player save his poszv from the previous tic, if that value is > a certain number and he is currently on a sprite bridge, then apply damage to the sprite bridge. The downside is that he won't retain any momentum, he will stop on the sprite, then it will break. To sustain momentum you have to detect the sprite below the player before he lands on it and break it right before he lands.
1

#9

There are definitely player structs related to jumping and falling, though I don't recall their names or how they work. I guess you could do as Dan says above and maybe look at their poszv too though? If they're moving fast enough it should break, even if they just jumped up and down on it. Could even start a count when the player is falling and only have the thing break if the counter is above some number to make sure they've fallen long enough (far enough) to bust what they're landing on. Get the sprite's Z and the player's Z, have it break when the player is above by a few units if the player's poszv-controlled counter is above a certain value, or else they haven't fallen far enough and so will just smash into it.

Might have a go at this later, can't right now, but I've got a few ideas.

View PostHendricks266, on 23 October 2017 - 11:02 AM, said:

You can't use ifsound to perform game logic, as it will break if sound is disabled, or if the sound is not played due to a small maximum number of voices.

Ah... right...
Posted Image
Walks away whistling suspiciously. To be fair, I'd never use this method in serious code, I'd probably come up with something worse instead.

Edit: Working on an attempt using "falling_counter" and some simple math.

This post has been edited by High Treason: 24 October 2017 - 12:10 AM

0

#10

Wanted to use Edit Post but the button has gone, so d-d-double post!
Attached File  EDUKE.CON (2.06K)
Number of downloads: 143


Here, this uses player position and falling_counter structure members to do it's thing. It assumes the sprite you're hitting has blocking on and turns it off (it will mess up if you don't have the sprite set to blocking) and it only works for PANEL1, but it should give you an idea of what's going on. A fall slightly from higher than a normal jump from the sprite will break it, see "ifvarg PL_FC 4" in the code and increase it to set a longer fall. You could probably make my state more flexible and improve it in a number of ways, we already know how flaky my coding is, but this proves it is at least possible.

As a testament to my incompetence, most of my time was taken trying to figure out why nothing was working, even deliberate errors caused no effect... I was working in a file called "EDUKE.CIN" and had not noticed... could have been worse I suppose, at least I didn't break anything too badly.

This post has been edited by High Treason: 24 October 2017 - 01:05 AM

1

User is offline   Maisth 

#11

View PostHigh Treason, on 24 October 2017 - 12:53 AM, said:

Wanted to use Edit Post but the button has gone, so d-d-double post!
Attachment EDUKE.CON


Here, this uses player position and falling_counter structure members to do it's thing. It assumes the sprite you're hitting has blocking on and turns it off (it will mess up if you don't have the sprite set to blocking) and it only works for PANEL1, but it should give you an idea of what's going on. A fall slightly from higher than a normal jump from the sprite will break it, see "ifvarg PL_FC 4" in the code and increase it to set a longer fall. You could probably make my state more flexible and improve it in a number of ways, we already know how flaky my coding is, but this proves it is at least possible.

As a testament to my incompetence, most of my time was taken trying to figure out why nothing was working, even deliberate errors caused no effect... I was working in a file called "EDUKE.CIN" and had not noticed... could have been worse I suppose, at least I didn't break anything too badly.


Gonna try this and probably make some modifications, i couldn't make it work on my own so the script was a big mess that i assure you, you don't want to see it.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options