AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Module: Parachute (not fake) (https://forums.alliedmods.net/showthread.php?t=189404)

joropito 07-06-2012 19:05

Module: Parachute (not fake)
 
2 Attachment(s)
Because too many people asked for this, I've made this little module.

All users in server has parachute, it activates with E (+use) while in air.
It only have one cvar

Quote:

sv_fallspeed (default: 100) // fall speed with parachute.
* Put parachute.wav into sound folder
* Put parachute.mdl into models folder
* Put the module into addons/amxmodx/modules
* Enable adding parachute in addons/amxmodx/configs/modules.ini

I only have linux build. Anyone willing to compile and test under windows will be helpful.

Destro- 07-06-2012 21:12

Re: Module: Parachute (not fake)
 
1 Attachment(s)
good


window version here

kiki33hun 07-07-2012 03:28

Re: Module: Parachute (not fake)
 
Good job!

dFF 07-07-2012 07:47

Re: Module: Parachute (not fake)
 
Nice joob joropito !
Can you add 2 natives something likes:
PHP Code:

native set_user_parachute(idbool:bStatus true)
native get_user_parachute(id

and a separate version without parachute sound ?

Also, Arkshine said on this topic using PlayerPreThink for plugin like parachute is not the very good way. Have you idea how to create parachute without PlayerPreThink functions ?
I have tried to make a parachute plugin without PlayerPreThink function, but have a problem with Cache_UnlinkLRU error.

ConnorMcLeod 07-07-2012 09:23

Re: Module: Parachute (not fake)
 
Quote:

Originally Posted by dFF (Post 1745278)
Nice joob joropito !
Can you add 2 natives something likes:
PHP Code:

native set_user_parachute(idbool:bStatus true)
native get_user_parachute(id

and a separate version without parachute sound ?

Also, Arkshine said on this topic using PlayerPreThink for plugin like parachute is not the very good way. Have you idea how to create parachute without PlayerPreThink functions ?
I have tried to make a parachute plugin without PlayerPreThink function, but have a problem with Cache_UnlinkLRU error.

It's not really a problem to use PreThink in a module, but i suggested to joropito to rewrite without prethink so he may consider it.

joropito 07-07-2012 09:57

Re: Module: Parachute (not fake)
 
I have to check if it's smooth to have an entity thinking each 0.1 and adding Z velocity to player. Also I want change the direction to what the player is viewing while flying.

This is just a method copy from the original parachute because lot of people asked to have it in a module. Of course there're some ways to improve this.

DjOptimuS 07-07-2012 10:51

Re: Module: Parachute (not fake)
 
well .. thank you very much joropito, i will buy you a beer.

Arkshine 07-07-2012 10:55

Re: Module: Parachute (not fake)
 
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.

claudiuhks 07-07-2012 13:25

Re: Module: Parachute (not fake)
 
What do you mean with (not fake)?
By the way, it would be better to check whether entity exists through FNullEnt instead of getting the entity's index then check it whether is higher than zero.

joropito 07-07-2012 13:41

Re: Module: Parachute (not fake)
 
not fake thing: there was a fake parachute module with slowhack to forward players to some server

FNullEnt: it just check for entity equal to null. I prefer to check for less or equal zero. It's just different opcode, and don't change anything at asm code level.


All times are GMT -4. The time now is 18:24.

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