AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detecting Void (https://forums.alliedmods.net/showthread.php?t=49644)

Wilson [29th ID] 01-09-2007 15:09

Detecting Void
 
I have an entity that flies through the sky but has gravity. (It's a mortar shell)

The thing is, I'd like it to go through void. I already make it ignore sky so it basically bounces off of void right now. I'd like to be able to detect when the entity is hitting void and just make it go through.

Right now, as far as I know, it's bouncing off of void because it is MOVETYPE_TOSS

I've tried the other movetypes, but there is no movetype that has gravity but does not collide with void (but does collide with everything else)

Code:

// pev(entity, pev_movetype) values
#define        MOVETYPE_NONE                  0          // Never moves
#define        MOVETYPE_WALK                  3          // Player only - moving on the ground
#define        MOVETYPE_STEP                  4          // Gravity, special edge handling -- monsters use this
#define        MOVETYPE_FLY                    5          // No gravity, but still collides with stuff
#define        MOVETYPE_TOSS                  6          // Gravity/Collisions
#define        MOVETYPE_PUSH                  7          // No clip to world, push and crush
#define        MOVETYPE_NOCLIP                8          // No gravity, no collisions, still do velocity/avelocity
#define        MOVETYPE_FLYMISSILE            9          // Extra size to monsters
#define        MOVETYPE_BOUNCE                10          // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE          11          // Bounce w/o gravity
#define MOVETYPE_FOLLOW                12          // Track movement of aiment
#define        MOVETYPE_PUSHSTEP              13          // BSP model that needs physics/world collisions (uses nearest hull for world collision)

Toss works for everything but the void bit. But is there anything that is called when the entity detects void and bounces that I can hook and supercede?

This way I can get a true mortar arch, and make the plugin very very useful.

Thanks guys.

VEN 01-09-2007 16:14

Re: Detecting Void
 
1. I do not think you need that because nobody need to see what happens after a touch to the map "bounds" so i'd assume that you could remove the projectile?

2. If you still want to complete that, try to pre-touch hook, detect that it's touching to the sky somehow and then try to set the projectile's solidity to SOLID_NOT.

EDIT: i think better just make it MOVETYPE_NOCLIP

EDIT2: Please nevermind, i overlooked your "arch" word, that completely changed the meaning of the point.

Wilson [29th ID] 01-09-2007 16:48

Re: Detecting Void
 
Pre-Touch Hook? Haven't heard of it. That's a very good logical idea and will probably work if I can get a pre-touch hook. How do I hook that?

XxAvalanchexX 01-09-2007 19:41

Re: Detecting Void
 
Register FM_Touch with the third parameter (post) as 0, which is the default.

http://www.amxmodx.org/funcwiki.php?go=func&id=615

Wilson [29th ID] 01-10-2007 20:18

Re: Detecting Void
 
Okay thanks both of you for the help, but the thing is, if i set it to SOLID_NOT it doesn't fix the trick.

Code:

// pev(entity, pev_solid) values
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves
// SOLID only effects OTHER entities colliding with this one when they move - UGH!

So it's not going to affect itself just other things that touch it.

Your edit, VEN, suggesting MOVETYPE_NOCLIP doesn't seem to work because NOCLIP gets rid of gravity, so it never comes back down it just shoots off into the sky and goes into another galaxy.

Is there any way to detect that "bounce" that a MOVETYPE_TOSS gets when touching void, so I can block it and let it just go through? Or another entity value I can set my shell to so it can go through the void but still have gravity?

VEN 01-11-2007 12:28

Re: Detecting Void
 
I've overlooked your "arch" word, but now i clearly see your point.

There is no easy way. You have to understand that superceding the Touch will not ignore a physical collisions. You have to code the whole new movetype with its own physics.

As the base movetype for the sky part you can use MOVETYPE_NOCLIP mixed with a custom gravity physics implementation.

Wilson [29th ID] 01-15-2007 16:44

Re: Detecting Void
 
Would this require a new module?

XxAvalanchexX 01-15-2007 17:00

Re: Detecting Void
 
I'd imagine you just set its velocity, hook its think, and then slowly subtract from its Z velocity to replicate your gravity. The X and Y vectors should handle themselves.

Bad_Bud 01-16-2007 16:23

Re: Detecting Void
 
Yeah, but you'll have to make sure you do some checking to see when the mortar enters void, and when it exits void, so that it's solid at every other point. There are a lot of factors involved, such as did you fire it from under a building (is it going to blow up before it even reaches the sky?), did it hit a rooftop on the way down? Is the skybox different heights for different parts of the level?

XxAvalanchexX 01-16-2007 17:02

Re: Detecting Void
 
Using MOVETYPE_NOCLIP and working your own gravity, the skybox is irrelevant. Since MOVETYPE_NOCLIP is not solid, it won't hit the skybox.

However, as you pointed out, you'll still want to see if it hit something. So, you can check its point contents for CONTENTS_SOLID every think, or draw a trace from its old destination (pre-gravity) to its new destination (post-gravity) and see if it hit something.


All times are GMT -4. The time now is 22:20.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.