AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D & L4D2] Intelligent Machine Gun (https://forums.alliedmods.net/showthread.php?t=164543)

panxiaohai 08-12-2011 20:08

[L4D & L4D2] Intelligent Machine Gun
 
35 Attachment(s)
Credits
alexip121093
hihi1210
Descriptions
You can spawn an intelligent machine gun ( mini gun), the gun is automatically controlled, you can not use it to shot, but you can carry it on your back or put it down, when you put it down , the gun try to find the enemy and fire automatically .

Health: If a gun's health go zero, it will go to sleep.
Sleep: If a gun not attack a enemy for a long time , it go to sleep.
Wake up:
Survivor can wake up a gun by shoving it. Infected can wake up a gun by attacking it.
Team: The gun belong to a team , If it is survivor team, it will attack infected, if it is infected team, it will attack survivors.
Betray to infected team : If a gun being attcked, it will betray to infected.
Betray to survivor team : If a gun being shoved by survivor, it will betray to survivor.
Ammo: you can refill a gun's ammo by using a ammo stack when carry it.

Video:

http://v.youku.com/v_show/id_XMjk0NDIyNzI0.html

How to use (default key):
!machine , !machine 0 !machine 1, : spawn a machine gun with different type.
!removemachine : remove a machine gun.
duck+mouse right button : carry the gun on your back .
use button : put the gun down.

Convars:
"l4d_machine_enable", "2", " 0:disable, 1:enable in coop mode, 2: enable in all mode "
"l4d_machine_damage_to_infected", "25.0", "bullet damage"
"l4d_machine_damage_to_survivor", "2.0", "bullet damage"

"l4d_machine_maxuser", "5", "maximum count of machine gun"
"l4d_machine_range", "1000.0", "maxmum scan range of machine gun"
"l4d_machine_voerheat", "10.0", " how many seconds did the gun overheat."

"l4d_machine_adminonly", "0", "1:admin use only"
"l4d_machine_msg", "1", "how many times to display usage information , 0 disable "
"l4d_machine_ammo_count", "1000", "ammo count"
"l4d_machine_ammo_refill", "1", "0:disable, 1:enable"
"l4d_machine_allow_carry", "1", "0:disable carray 1:every one, 2: only gun's creator, l4d1 should set to 2 otherwise will crash"
"l4d_machine_sleep_time", "300", ""how many seconds does a gun goto sleep while no enemy, must >0"
"l4d_machine_fire_rate", "20", "rate of fire, how many shot per soncods [5, 30]"

"l4d_machine_health", "100.0", "gun's health"

"l4d_machine_betray_chance", "10.0", "betray chance"
"l4d_machine_ammo_type", "0", "0: normal , 1:incendiary 2:explosive"

Requirement: SDK Hooks

ChangeLog:

version 1.07
Improve
algorithm consume fewer resources, the gun is more responsive.
fix some hidden bugs.
duck+shove to carry machine.
Add convers:
"l4d_machine_betray_chance", "10.0", "betray chance"

"l4d_machine_ammo_type", "0", "0: normal , 1: incendiary 2: explosive"


KyleS 08-12-2011 20:10

Re: [L4D & L4D2] Intelligent Machine Gun
 
You've forgotten to attach a plugin :o

panxiaohai 08-12-2011 20:18

Re: [L4D & L4D2] Intelligent Machine Gun
 
Quote:

Originally Posted by KyleS (Post 1531349)
You've forgotten to attach a plugin :o

Upload finished.

alexip121093 08-13-2011 03:14

Re: [L4D & L4D2] Intelligent Machine Gun
 
Just like my movable machine gun plugin that you can carry the gun
Anyway good plugin , another plugin using the info_particle_target

Here are some ideas.
Add a cvar to control the attack range and the angle of detection. Also add sone ammo types eg. Fire , explosive , heal , freeze,knockback

panxiaohai 08-13-2011 07:02

Re: [L4D & L4D2] Intelligent Machine Gun
 
1 Attachment(s)
Quote:

Originally Posted by alexip121093 (Post 1531482)
Just like my movable machine gun plugin that you can carry the gun
Anyway good plugin , another plugin using the info_particle_target

Here are some ideas.
Add a cvar to control the attack range and the angle of detection. Also add sone ammo types eg. Fire , explosive , heal , freeze,knockback

Thank you for your guidance.
The beginning of the idea is create a weapon auto attack inftects, the weapon is on your shoulder, like predators in movie, but I find no appropriate model to use, and my hammar tool do not work.
Attachment 90525
Attack range and damage type are written directly in code , not yet make convars.

Another question to ask, the code below do not work in l4d1, the bullet track start from pos but not end with endpos, "info_particle_target" even do not exsit.
Code:

ShowTrack(  Float:pos[3], Float:endpos[3] )

    decl String:temp[32];       
    new target =0;
    if(L4D2Version)target=CreateEntityByName("info_particle_target");
    else target=CreateEntityByName("info_target");
    Format(temp, 32, "cptarget%d", target);
    DispatchKeyValue(target, "targetname", temp);   
    TeleportEntity(target, endpos, NULL_VECTOR, NULL_VECTOR);
    ActivateEntity(target);
 
    new particle = CreateEntityByName("info_particle_system");
    if(L4D2Version)    DispatchKeyValue(particle, "effect_name", PARTICLE_WEAPON_TRACER2);
    else DispatchKeyValue(particle, "effect_name", PARTICLE_WEAPON_TRACER);
    DispatchKeyValue(particle, "cpoint1", temp);
    DispatchSpawn(particle);
    ActivateEntity(particle);
    TeleportEntity(particle, pos, NULL_VECTOR, NULL_VECTOR);
    AcceptEntityInput(particle, "start");   
    CreateTimer(0.01, DeleteParticletargets, target, TIMER_FLAG_NO_MAPCHANGE);
    CreateTimer(0.01, DeleteParticles, particle, TIMER_FLAG_NO_MAPCHANGE);
}


