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

[L4D2] Spit glob spawner plugin request


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
darktemplarr
Member
Join Date: Jun 2010
Old 08-21-2014 , 19:15   [L4D2] Spit glob spawner plugin request
Reply With Quote #1

It sounds easy enough but apparently it isn't, or I'd assume it would have been put up somewhere by now that I would have been able to find more easily than my fruitless searches turned up.

I'm creating a project in Left 4 Dead 2 that is currently in a moderately dire need of a specific feature: Spit spawning.
The most malleable and useful way would be to launch it from your player like an actual spitter attack, but triggered by a console command instead.
I recall having a plugin years ago that was able to spawn spit at your feet. Might have been the sm_acidspill that https://forums.alliedmods.net/showthread.php?p=1251446 used to have functioning, but that would simply spawn acid either at your feet or I believe where you were looking at the time.

Being an advanced mapper but a less-than-novice coder, does anybody know how to pull this off?
It would need to be spammable, meaning using the feature excessively (anywhere from 3 to 10 times in a 2-second time period) does not cause strain on performance.

To whomever might be up to it: What can we pull off here?
darktemplarr is offline
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 08-22-2014 , 14:09   Re: [L4D2] Spit glob spawner plugin request
Reply With Quote #2

As promised, here is something I have worked on. It is a stock function for spawning spitter projectiles as wanted.

Unfortunately I am a total newbie when it comes to signature scanning in Windows. I have attached the sub routine instructions but I do not know the method to extract the signature. I have given it my best guess with it but there is no guarantees it works, however signature is unique. I do not have a Windows server at hand. Please let me know if it works.

Works great in Linux with no problems.

Include provides 2 stock functions.
PHP Code:
/**
 * Throws a spitter projectile as if a Spitter were using their ability.
 *
 * @param thrower    Who is throwing the spitter projectile.
 * @param initialVelocity Speed of the thrown spitter projectile.
 * @return        True if spitter projectile was thrown, false otherwise.
 */
stock bool:L4D2_ThrowSpitterProjectile(throwerFloat:initialVelocity 900.0)

/**
 * Creates a spitter projectile that will detonate upon hitting an entity.
 *
 * @param origin    Origin of spitter projectile.
 * @param angles    Angles of spitter projectile.
 * @param velocity    Velocity of spitter projectile.
 * @param thrower    Who is throwing the spitter projectile.
 * @return        True if spitter projectile was created, false otherwise.
 */
