PDA

View Full Version : Converting CS new_henade_efx to DOD


DFHServer
05-17-2007, 04:45 AM
I changed it parts to "dodx" instead of "csx"....
and replaced the check if grenade isn't a HeGrenade
if(wid != CSW_HEGRENADE)
with
if(wid != DODW_STICKGRENADE)
that worked for Axis and if we put in
if(wid != DODW_HANDGRENADE)
that worked for Allies, so I modified it with an OR
if(wid != DODW_STICKGRENADE || wid != DODW_HANDGRENADE)
But, the effects work with AXIS, but not Allies
Below is the script...
If you see anything that might need to be changed, let me know..
I have already placed the 13 sprite files in the dod\sprites folder...
and I do see the plugin running
(New HeNades Effec 0.1 SAMURAI new_henade_efx. running )...
So I think it has to do with the iGren variable below:
Also, the last few sprites don't show as it supposed to leave a skeleton sprite behind on the ground.

regards,
DFHServer
================================================== =============
/*
New HeNades Effects
Version 0.1 by SAMURAI

* Plugin details:
- The basic sprite from hegrenade explode was replaced with new 13 sprites
New effects, colors, etc

* Required Modules:
- dodx
- Fakemeta
* Cvars:
- None
* Admin Commands:
- None

Have a nice day now
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <dodx>

#define PLUGIN_NAME "New HeNades Effects"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "SAMURAI"

// required sprites for plugin
new const g_sprites[][] =
{
"sprites/he_efx1.spr",
"sprites/he_efx2.spr",
"sprites/he_efx3.spr",
"sprites/he_efx4.spr",
"sprites/he_efx5.spr",
"sprites/he_efx6.spr",
"sprites/he_efx7.spr",
"sprites/he_efx8.spr",
"sprites/he_efx9.spr",
"sprites/he_efx10.spr",
"sprites/he_efx11.spr",
"sprites/he_efx12.spr",
"sprites/he_efx13.spr"
}

new gSpriteIndex[sizeof g_sprites];

/************************************************** ****************
********************** AMXMODX PLUGIN *****************************
************************************************** ****************/
public plugin_init()
{
// Register the plugin
register_plugin(PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_ AUTHOR);


// Forward Fakemeta Think
register_forward(FM_Think,"fw_think");

}

// plugin_precache forward
public plugin_precache()
{

for(new i = 0; i < sizeof g_sprites; i++)
gSpriteIndex[i] = engfunc(EngFunc_PrecacheModel,g_sprites[i]);

}

/**************************************
grenade_throw DODX Forward //
It's called when an user throw //
a grenade //
**************************************/
public grenade_throw(id,iGren,wid)
{

// check if grenade isn't a HeGrenade
if(wid != DODW_STICKGRENADE || wid != DODW_HANDGRENADE)
return PLUGIN_CONTINUE;

// check if Grenade entity isn't a valid entity
if(!pev_valid(iGren))
return PLUGIN_CONTINUE;

// set a new classname to HeGrenade
set_pev(iGren,pev_classname,"fake_hegren");

// Make it to explode after 1.6 seconds
set_task(1.6,"gre_explode",iGren);

return PLUGIN_CONTINUE;

}

/*****************************************
FM Think Fakemeta Forward //
On this case, help to stop hegrenade //
from original explosion //
***************************************/
public fw_think(ent)
{
if(!pev_valid(ent))
return FMRES_IGNORED;

if(!pev(ent,pev_bInDuck))
return FMRES_IGNORED;

new class[32];
pev(ent,pev_classname,class,31);

if(equali(class,"fake_hegren"))
return FMRES_SUPERCEDE;


return FMRES_IGNORED;

}


/*****************************************
This is calle d when hegrenade is //
explode with new sprites //
***************************************/
public gre_explode(ent)
{
// check if entity isn't valid
if(!pev_valid(ent))
return;

// new variable for origin and get origin of entity
static Float:origin[3];
pev(ent,pev_origin,origin);


message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(TE_EXPLOSION); // TE_EXPLOSION
write_coord(floatround(origin[0])); // origin x
write_coord(floatround(origin[1])); // origin y
write_coord(floatround(origin[2])); // origin z
write_short(gSpriteIndex[random(sizeof g_sprites)]); // sprites
write_byte(40); // scale in 0.1's
write_byte(30); // framerate
wr ite_byte(TE_EXPLFLAG_NONE); // flags
message_end(); // message end
}

=|[76AD]|= TatsuSaisei
05-17-2007, 10:51 AM
I don't know if it was the pasting, the forum itself, or the code was actually this "bad", but I took a copy and checked it for simply syntax errors and such and found a few boo-boos ... I corrected the blatant stuff for you, though I did not test it... also, you want to change the OR on the grenade catch, because technically as it stands in your code above, the function will ALWAYS return unless it is any weapon EXCEPT an AXIS AND an ALLIES grenade, which will be impossible to be "both" ... so change the OR to an AND and try it out...

// check if grenade isn't a HeGrenade
if(wid != DODW_STICKGRENADE && wid != DODW_HANDGRENADE)
return PLUGIN_CONTINUE;


/*
New HeNades Effects
Version 0.1 by SAMURAI
* Plugin details:
- The basic sprite from hegrenade explode was replaced with new 13 sprites
New effects, colors, etc
* Required Modules:
- dodx
- Fakemeta
* Cvars:
- None
* Admin Commands:
- None
Have a nice day now
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <dodx>
#define PLUGIN_NAME "New HeNades Effects"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "SAMURAI"
// required sprites for plugin
new const g_sprites[][] = {
"sprites/he_efx1.spr",
"sprites/he_efx2.spr",
"sprites/he_efx3.spr",
"sprites/he_efx4.spr",
"sprites/he_efx5.spr",
"sprites/he_efx6.spr",
"sprites/he_efx7.spr",
"sprites/he_efx8.spr",
"sprites/he_efx9.spr",
"sprites/he_efx10.spr",
"sprites/he_efx11.spr",
"sprites/he_efx12.spr",
"sprites/he_efx13.spr"
}
new gSpriteIndex[sizeof g_sprites];
public plugin_init()
{
// Register the plugin
register_plugin(PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_ AUTHOR);


// Forward Fakemeta Think
register_forward(FM_Think,"fw_think");

}
// plugin_precache forward
public plugin_precache()
{

for(new i = 0; i < sizeof g_sprites; i++)
gSpriteIndex[i] = engfunc(EngFunc_PrecacheModel,g_sprites[i]);

}
public grenade_throw(id,iGren,wid)
{

// check if grenade isn't a HeGrenade
if(wid != DODW_STICKGRENADE && wid != DODW_HANDGRENADE)
return PLUGIN_CONTINUE;

// check if Grenade entity isn't a valid entity
if(!pev_valid(iGren))
return PLUGIN_CONTINUE;

// set a new classname to HeGrenade
set_pev(iGren,pev_classname,"fake_hegren");

// Make it to explode after 1.6 seconds
set_task(1.6,"gre_explode",iGren);

return PLUGIN_CONTINUE;

}
public fw_think(ent)
{
if(!pev_valid(ent))
return FMRES_IGNORED;

if(!pev(ent,pev_bInDuck))
return FMRES_IGNORED;

new class[32];
pev(ent,pev_classname,class,31);

if(equali(class,"fake_hegren"))
return FMRES_SUPERCEDE;


return FMRES_IGNORED;

}
public gre_explode(ent)
{
// check if entity isn't valid
if(!pev_valid(ent))
return;

// new variable for origin and get origin of entity
static Float:FloatOrigin[3];
pev(ent,pev_origin,FloatOrigin);


message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(TE_EXPLOSION); // TE_EXPLOSION
write_coord(floatround(FloatOrigin[0])); // origin x
write_coord(floatround(FloatOrigin[1])); // origin y
write_coord(floatround(FloatOrigin[2])); // origin z
write_short(gSpriteIndex[random(sizeof g_sprites)]); // sprites
write_byte(40); // scale in 0.1's
write_byte(30); // framerate
write_byte(TE_EXPLFLAG_NONE); // flags
message_end(); // message end
}

DFHServer
05-18-2007, 03:35 AM
hey thanks tat!

Yeah, adding the && that worked!
Also added the shreck, piat, and zooka to the list.
My brother and I haven't taken any programming in over 15 years.
So, we make educated guesses (with help from google search) on how the HL pawn coding works.
cheers!
DFHServer