JoBarfCreepy 08-13-2011 07:36

Re: [L4D & L4D2] Intelligent Machine Gun
 
Finally! I knew someone would make this. Just sad this was the first thing I tried to achieve with SourceMod, 2 years ago. (Left 4 Dead 1, playing as a special infected and forcing me to control it)

megaquake 08-13-2011 11:15

Re: [L4D & L4D2] Intelligent Machine Gun
 
Hey thanks it worked realy great, but I guess I have a bug and most likely cause my server runs survival, this is the second day and nobody is able to spawn the gun, it will say too many machine when you try to spawn one, I increased the amount allowed and then was able to spawn more, but now just cant spawn any even after map change.

If you need more info about what is running on my server let me know!

BTW the tankrock plugin works great on my server, no errors or crashes hm it crashes my versus server tho :(

Thanks allot for all your hard work,

Mega

ur5efj 08-13-2011 11:26

Re: [L4D & L4D2] Intelligent Machine Gun
 
Compiling l4d_machine.sp ...SourcePawn Compiler 1.3.9-dev
Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2008 AlliedModders, LLC

l4d_machine.sp(128 ) : warning 204: symbol is assigned a value that is never used: "button"
l4d_machine.sp(162) : warning 204: symbol is assigned a value that is never used: "bot"
l4d_machine.sp(1098 ) : warning 204: symbol is assigned a value that is never used: "hit"
l4d_machine.sp(1202) : warning 203: symbol is never used: "CheckAngle"
l4d_machine.sp(63) : warning 203: symbol is never used: "GunAngle"
l4d_machine.sp(68 ) : warning 203: symbol is never used: "LastButton"
l4d_machine.sp(68 -- 1202) : warning 203: symbol is never used: "PrintVector"
l4d_machine.sp(68 -- 1202) : warning 203: symbol is never used: "SetVectorOffest"
l4d_machine.sp(68 -- 1202) : warning 203: symbol is never used: "ShowAngle"
l4d_machine.sp(68 -- 1202) : warning 203: symbol is never used: "ShowDir"
l4d_machine.sp(68 -- 1202) : warning 203: symbol is never used: "StopClientCarry"
l4d_machine.sp(100) : warning 204: symbol is assigned a value that is never used: "g_iVelocity"
Header size: 4780 bytes
Code size: 30344 bytes
Data size: 9612 bytes
Stack/heap size: 16384 bytes; Total requirements: 61120 bytes

12 Warnings.

alexip121093 08-13-2011 12:25

Re: [L4D & L4D2] Intelligent Machine Gun
 
Quote:

Originally Posted by panxiaohai (Post 1531555)
Thank you for your guidance.
The beginning of the idea is create a weapon auto attack inftects, the weapon is on your shoulder, like predators in movie, but I find no appropriate model to use, and my hammar tool do not work.
Attachment 90525
Attack range and damage type are written directly in code , not yet make convars.

Another question to ask, the code below do not work in l4d1, the bullet track start from pos but not end with endpos, "info_particle_target" even do not exsit.
Code:

ShowTrack(  Float:pos[3], Float:endpos[3] )

    decl String:temp[32];       
    new target =0;
    if(L4D2Version)target=CreateEntityByName("info_particle_target");
    else target=CreateEntityByName("info_target");
    Format(temp, 32, "cptarget%d", target);
    DispatchKeyValue(target, "targetname", temp);   
    TeleportEntity(target, endpos, NULL_VECTOR, NULL_VECTOR);
    ActivateEntity(target);
 
    new particle = CreateEntityByName("info_particle_system");
    if(L4D2Version)    DispatchKeyValue(particle, "effect_name", PARTICLE_WEAPON_TRACER2);
    else DispatchKeyValue(particle, "effect_name", PARTICLE_WEAPON_TRACER);
    DispatchKeyValue(particle, "cpoint1", temp);
    DispatchSpawn(particle);
    ActivateEntity(particle);
    TeleportEntity(particle, pos, NULL_VECTOR, NULL_VECTOR);
    AcceptEntityInput(particle, "start");   
    CreateTimer(0.01, DeleteParticletargets, target, TIMER_FLAG_NO_MAPCHANGE);
    CreateTimer(0.01, DeleteParticles, particle, TIMER_FLAG_NO_MAPCHANGE);
}


yeah info_particle_target only exist in l4d2
I think for l4d1 you should use the same method as before to create the gun fire

ur5efj 08-13-2011 12:36

Re: [L4D & L4D2] Intelligent Machine Gun
 
L 08/13/2011 - 19:29:19: [SM] Native "GetEntProp" reported: Property "m_nButtons" not found (entity 0/worldspawn)
L 08/13/2011 - 19:29:19: [SM] Displaying call stack trace for plugin "l4d_machine.smx":
L 08/13/2011 - 19:29:19: [SM] [0] Line 557, /home/hlds/left4dead2/left4dead2/addons/sourcemod/scripting/include/entity_prop_stocks.inc::GetClientButtons()
L 08/13/2011 - 19:29:19: [SM] [1] Line 128, l4d_machine.sp::entity_shoved()


All times are GMT -4. The time now is 17:10.

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