Critique/Errors. Please.

NeuroToxin

New Member
Reaction score
46
Okay, so I'm making my spell, and I have some unknown errors that I don't know whats wrong, one is on my Polar offset, I use this.
JASS:

        set offsetx = targetloc + 10 * Cos(V.Tfacing)

And it says, "Bad type for binary operator."
Also, I have a group tempgroup thats a local, and it gives me this, "Cannot convert nothing to group." Heres the code for it
JASS:
   
set tempgroup=GroupEnumUnitsInRange(s__Vampiric_Targets[V], offsetx, offsety, 200, Filter(function VampiricStrike___Boolexpr))

I have four of these, so it gives me four errors, out of the 7 I have. Heres the rest of the code.
JASS:

scope VampiricStrike
//==========================SETUP=============================================
    globals
    //The Special Effect of the Blink
        string BLINK_SFX = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
    //The Special Effect of each Attack
        string ATTACK_SFX = "Abilities\\Spells\\Undead\\CarrionSwarm\\CarrionSwarmDamage.mdl"
    //The Special Effect of the Final Attack
        string FINAL_ATTACK_SFX = "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl"
    //If true, then the target that you first targeted will be targeted last for the blink attacks.
        boolean ALWAYS_ATTACK_FIRST = true
    //Ability ID of the Vampiric Strike ability
        integer ABILITY_CODE = 'A000'
    //This is the animation string (Name) of the animation you want to play when the unit is attacked.
        string ATTACK_ANIMATION = "attack"
    //If this boolean is set to true, instead of always finding units in BACK of the attacked, it will find them depending on the units
    //facing. EX. If a unit is attacking you and this triggers, it will be behind, (If you're attacking it) however, if you're attacking a unit
    //from behind, then it blinks you behind you, it won't be of much use, however, if its true it will do that.
        boolean ALWAYS_BACK = false
    //This one is the rate at which you teleport to targets, attack, then find a new target. Higher values can be set for longer visual.
        real KEY_TIMERS_RATE = .25
    //This is the attack type for the damage
        attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL
    //This is the damage type for the damage
        damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL
    //This is the weapon type for the damage
        weapontype WEAPON_TYPE = WEAPON_TYPE_WHOKNOWS
    endglobals
    
    private function DAMAGE takes integer lvl returns real
        return 25 + (lvl * 25.)
    endfunction
    
    private function RANGE_PER_LEVEL takes integer lvl returns real
        return 400 + (lvl * 100.)
    endfunction
    
    private function Boolexpr takes nothing returns boolean
        return IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) != true and IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING) != true
    endfunction
