• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Prevent Cast

This has quite the overhead
struct CastList

Try using an array struct instead.

Also, you should be using a hashtable + unit indexing instead of a linked list to prevent the casting... a linked list is just a really poor choice for this >.>.

Also, these should all be private
JASS:
        thistype next
        thistype prev
        unit caster
        integer abilID
        real cp

And you should have all of your stuff inside the struct. No reason any of it should be outside.

It'd also be neato to have a prevent cast event =).

This might as well go into a module initializer
JASS:
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_CAST)
        call TriggerAddCondition(t,Condition(function onCast))
    endfunction

>.>.

Just try to make it a habit of only using module initializers unless you need your thingie to initialize later =D.

This is bad
call IssueImmediateOrder(c,"stop")

Some abilities don't stop a unit (they keep moving) like berserk.
 
Top