AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Following RPG_ROCKET (https://forums.alliedmods.net/showthread.php?t=16860)

DahVid 08-21-2005 14:36

Following RPG_ROCKET
 
Well, I know how to make a trail to my liking, but I don't know how to put it behind the rocket. I was thinking of finding the rocket with FM_SetModel but I also want to try to supercede and ignore the other trail {If possible} any suggestions?

More 08-21-2005 14:47

maybe this??

#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving
// short (entity:attachment to follow)
// short (sprite index)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte,byte,byte (color)
// byte (brightness)

DahVid 08-21-2005 16:01

... How would I target entity? Surely if I put rpg_rocket there it wouldn't work, will it?

XxAvalanchexX 08-21-2005 16:10

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta> new sprite; public plugin_init() {     register_plugin("Drevil Ammo","0.1","DahVid")     register_forward(FM_SetModel,"ChangeAmmo",0) } public plugin_precache() {     precache_model("models/zombie.mdl")     sprite = precache_model("sprites/laserbeam.spr"); } public ChangeAmmo(entity,model[]) {     if(equali(model,"models/rpgrocket.mdl")==1) {         entity_set_model(entity,"models/zombie.mdl")         set_trail(entity);         return FMRES_SUPERCEDE     }     return FMRES_IGNORED } public set_trail(ent) {    if(!is_valid_ent(ent)) { return; }    message_begin(MSG_ALL,SVC_TEMPENTITY);    write_byte(22); // TE_BEAMFOLLOW    write_short(ent); // rocket    write_short(sprite); // laserbeam    write_byte(50); // life    write_byte(20); // width    write_byte(255); // R    write_byte(100); // G    write_byte(100); // B    write_byte(100); // brightness    message_end();    return; }

See if it works.

DahVid 08-21-2005 16:25

It works, but is there anyway to kill the old one? ooooo
Also, how does it now ent is RPG_ROCKET? I don't understand..

XxAvalanchexX 08-21-2005 18:14

FM_SetModel is called when an entity is given a model. Every time that happens, we see if it is being given the model "models/rpgrocket.mdl" -- if it is we assume it's an RPG rocket, give it another model, and call the function set_trail, passing the entity ID along. In set_trail we send a message to have a beam follow the entity we told it to.


All times are GMT -4. The time now is 14:25.

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