//=======================ENDSETUP=============================================
    struct Vampiric
        unit Caster
        unit Targeted
        group Targets
        real Cfacing
        real Tfacing
        real Maxangle
        real Leastangle
        real Castertoattacked
        real AngleDif
        static integer Structtype
    endstruct
    
    private function Move takes nothing returns nothing
    local Vampiric V = Vampiric.Structtype
    local real damage = DAMAGE(GetUnitAbilityLevel(V.Caster, ABILITY_CODE))
    local real casterx = GetUnitX(V.Caster)
    local real castery = GetUnitY(V.Caster)
    local real targetx = GetUnitX(GetEnumUnit())
    local real targety = GetUnitY(GetEnumUnit())
    local real angle = GetUnitFacing(GetEnumUnit())
    local real offsetx = casterx + 20 * Cos(angle)
    local real offsety = castery + 20 * Sin(angle)
    if GetEnumUnit() != V.Targeted then
        call SetUnitX(V.Caster, offsetx)
        call SetUnitY(V.Caster, offsety)
        call DestroyEffect(AddSpecialEffect(BLINK_SFX, offsetx, offsety))
        call SetUnitAnimation(V.Caster, ATTACK_ANIMATION)
        call UnitDamageTarget(V.Caster, GetEnumUnit(), damage, true, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
        call DestroyEffect(AddSpecialEffect(ATTACK_SFX, targetx, targety))
        call GroupRemoveUnit(V.Targets, GetEnumUnit())
    elseif CountUnitsInGroup(V.Targets) == 1 and ALWAYS_ATTACK_FIRST != true then
        call SetUnitX(V.Caster, offsetx)
        call SetUnitY(V.Caster, offsety)
        call DestroyEffect(AddSpecialEffect(BLINK_SFX, offsetx, offsety))
        call SetUnitAnimation(V.Caster, ATTACK_ANIMATION)
        call UnitDamageTarget(V.Caster, GetEnumUnit(), damage, true, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
        call DestroyEffect(AddSpecialEffect(FINAL_ATTACK_SFX, targetx, targety))
        call GroupRemoveUnit(V.Targets, GetEnumUnit())
    elseif GetEnumUnit() == V.Targeted and ALWAYS_ATTACK_FIRST == true and CountUnitsInGroup(V.Targets) == 1 then
        call SetUnitX(V.Caster, offsetx)
        call SetUnitY(V.Caster, offsety)
        call DestroyEffect(AddSpecialEffect(BLINK_SFX, offsetx, offsety))
        call SetUnitAnimation(V.Caster, ATTACK_ANIMATION)
        call UnitDamageTarget(V.Caster, GetEnumUnit(), damage, true, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
        call DestroyEffect(AddSpecialEffect(FINAL_ATTACK_SFX, targetx, targety))
        call GroupRemoveUnit(V.Targets, GetEnumUnit())
    endif
    endfunction
    
    private function userFunc takes nothing returns boolean
    local Vampiric V = KT_GetData()
        set Vampiric.Structtype = V
        call ForGroup(V.Targets, function Move)
    if CountUnitsInGroup(V.Targets) < 1 then
        call V.destroy()
        return true
    endif
    return false
    endfunction
    
    private function Oncast takes nothing returns nothing
    local Vampiric V = Vampiric.create()
    local real maxrange = RANGE_PER_LEVEL(GetUnitAbilityLevel(GetAttacker(), ABILITY_CODE))
    local real angle
    local real offsetx
    local real offsety
    local location casterloc
    local location targetloc
    local integer p = 0
    local integer i = GetRandomInt(0, 100)
    local group tempgroup
    if i < 50 then
        call V.destroy()
    elseif GetUnitAbilityLevel(GetAttacker(), ABILITY_CODE) > 0 then
        set V.Cfacing = GetUnitFacing(GetAttacker())
        set V.Targeted = GetTriggerUnit()
        set V.Tfacing = GetUnitFacing(GetTriggerUnit())
        set angle = V.Cfacing - V.Tfacing
    if angle < 0 then
        set angle = (-angle)
    elseif angle <= 75 or ALWAYS_BACK != false then
        set casterloc = GetUnitLoc(GetAttacker())
        set targetloc = GetUnitLoc(GetTriggerUnit())
        set V.Tfacing = V.Tfacing + 180
    loop
        exitwhen i >= maxrange
        set offsetx = targetloc + 10 * Cos(V.Tfacing)
        set offsety = targetloc + 10 * Sin(V.Tfacing)
        set tempgroup = GroupEnumUnitsInRange(V.Targets, offsetx, offsety, 200, Filter(function Boolexpr))
        call DestroyBoolExpr(Filter(function Boolexpr))
        call GroupAddGroup(tempgroup, V.Targets)
        call DestroyGroup(tempgroup)
        set i = i + 10
    endloop
    else
    if angle >= 76 then
        set targetloc = GetUnitLoc(GetTriggerUnit())
    loop
        exitwhen i >= maxrange
        set offsetx = targetloc + 10 * Cos(V.Tfacing)
        set offsety = targetloc + 10 * Sin(V.Tfacing)
        set tempgroup = GroupEnumUnitsInRange(V.Targets, offsetx, offsety, 200, Filter(function Boolexpr))
        call DestroyBoolExpr(Filter(function Boolexpr))
        call GroupAddGroup(tempgroup, V.Targets)
        call DestroyGroup(tempgroup)
        set i = i + 10
    endloop
    endif
    endif
    endif
    if CountUnitsInGroup(V.Targets) <= 0 then
        call V.destroy()
        call RemoveLocation(casterloc)
        call RemoveLocation(targetloc)
    else
        call RemoveLocation(casterloc)
        call RemoveLocation(targetloc)
        call KT_Add(userFunc, V, KEY_TIMERS_RATE)
    endif
    endfunction

    //===========================================================================
    private function InitTrig_Vampiric_Strike takes nothing returns nothing
        local trigger t = CreateTrigger(  )
        call TriggerAddAction( t, function Oncast)
        call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED)
    endfunction
endscope
 

Sevion

The DIY Ninja
Reaction score
413
Considering [ljass]targetloc[/ljass] is a location, I wouldn't be surprised that it doesn't work.

[ljass]GroupEnumUnitsInRange[/ljass] returns nothing.
 

NeuroToxin

New Member
Reaction score
46
Considering [ljass]targetloc[/ljass] is a location, I wouldn't be surprised that it doesn't work.

[ljass]GroupEnumUnitsInRange[/ljass] returns nothing.

oh, I see, my bad. And should I use Units in range? Even though its a BJ

And, I'm trying to use a rate that can be specified for key timers, and it says its a real, why isn't it working?
 

Sevion

The DIY Ninja
Reaction score
413
No. The function is meant to simply be called. Not set to. Which is why it returns nothing.

[ljass]call KT_Add(userFunc, V, KEY_TIMERS_RATE)[/ljass] should be [ljass]call KT_Add(function userFunc, V, KEY_TIMERS_RATE)[/ljass].
 

NeuroToxin

New Member
Reaction score
46
And, the trigger doesn't fire, I don't know why, just it doesnt work. It should happen everytime somethings attacked...
 

hgkjfhfdsj

Active Member
Reaction score
55
JASS:

//consider using initializer
scope VampiricStrike initializer Init
//..
private function Init takes nothing returns nothing 
   local trig...
endfunction

//.. or

make inittrig public

public function InitTrig takes nothing returns nothing
    local trig..
endfunction
 

NeuroToxin

New Member
Reaction score
46
Your scope has no initializer.
Ahah, thank you.

EDIT: I Inserted Debug messages, and it doesnt get to the loop, or it doesnt get by the GroupAddGroup in the loop. Whats wrong? The angle and things work, the debugs show.
 

jose00144

New Member
Reaction score
0
help plz

well, I´m new here and i was using jazz. Is great because it allow me the option no limits. But when i was editing a map, them i prove it, i got the surprise that the game was buged. I mean that the units could walk on the mountains and is really odd i don´t know hot to fix it plz help.
 

NeuroToxin

New Member
Reaction score
46
Well here said critique errors, i think that this a critic error, because when i able the no limits option of jazz the map bugged

Jass" Jass" My friend. And this is for MY script. Post your own somewhere else. Screw it you ruined this thread, please delete it, and I'll start another.
 

Sevion

The DIY Ninja
Reaction score
413
For your own question, you post your own thread.

You do not post questions in other peoples' threads. You also did not read the thread.

PM's are not a place for questions either. I do not answer PM's pertaining to things to be answered on the forums.

Triple posting is also against the rules.

NeuroToxin, please for the love of God, stop saying "thread closed" or "delete this thread, I'll start another." It's very, very annoying.
 

NeuroToxin

New Member
Reaction score
46
For your own question, you post your own thread.

You do not post questions in other peoples' threads. You also did not read the thread.

PM's are not a place for questions either. I do not answer PM's pertaining to things to be answered on the forums.

Triple posting is also against the rules.

NeuroToxin, please for the love of God, stop saying "thread closed" or "delete this thread, I'll start another." It's very, very annoying.

Well, considering this thread is of appropriate length, and my original questions were answered.
 

Sevion

The DIY Ninja
Reaction score
413
Thread length has nothing to do with anything. You have not the power to close threads nor delete them, so don't say those annoying things.

This thread has been derailed enough. If there are no more questions pertaining to the topic, which you say there aren't, we should stop posting here.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top