Raised This Month: $89 Target: $400
 22% 

[L4D & L4D2] Intelligent Machine Gun


Post New Thread Reply   
 
Thread Tools Display Modes
Author
panxiaohai
Senior Member
Join Date: Mar 2010
Plugin ID:
2491
Plugin Version:
Plugin Category:
Fun Stuff
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    the intelligent machine guntry to find the enemy and fire automatically
    Old 08-12-2011 , 20:08   [L4D & L4D2] Intelligent Machine Gun
    Reply With Quote #1

    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"

    Attached Thumbnails
    Click image for larger version

Name:	c2m1_highway0019.jpg
Views:	5096
Size:	85.0 KB
ID:	90500   Click image for larger version

Name:	c2m1_highway0041.jpg
Views:	4507
Size:	87.7 KB
ID:	90501   Click image for larger version

Name:	l4d_smalltown01_caves0034.jpg
Views:	4042
Size:	71.2 KB
ID:	90502  
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d_machine.sp - 2261 views - 44.2 KB)
    File Type: smx l4d_machine.smx (24.9 KB, 3210 views)

    Last edited by panxiaohai; 10-17-2011 at 16:35.
    panxiaohai is offline
    KyleS
    SourceMod Plugin Approver
    Join Date: Jul 2009
    Location: Segmentation Fault.
    Old 08-12-2011 , 20:10   Re: [L4D & L4D2] Intelligent Machine Gun
    Reply With Quote #2

    You've forgotten to attach a plugin
    KyleS is offline
    panxiaohai
    Senior Member
    Join Date: Mar 2010
    Old 08-12-2011 , 20:18   Re: [L4D & L4D2] Intelligent Machine Gun
    Reply With Quote #3

    Quote:
    Originally Posted by KyleS View Post
    You've forgotten to attach a plugin
    Upload finished.
    panxiaohai is offline
    alexip121093
    Senior Member
    Join Date: Dec 2009
    Location: Hong Kong
    Old 08-13-2011 , 03:14   Re: [L4D & L4D2] Intelligent Machine Gun
    Reply With Quote #4

    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
    __________________

    Last edited by alexip121093; 08-13-2011 at 03:18.
    alexip121093 is offline
    Send a message via MSN to alexip121093
    panxiaohai
    Senior Member
    Join Date: Mar 2010
    Old 08-13-2011 , 07:02   Re: [L4D & L4D2] Intelligent Machine Gun
    Reply With Quote #5

    Quote:
    Originally Posted by alexip121093 View Post
    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.
    Click image for larger version

Name:	00138658.jpg
Views:	661
Size:	98.9 KB
ID:	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);
    }

    Last edited by panxiaohai; 08-13-2011 at 07:17.
    panxiaohai is offline
    JoBarfCreepy
    Member
    Join Date: Feb 2011
    Location: Next to Sweden and Norwa
    Old 08-13-2011 , 07:36   Re: [L4D & L4D2] Intelligent Machine Gun
    Reply With Quote #6

    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)
    JoBarfCreepy is offline
    megaquake
    New Member
    Join Date: Aug 2011
    Old 08-13-2011 , 11:15   Re: [L4D & L4D2] Intelligent Machine Gun
    Reply With Quote #7

    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

    Last edited by megaquake; 08-13-2011 at 11:24.
    megaquake is offline
    ur5efj
    Member
    Join Date: Jan 2006
    Old 08-13-2011 , 11:26   Re: [L4D & L4D2] Intelligent Machine Gun
    Reply With Quote #8

    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.
    ur5efj is offline
    alexip121093
    Senior Member
    Join Date: Dec 2009
    Location: Hong Kong
    Old 08-13-2011 , 12:25   Re: [L4D & L4D2] Intelligent Machine Gun
    Reply With Quote #9

    Quote:
    Originally Posted by panxiaohai View Post
    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
    __________________
    alexip121093 is offline
    Send a message via MSN to alexip121093
    ur5efj
    Member
    Join Date: Jan 2006
    Old 08-13-2011 , 12:36   Re: [L4D & L4D2] Intelligent Machine Gun
    Reply With Quote #10

    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()
    ur5efj is offline
    Reply


    Thread Tools
    Display Modes

    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 17:42.


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