Archived copy of warcraft-source.com, the Warcraft: Source (WCS) forum (2007–2011), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2010-03-30 (original capture). Home · Forum · All archived topics · Downloads

Author Topic: [Helpfull] Effect lib for Python  (Read 284 times)

Offline AvasT

  • Level 7 Expert
  • *****
  • Posts: 825
[Helpfull] Effect lib for Python
« on: December 28, 2009, 09:11:23 PM »
Well if you understand python and you want to create effects you should check this:
Code: (python) [Select]
import es
import vecmath
from vecmath import vector

import psyco
psyco.full()


"""
effectlib, holds functions for some special effects
"""

def drawLine(coord1, coord2,
            model="materials/sprites/laser.vmt",
            halo="materials/sprites/halo01.vmt",
            seconds=0,
            width=10,
            endwidth=10,
            red=255,
            green=255,
            blue=255,
            brightness=255,
            speed=10,
            fadelength=0,
            noise=0,
            framestart=0,
            framerate=0):
    """
Draw a line between two coordinates
    """
    try:
        c1 = vector(coord1)
        c2 = vector(coord2)
    except TypeError:
        raise TypeError, "Invalid parameter type for coordinates"
    # Draw it!
    mi = es.precachemodel(model)
    hi = es.precachemodel(halo)
    es.effect('beam', str(c1), str(c2), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)


