Thread: xe0.9
View Single Post
Old 06-28-2008, 05:57 PM   #11
Free Software Terrorist
Vexorian's Avatar

Technical Director
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place


It is not necessary to pause non-periodic timers, There is also nothing to null as I am not using a variable there.


Collapse JASS:
    // you are always allowed to use .create() but you can also use createBasic which sets some things that
    // are usually necessary up.
    public static method createBasic takes integer abilityID, integer orderid, player owner returns xecast
     local xecast r=xecast.allocate()
        if(r==0) then
            debug call BJDebugMsg("Warning: unbelievable but you actually used all xecast instances in your map! Please make sure you are not forgetting to destroy those what you create intensively, if that's not the case, then you'll have to increase xecast MAXINSTANCES")
        set r.abilityid=abilityID
        set r.owningplayer=owner
     return r
Though I should probably add an orderstring version, people like orderstrings for some reason.

Switch: That's an error with xefx's documentation, I was using xecast's as a template and it looks I left some garbage there

  This module just allows you to have movable special effects, they are actually
 dummy units, you can do plenty of things like changing their position, their
 height, their rotation (in the xy and in the z axis as well), color, and things
 like that. It is all about assigning attributes, the only two important methods
 xefx objects have are create and destroy. There are other accessory methods.
  Just copy the xecast trigger to your map.
xecast object

  static method create    takes real x, real y, real facing returns xefx
  This is the create method, it will make a new xefx for you to use, there are 
 initial values you must specify, like the x,y coordinate and the facing angle.
 facing is in radians.

  Eg. set myfx = xefx.create()
  method destroy   takes nothing returns nothing
  This just destroys your xefx object. (call myfx.destroy() )

* List of attributes *

    string fxpath
    Determines the model of the special effect, yes, you may  change it after
 assigning it if necessary to change the model path.
    Example: set myfx.path = "abilities\thisisamadeup\modelpath.mdl"

    real x
    real y
    real z
    Determine the position of your special effect, you can keep moving the
  effect in a periodic loop, etc.
    Example: set myfx.x=myfx.x + 65.0
             set myfx.y=GetUnitY(u)
             set myfx.z=JumpParabola(t)
    real xyangle
    The angle in the xy plane, also called 'facing' angle. (Note: uses radians)
    Example: set myfx.xyangle = AngleBetweenPoints(target, source)*bj_DEGTORAD
    real zangle
    The angle in the z-axis (inclination?), (Note: uses radians)
    Example: set myfx.zangle = bj_PI/2 //Now the model will look towards the sky

    integer r
    integer g
    integer b
    integer a
    Well, the model's vertex coloring in RGB , a is the opacity value (use
 values from 0 to 255 here)
    Example: set myfx.r=255
             set myfx.g=0
             set myfx.b=255
             set myfx.a=128
    method recolor takes integer r, integer g , integer b, integer a returns nothing
    This one assigns all the color values in one pass.

    real scale (write-only)
    Allows you to resize the xefx object, the default scale is 1.
    Example:   set myfx.scale=2.0 //double size (in fact 8x)
               set myfx.scale=0.5 //half size   (in fact 1/8x)
    player owner
    For some reason you might want to change ownership of the effect, for 
  example, if you use abilityid (see bellow) and the ability does damage.
    Example: set myfx.owner = GetOwningPlayer(GetTriggerUnit() )
    integer abilityid
    Well, you may use a xefx object to grab a passive ability, perhaps you need
    it for ye candy reasons or you want to use it as a damage dealer.

        Example: set myfx.abilityid = 'Hphf'
    playercolor teamcolor
    The recycle delay is the time to wait before recycling the dummy caster, if
    it is 0.0 the ability will be considered instant.
    A proper recycle delay is important since when a dummy caster is recycled
    its owner becomes player passive. Every damage done by the casted spell will
    not credit the correct player.
    Some other spells need some time in order to cast correctly. Not to mention
    the channeling ones that require the caster to last during that situation.

        Example: set somevar.recycledelay=10.0
    method flash           takes string modelpath returns nothing
    It shows the dead animation of the model specified by modelpath. This is
    in case you need this sort of eye candy.

(Also i never really got the idea of making a spell that casts more spells it just sounds odd and inefficient, as you could just do the effect of the spell and avoid having to use a caster to cast it at all. The only real reason you would use such a thing would be for having single target spells dealt to a group, and that could even be handled in a picked unit function also.)
The truth is that blizz spells are always going to be more efficient than you coding the effects yourself, there are also many things where dummy casters is just nice. Also your suggestion about groups is not something I agree with, mostly because I think, we should stop using groups that much, I also think a planned vJass feature would make such system unnecessary.
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote