home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / weapons / Fart.lua < prev    next >
Encoding:
Text File  |  2009-09-13  |  1.9 KB  |  59 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Fart
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, September 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.fart={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.fart.gfx_wpn=loadgfx("weapons/fart.png")                        -- Weapon Image
  13. setmidhandle(cc.fart.gfx_wpn)
  14. cc.fart.sfx_fart=loadsfx("fart.wav")                            -- Fart
  15.  
  16. --------------------------------------------------------------------------------
  17. -- Weapon: fart
  18. --------------------------------------------------------------------------------
  19.  
  20. cc.fart.id=addweapon("cc.fart","Fart",cc.fart.gfx_wpn,0)        -- Add Weapon (0 uses)
  21.  
  22. function cc.fart.draw()                                            -- Draw
  23.     -- Do nothing!
  24. end
  25.  
  26. function cc.fart.attack(attack)                                    -- Attack
  27.     if (weapon_shots<=0) then
  28.         if (attack==1) then
  29.             -- No more weapon switching!
  30.             useweapon(0)
  31.             weapon_shots=weapon_shots+1
  32.             -- Effect
  33.             playsound(cc.fart.sfx_fart)
  34.             for i=1,10,1 do
  35.                 particle(p_smoke,getplayerx(0)-getplayerdirection(0)*math.random(2,5),getplayery(0)+4)
  36.                 particlespeed(getplayerdirection(0)*math.random(5,15)*(-0.1),math.random(-2,2)*0.1)
  37.                 particlealpha(1.0)
  38.                 particlecolor(0,255,0)
  39.                 particlesize(10,10)
  40.                 particlefadealpha(0.015)
  41.             end
  42.             -- Poison Players
  43.             players=playertable()
  44.             for i=1,#players,1 do
  45.                 if getplayerhealth(players[i])>0 and players[i]~=playercurrent() then
  46.                     if math.abs(getplayery(players[i])-getplayery(0))<=25 then
  47.                         if math.abs(getplayerx(players[i])-getplayerx(0))<=80 then
  48.                             if ((getplayerx(players[i])>getplayerx(0)) and getplayerdirection(0)==-1) or ((getplayerx(players[i])<getplayerx(0)) and getplayerdirection(0)==1) then
  49.                                 playerstate(players[i],state_poisoned,1)
  50.                             end
  51.                         end
  52.                     end
  53.                 end
  54.             end
  55.             -- End Turn
  56.             endturn()
  57.         end
  58.     end
  59. end