View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-07-2012 , 10:55   Re: Module: Parachute (not fake)
Reply With Quote #8

You can do it without, and using prethink is fairly overkill for that but there are some issues using others ways, that's why I have not released yet the new parachute plugin.

Anyway, except these unexpected problems where I'm working now to figure out some solution, the way I'm using is the following :

- Make the parachute thinking
- Hooking it
- Doing all the stuffs inside with timer.

The purpose is to have a number of actions as less as possible.

To do that, you can optimize things, like :

- Using +use to trigger only the parachute deployment. Meaning hooking ObjectCaps for the deploy only and not like the original where you need to hold +use.
- Using timer to lock the parachute step. Meaning, for example for deploy, the time necessary for the parachute to be fully deployed is > ~2s, so meanwhile this time, the plugin does nothing.
- Creating entity on new player only, unattach/hide it when not used, then delete it when the player is disconnected. No need each time to recreate the entity.
- Letting the engine making the model animation.

You can handle the speed fall differently :

- Method 1 : The smoothest, is to let the engine doing the things, by setting the player's gravity only. It means you will fall like a projectile and where you are going to have a constant acceleration. Such setting is largely enough for small maps or maps where you don't jump high, for example. (Parachute thinking set to 1 second, will explain below why)
- Method 2 : Smooth, using method 1, but to have a better fall approach, you set some basevelocity on z (and not velocity) each 0.1 second. It's good for all kinf of maps.
- Method 3 : Fairly smooth. You set some velocity on z, each 0.1 seconds. It's what does the original parachute plugin, you fall in a straight line in a constant speed. It's good for maps with large high ceiling.

About the method 1, I need to use some delay (1 second) to check if the player is on the ground. I've tried to find a forward which could handle such case, and did not find something useful. But it has the advantage to let some delay before the check, so for example, if you fall on someone or on an edge and you jump or keep falling, the parachute is not closed.

Some issues I have are :

- Some animations problems. It happens randomly. But It might because of my sucking code.
- Because the onground check is done after some time, and because by default the player's gravity is changed, if you jump and you are on the ground, you will make a big jump (because of gravity). A double-edge feature but fixing should not be too hard. (Already done more or less)

All these shits to say, well, parachute can be done in others ways, something way better. The issues should be fixable. But if joropito is on it, I guess no need to bother with my work anymore.
__________________

Last edited by Arkshine; 07-07-2012 at 10:58.
Arkshine is offline