Thread: Module: Rage
View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-08-2012 , 16:24   Re: Module: Rage
Reply With Quote #82

Here some stuff from Joaquim : Class Creator.

Quote:
Originally Posted by Joaquim
This is a module that allows you to create new classes for entities based on existent classes. For example, you can create a "weapon_boomerang" based on "weapon_knife" and use it then in other plugins seamlessly without having to rely on an API, just using it straight way. It does support hamsandwich so you can handle new entities with new classnames like you do normally for old classes.

Please note :
- It would have been better to make class_creator as a library but Joaquim doesn't have the time right now.
- Remember that if you can make the weapon with C++ you should because of increased efficiency and less trouble on handle intricate stuff.
- There are room for improvements and we wanted to present this module differently but at the end better to share unpolished stuffs rather than keeping it for us.

2 examples are provided through a :
- Pawn plugin ; basic example which creates just a weapon_boomerang entity based on the deagle and does nothing else.
- Module ; more elaborated example which create a real weapon weapon_hivehand (the same as HL1) based on the ak47. (next post)

With a pawn plugin :

Spoiler


Some explanations :
- The key is the use of CreateNewClass. It allows to create a new entity and can be used everywhere you want, like with give_item native or be hooked with what you want.
- To make a weapon, you have to deal with the HUD. In order to show the sprites of the new weapon and to tell the client you use a new weapon (to be able to select it), you have to deal with WeaponList message. You need to create a new file weapon_boomerang.txt containing your sprites. For more information you can look at the Custom Weapon Hud Sprites + Slot Redirection tutorial (Note: you don't need to hook the command)
- The example above is not really complete, for example, you create a new weapon based on the deagle : if you get your new weapon, you will see your new sprites, but if you drop it and get a real deagle, the hud will be fucked up. It's just a matter to send again a WeaponList message with the original value if you get a deagle and you were using before your new weapon.

It's important to update Rage to the vBeta3 !

- class_creator_BIN.zip : contains handlers/modules/amxx binaries + plugin source.
- class_creator_SRC.zip : contains handlers/modules source code.
Attached Files
File Type: zip class_creator_BIN.zip (209.4 KB, 282 views)
File Type: zip class_creator_SRC.zip (331.5 KB, 233 views)
__________________

Last edited by Arkshine; 04-08-2012 at 17:09.
Arkshine is offline