Ayuto

SPE Effects test code

May 15th, 2013
601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 20.37 KB | None | 0 0
  1. from random import randint
  2.  
  3. import es
  4. import spe_effects
  5.  
  6. from playerlib import getPlayer
  7.  
  8. def player_jump(ev):
  9.     # Call the example function
  10.     armorRicochet(int(ev['userid']))
  11.  
  12. def armorRicochet(userid):
  13.     '''
  14.    Creates an armor ricochet with a random direction in the near of the given
  15.    user ID.
  16.    '''
  17.  
  18.     spe_effects.armorRicochet(
  19.         '#all',                                             # users
  20.         0,                                                  # fDelay
  21.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  22.         tuple(randint(0, 10) for x in xrange(3))            # vDirection
  23.     )
  24.  
  25. def radioIcon(userid):
  26.     '''
  27.    Creates an exclamation mark above the player's head.
  28.    '''
  29.  
  30.     spe_effects.radioIcon(
  31.         '#all', # users
  32.         0,      # fDelay
  33.         userid, # iUserID
  34.     )
  35.  
  36. def beamEntPoint(userid):
  37.     '''
  38.    Connects the player with a laser beam.
  39.    '''
  40.  
  41.     spe_effects.beamEntPoint(
  42.         '#all',                       # users
  43.         0,                            # fDelay
  44.         getPlayer(userid).index,      # iStartEntityIndex
  45.         0,                            # vStartOrigin
  46.         0,                            # iEndEntityIndex
  47.         es.getplayerlocation(userid), # vEndOrigin
  48.         'sprites/laser.vmt',          # szModelPath
  49.         0,                            # iHaloIndex
  50.         0,                            # iStartFrame
  51.         255,                          # iFrameRate
  52.         5,                            # fLife
  53.         3,                            # fWidth
  54.         3,                            # fEndWidth
  55.         0,                            # fFadeLength
  56.         5,                            # fAmplitude
  57.         randint(0, 255),              # iRed
  58.         randint(0, 255),              # iGreen
  59.         randint(0, 255),              # iBlue
  60.         255,                          # iAlpha
  61.         1,                            # iSpeed
  62.     )
  63.  
  64. def beamEnts(userid):
  65.     '''
  66.    Connects the given user ID with another player by a laser beam.
  67.    '''
  68.  
  69.     other = getOtherPlayer(userid)
  70.     if not other:
  71.         return es.tell(userid, 'No other player found.')
  72.  
  73.     spe_effects.beamEnts(
  74.         '#all',                  # users
  75.         0,                       # fDelay
  76.         getPlayer(userid).index, # iStartEntityIndex
  77.         getPlayer(other).index,  # iEndEntityIndex
  78.         'sprites/laser.vmt',     # szModelPath
  79.         0,                       # iHaloIndex
  80.         0,                       # iStartFrame
  81.         255,                     # iFrameRate
  82.         3,                       # fLife
  83.         3,                       # fWidth
  84.         0,                       # fEndWidth
  85.         0,                       # fFadeLength
  86.         0,                       # fAmplitude
  87.         randint(0, 255),         # iRed
  88.         randint(0, 255),         # iGreen
  89.         randint(0, 255),         # iBlue
  90.         255,                     # iAlpha
  91.         1,                       # iSpeed
  92.     )
  93.  
  94. def beamFollow(userid):
  95.     '''
  96.    Creates a following laser beam.
  97.    '''
  98.  
  99.     spe_effects.beamFollow(
  100.         '#all',                  # users
  101.         0,                       # fDelay
  102.         getPlayer(userid).index, # iEntityIndex
  103.         'sprites/laser.vmt',     # szModelPath
  104.         0,                       # iHaloIndex
  105.         2,                       # fLife
  106.         3,                       # fWidth
  107.         3,                       # fEndWidth
  108.         0,                       # fFadeLength
  109.         randint(0, 255),         # iRed
  110.         randint(0, 255),         # iGreen
  111.         randint(0, 255),         # iBlue
  112.         255                      # iAlpha
  113.     )
  114.  
  115. def beamPoints(userid):
  116.     '''
  117.    Creates a laser beam in the near of the given player.
  118.    '''
  119.  
  120.     origin1 = es.getplayerlocation(userid)
  121.     origin2 = tuple(x+100 for x in origin1)
  122.  
  123.     spe_effects.beamPoints(
  124.         '#all',              # users
  125.         0,                   # fDelay
  126.         origin1,             # vStartOrigin
  127.         origin2,             # vEndOrigin
  128.         'sprites/laser.vmt', # szModelPath
  129.         0,                   # iHaloIndex
  130.         0,                   # iStartFrame
  131.         255,                 # iFrameRate
  132.         3,                   # fLife
  133.         3,                   # fWidth
  134.         3,                   # fEndWidth
  135.         0,                   # fFadeLength
  136.         0,                   # fAmplitude
  137.         randint(0, 255),     # iRed
  138.         randint(0, 255),     # iGreen
  139.         randint(0, 255),     # iBlue
  140.         255,                 # iAlpha
  141.         1,                   # iSpeed
  142.     )
  143.  
  144. def beamRing(userid):
  145.     '''
  146.    Connects the given player with another player by a beam ring.
  147.    '''
  148.  
  149.     other = getOtherPlayer(userid)
  150.     if not other:
  151.         return es.tell(userid, 'No other player found.')
  152.  
  153.     spe_effects.beamRing(
  154.         '#all',                  # users
  155.         0,                       # fDelay
  156.         getPlayer(userid).index, # iStartEntityIndex
  157.         getPlayer(other).index,  # iEndEntityIndex
  158.         'sprites/laser.vmt',     # szModelPath
  159.         0,                       # iHaloIndex
  160.         0,                       # iStartFrame
  161.         255,                     # iFrameRate
  162.         3,                       # fLife
  163.         3,                       # fWidth
  164.         0,                       # iSpread
  165.         5,                       # fAmplitude
  166.         randint(0, 255),         # iRed
  167.         randint(0, 255),         # iGreen
  168.         randint(0, 255),         # iBlue
  169.         255,                     # iAlpha
  170.         1,                       # iSpeed
  171.         0,                       # iFlags
  172.     )
  173.  
  174. def beamRingPoint(userid):
  175.     '''
  176.    Creates an expanding ring at the players location.
  177.    '''
  178.  
  179.     spe_effects.beamRingPoint(
  180.         '#all',                       # users
  181.         0,                            # fDelay
  182.         es.getplayerlocation(userid), # vOrigin
  183.         0,                            # fStartRadius
  184.         500,                          # fEndRadius
  185.         'sprites/fire.vmt',           # szModelPath
  186.         0,                            # iHaloIndex
  187.         0,                            # iStartFrame
  188.         255,                          # iFrameRate
  189.         3,                            # fLife
  190.         3,                            # fWidth
  191.         0,                            # iSpread
  192.         0,                            # fAmplitude
  193.         randint(0, 255),              # iRed
  194.         randint(0, 255),              # iGreen
  195.         randint(0, 255),              # iBlue
  196.         255,                          # iAlpha
  197.         1,                            # iSpeed
  198.         0,                            # iFlags
  199.     )
  200.  
  201. def bloodSprite(userid):
  202.     '''
  203.    Creates a blood sprite in the near of the given player.
  204.    '''
  205.  
  206.     spe_effects.bloodSprite(
  207.         '#all',                                             # users
  208.         0,                                                  # fDelay
  209.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  210.         (0, 0, 0),                                          # vDirection
  211.         randint(0, 255),                                    # iRed
  212.         randint(0, 255),                                    # iGreen
  213.         randint(0, 255),                                    # iBlue
  214.         255,                                                # iAlpha
  215.         1,                                                  # iSize
  216.     )
  217.  
  218. def bloodStream(userid):
  219.     '''
  220.    Creates a colored blood stream in the near of the player. Somehow the
  221.    texture is pick/black.
  222.    '''
  223.  
  224.     spe_effects.bloodStream(
  225.         '#all',                                             # users
  226.         0,                                                  # fDelay
  227.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  228.         (0, 0, 0),                                          # vDirection
  229.         randint(0, 255),                                    # iRed
  230.         randint(0, 255),                                    # iGreen
  231.         randint(0, 255),                                    # iBlue
  232.         255,                                                # iAlpha
  233.         10,                                                 # iAmount
  234.     )
  235.  
  236. def breakModel(userid):
  237.     '''
  238.    Creates the wooden barrels in the near of the given player.
  239.    '''
  240.  
  241.     spe_effects.breakModel(
  242.         '#all',                                             # users
  243.         0,                                                  # fDelay
  244.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  245.         (0, 0, 0),                                          # vAngle
  246.         (1, 1, 1),                                          # vSize
  247.         (10, 10, 10),                                       # vVelocity
  248.         'models/props_c17/woodbarrel001.mdl',               # szModelPath
  249.         300,                                                # iRandomization
  250.         3,                                                  # iCount
  251.         3,                                                  # fTime
  252.         0,                                                  # iFlags
  253.     )
  254.  
  255. def bubbleTrail(userid):
  256.     '''
  257.    Creates a line of bubbles in the near of the given player.
  258.    '''
  259.  
  260.     origin1 = es.getplayerlocation(userid)
  261.     origin2 = tuple(x+200 for x in origin1)
  262.  
  263.     spe_effects.bubbleTrail(
  264.         '#all',               # users
  265.         0,                    # fDelay
  266.         origin1,              # vStartOrigin
  267.         origin2,              # vEndOrigin
  268.         200,                  # fWaterlevel
  269.         'sprites/bubble.vmt', # szModelPath
  270.         100,                  # iCount
  271.         1,                    # fSpeed
  272.     )
  273.  
  274. def bubbles(userid):
  275.     '''
  276.    Creates some laser balls in the near of the given player.
  277.    '''
  278.  
  279.     origin1 = es.getplayerlocation(userid)
  280.     origin2 = tuple(x+100 for x in origin1)
  281.  
  282.     spe_effects.bubbles(
  283.         '#all',                          # users
  284.         0,                               # fDelay
  285.         origin1,                         # vStartOrigin
  286.         origin2,                         # vEndOrigin
  287.         200,                             # fHeight
  288.         'sprites/strider_blackball.vmt', # szModelPath
  289.         100,                             # iCount
  290.         75,                              # fSpeed
  291.     )
  292.  
  293. def dust(userid):
  294.     '''
  295.    Creates a dust clound in the near of the given player.
  296.    '''
  297.  
  298.     spe_effects.dust(
  299.         '#all',                                             # users
  300.         0,                                                  # fDelay
  301.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  302.         (0, 0, 0),                                          # vDirection
  303.         100,                                                # fSize
  304.         1,                                                  # fSpeed
  305.     )
  306.  
  307. def dynamicLight(userid):
  308.     '''
  309.    Creates a random colored light in the near of the given player.
  310.    '''
  311.  
  312.     spe_effects.dynamicLight(
  313.         '#all',                                             # users
  314.         0,                                                  # fDelay
  315.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  316.         randint(0, 255),                                    # iRed
  317.         randint(0, 255),                                    # iGreen
  318.         randint(0, 255),                                    # iBlue
  319.         6,                                                  # iExponent
  320.         600,                                                # fRadius
  321.         5,                                                  # fTime
  322.         3,                                                  # fDecay
  323.     )
  324.  
  325. def energySplash(userid):
  326.     '''
  327.    Creates an energy splash in the near of the given player.
  328.    '''
  329.  
  330.     spe_effects.energySplash(
  331.         '#all',                                             # users
  332.         0,                                                  # fDelay
  333.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  334.         tuple(randint(0, 100) for x in xrange(3)),          # vDirection
  335.         1,                                                  # bExplode
  336.     )
  337.  
  338. def explosion(userid):
  339.     '''
  340.    Creates an explosion in the near of the given player.
  341.    '''
  342.  
  343.     spe_effects.explosion(
  344.         '#all',                                             # users
  345.         0,                                                  # fDelay
  346.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  347.         0,                                                  # iModelIndex
  348.         1,                                                  # fScale
  349.         255,                                                # iFrameRate
  350.         0,                                                  # iFlags
  351.         300,                                                # iRadius
  352.         1,                                                  # iMagnitude
  353.         0,                                                  # vNormal
  354.         'C',                                                # szMaterialType
  355.     )
  356.  
  357. def glowSprite(userid):
  358.     '''
  359.    Creates a blue glow sprite at the player's location.
  360.    '''
  361.  
  362.     spe_effects.glowSprite(
  363.         '#all',                       # users
  364.         0,                            # fDelay
  365.         es.getplayerlocation(userid), # vOrigin
  366.         'sprites/blueglow2.vmt',      # szModelPath
  367.         5,                            # fLife
  368.         3,                            # fSize
  369.         255,                          # iBrightness
  370.     )
  371.  
  372. def largeFunnel(userid):
  373.     '''
  374.    Creates a large funnel in the near of the player.
  375.    '''
  376.  
  377.     spe_effects.largeFunnel(
  378.         '#all',                                             # users
  379.         0,                                                  # fDelay
  380.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  381.         0,                                                  # szModelPath
  382.         1,                                                  # iReversed
  383.     )
  384.  
  385. def metalSparks(userid):
  386.     '''
  387.    Creates some metal sparks in the near of the given player.
  388.    '''
  389.  
  390.     spe_effects.metalSparks(
  391.         '#all',                                             # users
  392.         0,                                                  # fDelay
  393.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  394.         (randint(0, 100) for x in xrange(3)),               # vDirection
  395.     )
  396.  
  397. def muzzleFlash(userid):
  398.     '''
  399.    Creates a cool muzzle flash in the near of the given player.
  400.    '''
  401.  
  402.     spe_effects.muzzleFlash(
  403.         '#all',                                             # users
  404.         0,                                                  # fDelay
  405.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  406.         (0, 0, 0),                                          # vAngles
  407.         1,                                                  # fScale
  408.         4,                                                  # iType
  409.     )
  410.  
  411. def physicsProp(userid):
  412.     '''
  413.    Creates a wooden barrel, which is pushed away.
  414.    '''
  415.  
  416.     spe_effects.physicsProp(
  417.         '#all',                                             # users
  418.         0,                                                  # fDelay
  419.         'models/props_c17/woodbarrel001.mdl',               # szModelPath
  420.         1,                                                  # iSkin
  421.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  422.         (90, 90, 0),                                        # vAngles
  423.         (200, 200, 0),                                      # vVelocity
  424.         0,                                                  # iFlags
  425.         0,                                                  # iEffects
  426.     )
  427.  
  428. def shatterSurface(userid):
  429.     '''
  430.    Creates broken glass in the near of the player.
  431.    '''
  432.  
  433.     spe_effects.shatterSurface(
  434.         '#all',                                             # users
  435.         0,                                                  # fDelay
  436.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  437.         (0, 0, 0),                                          # vAngle
  438.         (0, 0, 0),                                          # vForce
  439.         (0, 0, 0),                                          # vForceOrigin
  440.         100,                                                # fWidth
  441.         100,                                                # fHeight
  442.         10,                                                 # fShardsize
  443.         0,                                                  # iSurfacetype
  444.         0,                                                  # iFrontR
  445.         randint(0, 255),                                    # iFrontG
  446.         randint(0, 255),                                    # iFrontB
  447.         randint(0, 255),                                    # iBackR
  448.         randint(0, 255),                                    # ibackG
  449.         randint(0, 255)                                     # ibackB
  450.     )
  451.  
  452. def showLine(userid):
  453.     '''
  454.    Creates a beam. Somehow the texture is pink/black.
  455.    '''
  456.  
  457.     origin1 = es.getplayerlocation(userid)
  458.     origin2 = (origin1[0]+100, origin1[1]+100, origin1[2])
  459.  
  460.     spe_effects.showLine(
  461.         '#all',  # users
  462.         0,       # fDelay
  463.         origin1, # vStartOrigin
  464.         origin2  # vEndOrigin
  465.     )
  466.  
  467. def smoke(userid):
  468.     '''
  469.    Creates a smoke cloud in the near of the player.
  470.    '''
  471.  
  472.     spe_effects.smoke(
  473.         '#all',                                             # users
  474.         0,                                                  # fDelay
  475.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  476.         0,                                                  # iModelIndex
  477.         10,                                                 # fScale
  478.         255                                                 # iFrameRate
  479.     )
  480.  
  481. def sparks(userid):
  482.     '''
  483.    Creates some sparks in the near of the given player.
  484.    '''
  485.  
  486.     spe_effects.sparks(
  487.         '#all',                                             # users
  488.         0,                                                  # fDelay
  489.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  490.         2,                                                  # iMagnitude
  491.         1,                                                  # iTrailLength
  492.         (randint(0, 100) for x in xrange(3))                # vDirection
  493.     )
  494.  
  495. def sprite(userid):
  496.     '''
  497.    Creates an animated glow sprite in the near of the given player.
  498.    '''
  499.  
  500.     spe_effects.sprite(
  501.         '#all',                                             # users
  502.         0,                                                  # fDelay
  503.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  504.         'sprites/animglow01.vmt',                           # szModelPath
  505.         2,                                                  # fSize
  506.         255,                                                # iBrightness
  507.     )
  508.  
  509. def spriteSpray(userid):
  510.     '''
  511.    Creates a couple of bubbles, which are pushed in a random direction.
  512.    '''
  513.  
  514.     spe_effects.spriteSpray(
  515.         '#all',                                             # users
  516.         0,                                                  # fDelay
  517.         tuple(x+100 for x in es.getplayerlocation(userid)), # vOrigin
  518.         tuple(randint(0, 100) for x in xrange(3)),          # vDirection
  519.         'sprites/bubble.vmt',                               # szModelPath
  520.         10,                                                 # iSpeed
  521.         1,                                                  # fNoise
  522.         7,                                                  # iCount
  523.         )
  524.  
  525. def worldDecal(userid):
  526.     '''
  527.    Creates a small crate at the player's location.
  528.    '''
  529.  
  530.     spe_effects.worldDecal(
  531.         '#all',                        # users
  532.         0,                             # fDelay
  533.         es.getplayerlocation(userid),  # vOrigin
  534.         'decals/decal_crater001a.vmt', # szModelPath
  535.     )
  536.  
  537. def getOtherPlayer(userid):
  538.     userid = int(userid)
  539.     for player in es.getUseridList():
  540.         if userid != player:
  541.             return player
Advertisement
Add Comment
Please, Sign In to add comment