• 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.

[vJASS] XE Bug

Status
Not open for further replies.
Level 13
Joined
Mar 19, 2010
Messages
870
Hey guys,

in my map "Forsaken Bastion's Fall" im using the XE System from Vexorian.
A lot of spells using this system and sometimes i have the problem that the XE units are visible and block other units...

I don't why and when it happens...i mean i can use the spell and all things works perfectly and sometimes i use the spell again and after the use of it the XE units are there and not destroyed.

look here...

attachment.php


Any ideas?

Best Reg.
 

Attachments

  • XE_Bug.jpg
    XE_Bug.jpg
    594 KB · Views: 265
Level 13
Joined
Mar 19, 2010
Messages
870
This affects every spell but as i said, to the beginning of the game there are no problems with all spells.. just later but not always. It's very strange...

As i understand the system, it recycles the XE units and in my opinion there's a point where this part works not as it should but i don't know why.
 
Level 13
Joined
Mar 19, 2010
Messages
870
atm i can't say which spell it is because every spell works perfect and only sometimes the XE units are there... i'll do some test with the xe spells... i give the XE unit a model and i'll check if the XE unit get killed after the spell is over.

Here's an example spell:

JASS:
scope CripplingArrow initializer Init
    /*
     * Description: Gabrielle shoots a poisoned arrow that slows down the targeted unit. 
                    It deals bonus damage if the target is already affected by an arrow.
     * Last Update: 
     * Changelog: 
     *     
     */
    globals
        private constant integer SPELL_ID = 'A0AJ'
        private constant string MAIN_MODEL = "Abilities\\Spells\\Items\\OrbCorruption\\OrbCorruptionMissile.mdl"
        private constant real MAIN_SCALE = 1.0
        private constant real SPEED = 800.0
        private constant real ACCELERATION = 650.0
        private constant real MAX_SPEED = 1000.0
        private constant real MAX_DISTANCE = 1500.0
        
        private constant integer DUMMY_ID = 'e00Z'
        private constant integer CRIPPLE_ID = 'A073'
        private constant integer BUFF_ID = 'B013'
        private constant integer BASE_DAMAGE = 0
        private constant integer DAMAGE_PER_LEVEL = 75
        private constant real MULTIPLIER = 1.5    
        
        //Stun Effect
        private constant string STUN_EFFECT = ""
        private constant string STUN_ATT_POINT = ""
        private constant real STUN_DURATION = 0.5
        
        private xedamage damageOptions
    endglobals
  
    private function setupDamageOptions takes xedamage d returns nothing
       set d.dtype = DAMAGE_TYPE_POISON
       set d.atype = ATTACK_TYPE_PIERCE
       
       set d.exception = UNIT_TYPE_STRUCTURE 
    endfunction

    private struct CripplingArrow extends xecollider 
        unit caster
        integer level
        real dist = 0.00
        real maxDist = MAX_DISTANCE
        
        static method create takes real x, real y, real ang, unit caster returns thistype
            local CripplingArrow this = CripplingArrow.allocate(x, y, ang)
            
            set this.fxpath = MAIN_MODEL
            set this.scale = MAIN_SCALE
            set this.caster = caster 
            set this.level = GetUnitAbilityLevel(caster, SPELL_ID)
            set this.speed = SPEED
            set this.acceleration = ACCELERATION
            set this.maxSpeed = MAX_SPEED

            return this
        endmethod
       
        method onUnitHit takes unit hitunit returns nothing
            local unit u
            
            if (damageOptions.allowedTarget(this.caster, hitunit )) then
                set DamageType = SPELL
                
                if GetUnitAbilityLevel(hitunit, BUFF_ID) > 0 then
                    call UnitDamageTarget(this.caster, hitunit, MULTIPLIER *(BASE_DAMAGE + this.level * DAMAGE_PER_LEVEL), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
                else
                    call UnitDamageTarget(this.caster, hitunit, BASE_DAMAGE + this.level * DAMAGE_PER_LEVEL, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
                endif
                
                set u = CreateUnit(GetOwningPlayer(this.caster), DUMMY_ID, GetUnitX(hitunit), GetUnitY(hitunit), 0)
                call UnitAddAbility(u, CRIPPLE_ID)
                call SetUnitAbilityLevel(u, CRIPPLE_ID, this.level)
                call IssueTargetOrder(u, "cripple", hitunit)
                call UnitApplyTimedLife(u, 'BHwe', 2.0)
                
                //stun to break channel spells
                call Stun_UnitEx(hitunit, STUN_DURATION, false, STUN_EFFECT, STUN_ATT_POINT)
                
                call this.terminate()
            endif
        endmethod

        method loopControl takes nothing returns nothing
            set this.dist = this.dist + this.speed * XE_ANIMATION_PERIOD
            if (this.dist >= this.maxDist) or not IsTerrainWalkable(this.x, this.y) then
                call this.terminate()
            endif
        endmethod
        
        method onDestroy takes nothing returns nothing
            set this.caster = null
        endmethod

   endstruct

    private function Conditions takes nothing returns boolean
        return (GetSpellAbilityId() == SPELL_ID)
    endfunction

    private function Actions takes nothing returns nothing
        local unit caster = GetTriggerUnit()
        local real x = GetSpellTargetX()
        local real y = GetSpellTargetY()
        local real ang = AngleBetweenCords(GetUnitX(caster), GetUnitY(caster), x, y) * bj_DEGTORAD
        
        call CripplingArrow.create(GetUnitX(caster), GetUnitY(caster), ang, caster)

        set caster = null
    endfunction

  
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()

        set damageOptions = xedamage.create()
        call setupDamageOptions(damageOptions)

        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Condition(function Conditions))
        call TriggerAddAction(t, function Actions)
        set t = null
        
        call Preload(MAIN_MODEL)
    endfunction
endscope
 
Level 13
Joined
Mar 19, 2010
Messages
870
AHAAA... i found a first hint!!!
I gave the XE-Unit a model. then i startet a spell ( like a whirlpool spell )... as you can see in the first image, they fly around BUT after this spell ends they stay around instead of get recycled!!! But why?


attachment.php


AFTER the spell is finished...

attachment.php


So, if all spells work like that it could be happened what i have in my map...

i found annother hint for that behaviour... look here... ( library xedummy )

// Don't allow to keep more than DUMMY_STACK_LIMIT inactive dummy units.
private constant integer DUMMY_STACK_LIMIT = 240

But why XE units don't recycle?
 

Attachments

  • img1.jpg
    img1.jpg
    502.2 KB · Views: 240
  • img2.jpg
    img2.jpg
    574.6 KB · Views: 251
Level 13
Joined
Mar 19, 2010
Messages
870
this should make the XE System... but it seems not but why???

LOL: This "bug" is in the original file of Vexorian too :) - Download it, give the XE unit a model and tests some spells...and you'll see the XE units WILL NOT REMOVED... is that correct?
 
Removing a unit = removes the unit from the game, or kills it (e.g. RemoveUnit(), or UnitApplyTimedLife())
Recycling a unit = hides the unit and brings the unit back for use when you ask for another dummy (instead of creating a new one)

Recycling can save constant handle creation/recreation and it is usually better memory-wise in the long run.

Anyway, as for your first screenshot, it may be an issue with hiding the unit. When you hide a unit with locust, and then show it again, the health bar will remain (and it may lose some locust properties). To fix this, you must remove locust when you hide the unit (e.g. before you recycle) and then add locust when you fetch a new dummy. You can either do that for each spell, or you can just edit the system if it doesn't do that already.

At least, that is what it *seems* to be. I'm not sure about the issues you have in the other posts.
 
Status
Not open for further replies.
Top