Raised This Month: $51 Target: $400
 12% 

FF2 [Subplugin] Replace Projectile v1.0.2 (2013/05/08)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jasonfrog
Senior Member
Join Date: Mar 2008
Old 05-05-2013 , 07:44   [Subplugin] Replace Projectile v1.0.2 (2013/05/08)
Reply With Quote #1

Replace Projectile (Latest Version: v1.0.2)

This plugin allows the replacement and scaling of Boss projectiles.

Installation:
  • ff2_replaceprojectile.ff2 -> plugins/freaks/
  • ff2_replaceprojectile.sp -> scripting/

Replace Projectile
PHP Code:
    "abilityX"
    
{
        
"name"         "replace_projectile"
        "arg1"         "tf_projectile_rocket"   
//name of the projectile to replace the model of
        
"arg2"         "models/props_halloween/eyeball_projectile.mdl"   //replacement model
        
"arg3"         "2.0"  //model scale
        
"plugin_name"  "ff2_replaceprojectile"
    

  • arg1 is the name of the projectile entity to be replaced, e.g. tf_projectile_rocket, tf_projectile_pipe, tf_projectile_stun_ball see https://developer.valvesoftware.com/...ess_2_Entities for a full list.
  • All custom models and materials need to be added to the mod_download, mat_download and download tables, where applicable, in the Boss config.
  • If arg3 is not present, then default size is used.
In the example above, rockets are replaced with Monoculus eyeballs scaled to twice normal size.


ChangeLog:
v1.0.2: Added timer before changing projectile model values. (Thanks again friagram)
v1.0.1: Improved the collision of projectiles. Block negative scale values. (Thanks friagram!)
v1.0: Initial release.
Attached Files
File Type: sp Get Plugin or Get Source (ff2_replaceprojectile.sp - 894 views - 2.4 KB)
File Type: smx ff2_replaceprojectile.smx (5.2 KB, 1099 views)

Last edited by jasonfrog; 05-08-2013 at 08:49. Reason: Updated to v1.0.2
jasonfrog is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 05-06-2013 , 10:18   Re: [Subplugin] Replace Projectile v1.0 (2013/05/05)
Reply With Quote #2

SetEntityModel(entity, g_ProjectileModel);
SetEntPropFloat(entity, Prop_Send, "m_flModelScale", g_ProjectileScale);

after you do this the collision of the projectiles will be screwy. Not sure how modelscale effects them. I assume it's okay, but they will now explode based on mins/maxs (which will be enormous).

try something like

static const Float:nulVec[] = {0.0,0.0,0.0};

SetEntityModel(entity, g_ProjectileModel);
SetEntPropVector(entity, Prop_Send, "m_vecMins", nulVec);
SetEntPropVector(entity, Prop_Send, "m_vecMaxs", nulVec);
SetEntPropFloat(entity, Prop_Send, "m_flModelScale", g_ProjectileScale);

This should make the projectile perform more normally. Atleast it does without model scale (you can shoot rockets around tight corners, etc. I think it would work with scale as well. Try it
I am not 100% sure about huntsman arrows. You are supposed to be able to shoot them down out of the air, so I assume they have some vecmins/max, but perhaps they don't. I know atleast for rockets and bombs, the 0 vec works.

you also may want to clamp your if (g_ProjectileScale == 0) to if (g_ProjectileScale <= 0), I dunno/don't remember what ff2 clamp stuff to, or if it does.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 05-06-2013 at 10:23.
friagram is offline
jasonfrog
Senior Member
Join Date: Mar 2008
Old 05-06-2013 , 10:52   Re: [Subplugin] Replace Projectile v1.0 (2013/05/05)
Reply With Quote #3

Quote:
Originally Posted by friagram View Post
static const Float:nulVec[] = {0.0,0.0,0.0};

SetEntityModel(entity, g_ProjectileModel);
SetEntPropVector(entity, Prop_Send, "m_vecMins", nulVec);
SetEntPropVector(entity, Prop_Send, "m_vecMaxs", nulVec);
SetEntPropFloat(entity, Prop_Send, "m_flModelScale", g_ProjectileScale);
This definitely helps with model clipping. Many thanks.

Updated to v1.0.1
jasonfrog is offline
RavensBro
Veteran Member
Join Date: Sep 2009
Location: Wisonsin USA
Old 05-06-2013 , 17:03   Re: [Subplugin] Replace Projectile v1.0.1 (2013/05/06)
Reply With Quote #4

ok so I put In the new one and that = crash. just thought I let you know
RavensBro is offline
jasonfrog
Senior Member
Join Date: Mar 2008
Old 05-06-2013 , 17:15   Re: [Subplugin] Replace Projectile v1.0.1 (2013/05/06)
Reply With Quote #5

Quote:
Originally Posted by RavensBro View Post
ok so I put In the new one and that = crash. just thought I let you know
Any info on that crash?

What was the last working version for you? The one I gave you when it is just for rockets and pipes, or this one where you specify the projectile in the config?
jasonfrog is offline
RavensBro
Veteran Member
Join Date: Sep 2009
Location: Wisonsin USA
Old 05-06-2013 , 17:31   Re: [Subplugin] Replace Projectile v1.0.1 (2013/05/06)
Reply With Quote #6

this ver. ff2_replaceprojectile_v1.0_final worked just fine I did the eyeball rockets and I added that easter bunny they made for vsh and had him shooting out the eggs.

didn't say anything in the log but on my server screen it said something about couldn't read memory.


"name" "replace_projectile"
"arg1" "tf_projectile_pipe" //name of the projectile to replace the model of
"arg2" "models/player/saxton_hale/w_easteregg.mdl" //replacement model
"arg3" "1.0" //model scale
"plugin_name" "ff2_replaceprojectile"



"name" "replace_projectile"
"arg1" "tf_projectile_rocket" //name of the projectile to replace the model of
"arg2" "models/props_halloween/eyeball_projectile.mdl" //replacement model
"arg3" "2.0" //model scale
"plugin_name" "ff2_replaceprojectile"

Last edited by RavensBro; 05-06-2013 at 17:34.
RavensBro is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 05-07-2013 , 01:13   Re: [Subplugin] Replace Projectile v1.0.1 (2013/05/06)
Reply With Quote #7

I remember having a problem with this sort of thing too, or it would not change some/many of the models.
I ended up creating 0.0 timers for every model i wanted to convert, and it's worked fine every since.
I think trying to set the model and do all of that stuff on the same frame that the entity is created is too much, and some bad things happen =S

onentityspawned->sdkhook->timer(0.0, entref) -> do it

PHP Code:
CreateTimer(0.0Timer_ProjModelEntIndexToEntRef(entity));

public 
Action:Timer_ProjModel(Handle:timerany:ref)
{
    new 
entity EntRefToEntIndex(ref);
        if (
entity != INVALID_ENT_REFERENCE)
        {
                
SetEntityModel(entityyourmodelhere);
                
stuff
                stuff
        
}

Another thing, recalculating the model's scale may also be resizing the bounding box or causing problems.
You may want to set the vecs after you resize the model, I'm not sure. Have not used the two together.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 05-07-2013 at 01:18.
friagram is offline
jasonfrog
Senior Member
Join Date: Mar 2008
Old 05-07-2013 , 05:25   Re: [Subplugin] Replace Projectile v1.0.1 (2013/05/06)
Reply With Quote #8

Quote:
Originally Posted by friagram View Post
I remember having a problem with this sort of thing too, or it would not change some/many of the models.
I ended up creating 0.0 timers for every model i wanted to convert, and it's worked fine every since.
I think trying to set the model and do all of that stuff on the same frame that the entity is created is too much, and some bad things happen =S

onentityspawned->sdkhook->timer(0.0, entref) -> do it

PHP Code:
CreateTimer(0.0Timer_ProjModelEntIndexToEntRef(entity));

public 
Action:Timer_ProjModel(Handle:timerany:ref)
{
    new 
entity EntRefToEntIndex(ref);
        if (
entity != INVALID_ENT_REFERENCE)
        {
                
SetEntityModel(entityyourmodelhere);
                
stuff
                stuff
        
}

Another thing, recalculating the model's scale may also be resizing the bounding box or causing problems.
You may want to set the vecs after you resize the model, I'm not sure. Have not used the two together.
Many thanks for your advice and assistance. I'd been unable to reproduce the crash.


Ravensbro, please let me know how you get on with the version attached to this post. in the OP.

Updated to v1.0.2

Last edited by jasonfrog; 05-08-2013 at 08:48.
jasonfrog is offline
RavensBro
Veteran Member
Join Date: Sep 2009
Location: Wisonsin USA
Old 05-07-2013 , 08:59   Re: [Subplugin] Replace Projectile v1.0.1 (2013/05/06)
Reply With Quote #9

ok I only got to test it with bots this morning and no crashes so I am guessing it should be ok.
RavensBro is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:50.


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