stock bool:L4D2_CreateSpitterProjectile(Float:origin[3], Float:angles[3], Float:velocity[3], thrower
L4D2_ThrowSpitterProjectile offers a initialVelocity parameter which defaults to the value of the z_spit_velocity convar. This is how far the spitter projectile will reach.

See Spitter Projectile Include thread for download.

Last edited by Mr. Zero; 08-25-2014 at 06:44.
Mr. Zero is offline
darktemplarr
Member
Join Date: Jun 2010
Old 08-23-2014 , 00:09   Re: [L4D2] Spit glob spawner plugin request
Reply With Quote #3

I don't exactly understand how to test this. I don't know what .inc files are or how to use them, I just know where they are supposed to go for installation. I am not a coder and have no idea how to piece together anything you've created here. How exactly can I test this on my windows server?
darktemplarr is offline
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 08-23-2014 , 01:23   Re: [L4D2] Spit glob spawner plugin request
Reply With Quote #4

The include files go into your local scripting folder. Gamedata goes to your servers gamedata folder.

Then you can use the included functions. Here is the test script I used.

PHP Code:
/* Includes */
#include <sourcemod>
#include <spitterprojectile>

/* Plugin Information */
public Plugin:myinfo = {
    
name        "Spitter Projectile Test",
    
author        "Buster \"Mr. Zero\" Nielsen",
    
description    "Test plugin for Spitter projectile",
    
version        "1.0.0",
    
url        "[email protected]"
}

/* Globals */

/* Plugin Functions */
public OnPluginStart()
{
    
RegConsoleCmd("spitonme"SpitOnMeCommand)
    
RegConsoleCmd("throwspit"ThrowSpitCommand)
}

public 
Action:SpitOnMeCommand(clientargs)
{
    
decl Float:origin[3]
    
GetClientAbsOrigin(clientorigin)
    
origin[2] += 36.0
    
    decl Float
:angles[3]
    
angles[0] = GetRandomFloat(-180.0180.0)
    
angles[1] = GetRandomFloat(-180.0180.0)
    
angles[2] = GetRandomFloat(-180.0180.0)
    
    new 
Float:velocity[3]
    
    
L4D2_CreateSpitterProjectile(originanglesvelocityclient)
    return 
Plugin_Handled
}

public 
Action:ThrowSpitCommand(clientargs)
{
    
L4D2_ThrowSpitterProjectile(client)
    return 
Plugin_Handled

Mr. Zero is offline
darktemplarr
Member
Join Date: Jun 2010
Old 08-23-2014 , 06:37   Re: [L4D2] Spit glob spawner plugin request
Reply With Quote #5

Quote:
Originally Posted by Mr. Zero View Post
The include files go into your local scripting folder. Gamedata goes to your servers gamedata folder.
...
I'm still lost. What do you mean "use the include file"?
I don't know how to use the .inc files, I assumed they were side files the game is told to use automatically by a specific plugin.

How do create a script to utilize the .inc file?
Pasting your supplied test-script code into a .sp and compiling it into a .smx didn't work so I don't understand.

I have never touched code in my life, I've only used it.

If compiling IS what you meant, I got the following error:

error 021: symbol already defined: "OnPluginStart"

Last edited by darktemplarr; 08-23-2014 at 08:08. Reason: compile error added
darktemplarr is offline
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 08-25-2014 , 03:34   Re: [L4D2] Spit glob spawner plugin request
Reply With Quote #6

Quote:
Originally Posted by darktemplarr View Post
...
I'm still lost. What do you mean "use the include file"?
I don't know how to use the .inc files, I assumed they were side files the game is told to use automatically by a specific plugin.

How do create a script to utilize the .inc file?
Pasting your supplied test-script code into a .sp and compiling it into a .smx didn't work so I don't understand.

I have never touched code in my life, I've only used it.

If compiling IS what you meant, I got the following error:

error 021: symbol already defined: "OnPluginStart"
Ah sorry I thought you were more versed in SourcePawn.
If you wish to compile a plugin yourself I would consider reading the wiki as it contains everything you could possibly need.

Otherwise if you know exactly how you want this spitter projectile plugin, then I will gladly compile you a plugin. Attached is a simple admin plugin that allows spawning of spitter projectiles using the commands sm_throwspit and sm_createspit.

Code:
sm_throwspit <#userid|name> [velocity] - Throws a spitter projectile as a Spitter Special Infected would.
sm_silentthrowspit <#userid|name> [velocity] - Throws a spitter projectile as a Spitter Special Infected would, without showing activity.
sm_createspit <#userid|name> [x] [y] [z] - Creates a spitter projectile at location of thrower or specified coordinates.
sm_silentcreatespit <#userid|name> [x] [y] [z] - Creates a spitter projectile at location of thrower or specified coordinates, without showing activity.
Depending on how you imagine the plugin to work, let me know if you wish to change the setup of the commands.

Gamedata from the above spitter projectile include is still required on the server!
Attached Files
File Type: zip spitterprojectile-admincommands_release.zip (31.1 KB, 190 views)

Last edited by Mr. Zero; 08-25-2014 at 08:14.
Mr. Zero is offline
darktemplarr
Member
Join Date: Jun 2010
Old 08-25-2014 , 04:19   Re: [L4D2] Spit glob spawner plugin request
Reply With Quote #7

Quote:
Originally Posted by Mr. Zero View Post
Ah sorry I thought you were more versed in SourcePawn.
If you wish to compile a plugin yourself I would consider reading the wiki as it contains everything you could possibly need.

Otherwise if you know exactly how you want this spitter projectile plugin, then I will gladly compile you a plugin. Attached is a simple admin plugin that allows spawning of spitter projectiles using the commands sm_throwspit and sm_createspit.

Code:
sm_throwspit <#userid|name> [velocity] - Throws a spitter projectile as a Spitter Special Infected would.
sm_silentthrowspit <#userid|name> [velocity] - Throws a spitter projectile as a Spitter Special Infected would, without showing activity.
sm_createspit <#userid|name> [x] [y] [z] - Creates a spitter projectile at location of thrower or specified coordinates.
sm_silentcreatespit <#userid|name> [x] [y] [z] - Creates a spitter projectile at location of thrower or specified coordinates, without showing activity.
Depending on how you imagine the plugin to work, let me know if you wish to change the setup of the commands.

Gamedata from the above spitter projectile include is still required on the server!
I do indeed have the gamedata from the original post, as well as the original spitter .include file too.
The commands load up in console, but when typed it it appears their function does not... function.
It says [SM] Forced <user> to throw spit. However, no actual spit is ejected from the player nor spawned at their feet with either command.

It even says that message when I use the sm_createspit command but I'm sure that's on purpose and doesn't actually matter.

If you can't think of what might be wrong I suppose I could try a fresh install of sourcemod and use just this plugin, which should tell me that I have a confliction of some sort.

Edit: And now that I think about actually applying this, what would be a lovely addition is if the throwspit command in particular made the hock-up sound from the player who "threw" the spit. On top of this, a variable to turn this off should it be annoying to others would also be lovely.
A new command to turn on and off the actual spitter spit noise for the sm_throwspit command. If it as simple as I hope it is, would you mind?

Last edited by darktemplarr; 08-25-2014 at 04:33.
darktemplarr 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 02:34.


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