def drawBox(coord1, coord2,
            model="materials/sprites/laser.vmt",
            halo="materials/sprites/halo01.vmt",
            seconds=0,
            width=10,
            endwidth=10,
            red=255,
            green=255,
            blue=255,
            brightness=255,
            speed=10,
            fadelength=0,
            noise=0,
            framestart=0,
            framerate=0):
    """
Draw a rectangular box by using two coordinates
    """
    try:
        c1 = vector(coord1)
        c2 = vector(coord2)
    except TypeError:
        raise TypeError, "Invalid parameter type for coordinates"
    # Create the additional corners for the box
    tc1 = vector(c1)
    tc2 = vector(c1)
    tc3 = vector(c1)
    tc4 = vector(c2)
    tc5 = vector(c2)
    tc6 = vector(c2)
    tc1[0] = c2[0]
    tc2[1] = c2[1]
    tc3[2] = c2[2]
    tc4[0] = c1[0]
    tc5[1] = c1[1]
    tc6[2] = c1[2]
    # Draw all the edges
    mi = es.precachemodel(model)
    hi = es.precachemodel(halo)
    es.effect('beam', str(c1), str(tc1), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(c1), str(tc2), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(c1), str(tc3), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(tc6), str(tc1), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(tc6), str(tc2), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(tc6), str(c2), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(tc4), str(c2), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(tc5), str(c2), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(tc5), str(tc1), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(tc5), str(tc3), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(tc4), str(tc3), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
    es.effect('beam', str(tc4), str(tc2), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)


def drawCircle(origin, radius, steps=12,
            axle1=(1,0,0),
            axle2=(0,1,0),
            normal=None,
            model="materials/sprites/laser.vmt",
            halo="materials/sprites/halo01.vmt",
            seconds=0,
            width=10,
            endwidth=10,
            red=255,
            green=255,
            blue=255,
            brightness=255,
            speed=10,
            fadelength=0,
            noise=0,
            framestart=0,
            framerate=0):
    """
Draw a circle on a plane defined by origin and two points (axles)
    """
    try:
        o = vector(origin)
        a1 = vector(axle1)
        if not normal:
            a2 = vector(axle2)
            normal = a1.cp(a2)
    except TypeError:
        raise TypeError, "Invalid parameter type for coordinates"
   
    # normalize steps to be modular by 4, rounding up
    steps = int(float(steps)/4.0+.9)*4
    # calculate steps per line
    edgesteps = steps/4

    # generate the corner vectors
    k = []
    k.append(a1.setlength(radius))
    k.append(normal.cp(a1).setlength(radius))
    k.append(-k[0])
    k.append(-k[1])
    k.append(k[0])

    # distance between steps
    steplength = vecmath.distance(k[0],k[1])/edgesteps
   
    # Draw all the edges
    mi = es.precachemodel(model)
    hi = es.precachemodel(halo)
    for edge in range(4):
        c1 = o+k[edge]
        minus = k[edge+1]-k[edge]
        for s in range(edgesteps):
            c2 = o+(k[edge]+minus.setlength(steplength*(s+1))).setlength(radius)
            es.effect('beam', str(c1), str(c2), mi, hi,
              framestart, framerate,
              seconds, width, endwidth, fadelength, noise,
              red, green, blue, brightness, speed)
            c1 = c2

I'll be sincere with you guys, i don't fucking understand NOTHING from this shit, but DanMister was piecing me off(not only me but texno and other guys) and i was playing with eventscripts and checking some things then i saw this shit and got it, enjoy
Obs:Don't ask me NOTHING
Lol?

Offline DanMister

  • Level 7 Expert
  • *****
  • Posts: 205
  • no autographs, please.
Re: [Helpfull] Effect lib for Python
« Reply #1 on: December 28, 2009, 09:49:11 PM »
how was I "peicing" you off?
oh, and thanks for giving this too me XD.
« Last Edit: December 28, 2009, 09:59:52 PM by DanMister »
Quote


Quote
"Genius may have its limitations, but stupidity is not thus handicapped."   Elbert Hubbard


Offline CA.Berettonawak

  • Le renomm� m�connu...
  • Watchdogs
  • Level 7 Expert
  • *****
  • Posts: 3052
  • Big Berettonawak is watching you...
    • Coding-Alliance.Com : A bunch of coders? Why not a bunch of players? :P
Re: [Helpfull] Effect lib for Python
« Reply #2 on: December 29, 2009, 06:57:59 PM »
Again already exists?
Taken from ES wiki..
http://python.eventscripts.com/pages/Effectlib
Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.

Quote from: myself
i love tuna juice :D

Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD

Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed


Offline <---Texno--->

  • Level 7 Expert
  • *****
  • Posts: 1004
  • < Need Help ? >
    • Zero-Asylum !
Re: [Helpfull] Effect lib for Python
« Reply #3 on: December 29, 2009, 07:04:20 PM »
he didn't take credits.

Offline CA.Berettonawak

  • Le renomm� m�connu...
  • Watchdogs
  • Level 7 Expert
  • *****
  • Posts: 3052
  • Big Berettonawak is watching you...
    • Coding-Alliance.Com : A bunch of coders? Why not a bunch of players? :P
Re: [Helpfull] Effect lib for Python
« Reply #4 on: December 29, 2009, 08:00:52 PM »
Did i ever say you took credits?
Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.

Quote from: myself
i love tuna juice :D

Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD

Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed


Offline gimik

  • Level 7 Expert
  • *****
  • Posts: 263
Re: [Helpfull] Effect lib for Python
« Reply #5 on: December 29, 2009, 08:07:17 PM »
If your saying he didn't take credit then
Again already exists?
Taken from ES wiki..
http://python.eventscripts.com/pages/Effectlib

was totally unnecessary, the way you said it made it sound like your accusing him of taking it, you could have just provided a link to the already existing topic and said "You can also go here for more info"




Offline CA.Berettonawak

  • Le renomm� m�connu...
  • Watchdogs
  • Level 7 Expert
  • *****
  • Posts: 3052
  • Big Berettonawak is watching you...
    • Coding-Alliance.Com : A bunch of coders? Why not a bunch of players? :P
Re: [Helpfull] Effect lib for Python
« Reply #6 on: December 29, 2009, 08:10:00 PM »
No, i just pointed the fact that it is pointless to repost something already existing!
Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.

Quote from: myself
i love tuna juice :D

Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD

Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed


Offline gimik

  • Level 7 Expert
  • *****
  • Posts: 263
Re: [Helpfull] Effect lib for Python
« Reply #7 on: December 29, 2009, 08:24:11 PM »
Not necessarily because if the post is long gone, lost in the pages of the search function, a fresh topic would be easier to find xD




Offline CA.Berettonawak

  • Le renomm� m�connu...
  • Watchdogs
  • Level 7 Expert
  • *****
  • Posts: 3052
  • Big Berettonawak is watching you...
    • Coding-Alliance.Com : A bunch of coders? Why not a bunch of players? :P
Re: [Helpfull] Effect lib for Python
« Reply #8 on: December 29, 2009, 08:38:48 PM »
Not necessarily because if the post is long gone, lost in the pages of the search function, a fresh topic would be easier to find xD

Wait, you're making a confusion with Avast's other tutorial :P !
Here we're talking about the page on ESP Wiki :P
Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.

Quote from: myself
i love tuna juice :D

Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD

Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed


Offline AvasT

  • Level 7 Expert
  • *****
  • Posts: 825
Re: [Helpfull] Effect lib for Python
« Reply #9 on: December 29, 2009, 09:17:20 PM »
I just said i didn't took it from there --', i took it FROM corelib/effectlib.py, damn fuck, why are you flaming on me?
Lol?

Offline CA.Berettonawak

  • Le renomm� m�connu...
  • Watchdogs
  • Level 7 Expert
  • *****
  • Posts: 3052
  • Big Berettonawak is watching you...
    • Coding-Alliance.Com : A bunch of coders? Why not a bunch of players? :P
Re: [Helpfull] Effect lib for Python
« Reply #10 on: December 29, 2009, 09:58:28 PM »
I've never been flaming on you -.-
Now,it's the same, wherever you took it from.
Just like if i post here es_playergetset.txt.. i could just post a link to www.eventscripts.com/pages/Playergetset
Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.

Quote from: myself
i love tuna juice :D

Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD

Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed


Offline CA.Berettonawak

  • Le renomm� m�connu...
  • Watchdogs
  • Level 7 Expert
  • *****
  • Posts: 3052
  • Big Berettonawak is watching you...
    • Coding-Alliance.Com : A bunch of coders? Why not a bunch of players? :P
Re: [Helpfull] Effect lib for Python
« Reply #11 on: December 29, 2009, 11:02:10 PM »
Did i EVER say you copied it? Did i EVER say you took credits? Did i ever do anything?
 Just pointing out the fact that this ALREADY exists and it has nothing to do here..
Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.

Quote from: myself
i love tuna juice :D

Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD

Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed


Offline DanMister

  • Level 7 Expert
  • *****
  • Posts: 205
  • no autographs, please.
Re: [Helpfull] Effect lib for Python
« Reply #12 on: December 30, 2009, 12:29:57 AM »
Quote


Quote
"Genius may have its limitations, but stupidity is not thus handicapped."   Elbert Hubbard