HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Snag in Caster System

05-18-2007, 04:17 PM#1
Ammorth
I seem to have hit a slight problem in the caster system. I could be wrong, but it just looks like it.

I'm using the damage options system in the Caster System, and after my channel spell is stunned, the function GetDamageFactor() doesn't deal damage to the target unit which makes the unit unable to be hit and return false.

Now, I have modified the caster system slightly to include debugging messages, and the data does not seem to be consistent. The damage type and attack type are set, The hurt unit exists, and with the correct health; but for some reason, no damage is detected.

I have attached the spell map, with the modified caster system in hopes someone could help me out. I will be gone for a few days, but will be able to check back about 10 hours from now, and hope to have this glitch solved before the spell session is over.

In the test map, learn the ability "Storm Of Sortilege", head to the salamander, directly west of the caster, and cast it on them. You will notice text appear (the debug text) and everything works fine. One of the salamander should stun you and end the channel, so wait until it recharges and try again. Now, the spell will deal no damage, and there will be no damage dealt to the unit with the GetDamageFactor() function.

Again, thanks in advance to those who can help.
Attached Files
File type: w3xWierd Error.w3x (165.4 KB)
05-18-2007, 04:28 PM#2
Vexorian
For speed I use an only unit for all the game to test damage, if something happens to that unit DamageFactor may get ruined. That should be a good start point for a research.

Edit: I changed it:
Collapse JASS:
                                call BJDebugMsg("HP: "+R2S(hp)+" ... "+R2S(GetRandomReal(0,1)))// Added
                                call BJDebugMsg("MP: "+R2S(mana))// Added
                                call BJDebugMsg("AType: "+I2S(CS_H2I(cs_dopt_Atype)))//Added
                                call BJDebugMsg("DType: "+I2S(CS_H2I(cs_dopt_Dtype)))//Added
                                call BJDebugMsg("Unit: "+GetUnitName(cs_dmg_caster) )//Added

It eventually says "Unit : " , in the beginning when everything works correctly it says "Unit : caster" , something is removing that unit.
05-18-2007, 05:52 PM#3
Ammorth
hmm, I see what you mean.

I checked the compiled map script and there is no reference to cs_dmg_caster that seems to be out of place, so I thought maybe its being told to damage itself.

Added stuff to the debug:
Collapse JASS:
                                call BJDebugMsg("HP: "+R2S(hp)+" ... "+R2S(GetRandomReal(0,1)))// Added
                                call BJDebugMsg("MP: "+R2S(mana))// Added
                                call BJDebugMsg("AType: "+I2S(CS_H2I(cs_dopt_Atype)))//Added
                                call BJDebugMsg("DType: "+I2S(CS_H2I(cs_dopt_Dtype)))//Added
                                call BJDebugMsg("UnitCast: "+GetUnitName(cs_dmg_caster) )//Added
                                call BJDebugMsg("UnitCastID: "+I2S(CS_H2I(cs_dmg_caster)) )//Added
                                if GetUnitTypeId(cs_dmg_caster)==cs_CasterUnitId then //Added
                                    call BJDebugMsg("|cffff0000Caster ID same!|r")//Added
                                endif //Added
                                if cs_dmg_caster!=null then //Added
                                    call BJDebugMsg("|cffff0000Caster Does Exist!|r")//Added
                                endif //Added
                                call BJDebugMsg("UnitHit: "+GetUnitName(u) )//Added

It seems that the caster is targeted with my EnumUnitsInRangeByOptions but I have added a safety, and it catches a few casters being picked (you can see when ERROR is printed).
Collapse JASS:
function EnumUnitsInRangeByOptions takes group whichGroup, real x, real y, real radius, integer filter, unit caster returns nothing
    local group tempG = CreateGroup()
    local unit u
    call GroupEnumUnitsInRange(tempG, x, y, radius, null)
    loop
        set u = FirstOfGroup(tempG)
        exitwhen u == null
        if GetUnitTypeId(u)==cs_CasterUnitId then
            call BJDebugMsg("|cffffcc00ERROR!|r")
        else
        if GetDamageFactorByOptions(caster, u, filter)!=0.0 then
            call GroupAddUnit(whichGroup, u)
        endif
        endif
        call GroupRemoveUnit(tempG, u)
    endloop
    set u = null
    call DestroyGroup(tempG)
endfunction

No idea what is going wrong...

I went through the caster system and commented out all the times you null a timer, but still it errors....

Its weird that the unit just suddenly disappears and starts returning null... I guess if it returns null, I could just create a new damage, but I would like to find out what is causing this...

Attached the modified map.
Attached Files
File type: w3xWierd Error.w3x (166.2 KB)
05-18-2007, 06:12 PM#4
Vexorian
nulling the timers is unrelated.

It is not exactly an error to pick up that unit, I made the mistake of removing Aloc from cs_dmg_caster , so just change that function so it doesn't add casters to the group, I'll see what I can do to make the whole cs_dmg_caster keep working yet without this issue.
05-22-2007, 03:41 AM#5
Ammorth
I added a caster block, and it was still being removed, so I checked for when it did, and it appears it dies:

Trigger:
Untitled Trigger 003
Collapse Events
Unit - A unit Dies
Conditions
Collapse Actions
Game - Display to (All players) for 30.00 seconds the text: (Name of (Triggering unit))
Custom script: if GetTriggerUnit() == cs_dmg_caster then
Game - Display to (All players) for 30.00 seconds the text: This is the Damager!
Custom script: endif
Will display:

caster
This is the Damager!

after some time, and then the spell bugs.

I thought it has to do with the fact that the damage is being killed by units, so I changed the settings of the unit, and it seems to have fixed the problem. I just gave it 99 base defense, 1000 health and 100 hp per second always (as well as excluding it from all damage situations).

I suggest you do the same with the caster system.
05-22-2007, 03:49 AM#6
Vexorian
It is a damage area function that needs to have checks for it.

I think that the best would be to add resistant skin if I am right that it can block a damage percent.
05-22-2007, 04:06 AM#7
Ammorth
I don't think its entirely the caster system thats killing it. Conventional spells may have hindered the caster, since it doesn't have locust on it.

One other thing (un-related) about the JassHelper:

Using a private function within a timer callback doesn't include the private prefix during map save, yet Condition() does, so it produces an error with the function not existing.
05-22-2007, 02:01 PM#8
Vexorian
That's odd since both Condition and timer callbacks use the same syntax for code arguments, got some code?
05-22-2007, 02:29 PM#9
Ammorth
I changed them to public, and it worked. I tried changing it all back to private, and it works now too. I must have missed something. If it happens again, I shall inform you and save the code.