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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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