1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] What's wrong here?

Discussion in 'Triggers & Scripts' started by naitsirk, Oct 31, 2009.

  1. naitsirk

    naitsirk

    Joined:
    Jan 24, 2009
    Messages:
    570
    Resources:
    0
    Resources:
    0
    Code (vJASS):
    scope HolyExpl initializer Init
    //-----------------Setup Start--------------------------
        globals
            private constant integer SPELL_ID = 'A000'


        endglobals
       
        private function Damage takes integer level returns real
            return level * 50.
        endfunction
       
        private function heal takes integer level returns real
            return level * 25.
        endfunction
       
        private function Loopdam takes integer level returns real
            return level * 35.
        endfunction
    //-----------------Setup End----------------------------
        globals
            private boolexpr b
        endglobals

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

    private function Pick takes nothing returns boolean
        return Target(GetFilterUnit())

    private function a takes nothing returns nothing
        local unit caster = GetTriggerUnit()
        local integer loopsec = 0
        local integer level = GetUnitAbilityLevel(caster, SPELL_ID)
        local location one = GetUnitLoc(caster)
        local location two = GetRandomLocInRect(RectFromCenterSizeBJ(one, 500.,500.))
        local location effectLoc = OffsetLocation(two,-50.00, 50.00)
        local location effectLoc2 = OffsetLocation(two,50.00,-50.00)
        local location effectLoc3 = OffsetLocation(two,50.00,50.00)
        local location effectLoc4 = OffsetLocation(two,-50.00,-50.00)
        local location three
        local unit target
        call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", two))
        call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", effectLoc))
        call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", effectLoc2))
        call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", effectLoc3))
        call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", effectLoc4))
       
        call GroupEnumUnitsInRangeOfLoc(groups, two, 200., b)
        set target = FirstOfGroup(groups)
        if IsUnitEnemy(target, GetOwningPlayer(caster)) then
            call UnitDamageTarget( caster, target, Damage(level), true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL)
        endif
        loop
            set three = GetRandomLocInRect(RectFromCenterSizeBJ(one, 500., 500.))
            exitwhen loopsec == 10
            call PolledWait(0.15)
            call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl",three))
            set loopsec = loopsec + 1
            call RemoveLocation(three)
        endloop
        set loopsec = 0
        call RemoveLocation(two)
        call RemoveLocation(one)
        call RemoveLocation(effectLoc)
        call RemoveLocation(effectLoc2)
        call RemoveLocation(effectLoc3)
        call RemoveLocation(effectLoc4)
    endfunction


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

        call TriggerRegisterAnyUnitEventBJ(Holy, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddAction(Holy, function a)
        call TriggerAddCondition(Holy, Condition(function c))
       
        set b = Condition(function Pick)
       
       
       
       
    endfunction
    endscope


    I get an error when trying to save this... The Takes nothing seems to be unexpected or something.... Anyone knows why this is happening?

    (ohh.. and if you find a way to make the special effects with just 2 or 1 variable please tell me...)
     
  2. Cheezeman

    Cheezeman

    Joined:
    Aug 19, 2008
    Messages:
    437
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Please post the entire code, I'm missing your scope and globals.
     
  3. naitsirk

    naitsirk

    Joined:
    Jan 24, 2009
    Messages:
    570
    Resources:
    0
    Resources:
    0
    will do then:;P
     
  4. Komaqtion

    Komaqtion

    Joined:
    Jan 29, 2007
    Messages:
    97
    Resources:
    1
    Spells:
    1
    Resources:
    1
    You're missing an "endfunction" here:
    Code (vJASS):
    private function Pick takes nothing returns boolean
        return Target(GetFilterUnit())


    ;)
     
  5. naitsirk

    naitsirk

    Joined:
    Jan 24, 2009
    Messages:
    570
    Resources:
    0
    Resources:
    0
    ehmm... I am not too sure how to make it Pick the Units its supose to damage... in the loop that is... it's supose to Heal friendly units and damage enemies... so i am not too sure how to set the variable...
     
    Last edited: Oct 31, 2009
  6. Yixx

    Yixx

    Joined:
    Oct 12, 2008
    Messages:
    1,492
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Gosh, you are using JASS, but still stuck to locations? Learn about coordinates!
     
  7. naitsirk

    naitsirk

    Joined:
    Jan 24, 2009
    Messages:
    570
    Resources:
    0
    Resources:
    0
    I'm trying... just cant seem to find any turts about the most things!!!!
     
  8. Cheezeman

    Cheezeman

    Joined:
    Aug 19, 2008
    Messages:
    437
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    You don't have an endfunction for private function Pick

    Edit: Lol I didn't see someone else found that.
     
  9. naitsirk

    naitsirk

    Joined:
    Jan 24, 2009
    Messages:
    570
    Resources:
    0
    Resources:
    0
    can you anything about coordinates? if so... would you mind telling me?
     
  10. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,665
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Locations are a group of coordinates.

    Now tell me, which do you think is easier, locations or coordinates.

    Code (vJASS):

    local unit u = GetTriggerUnit()
    local location l = GetUnitLoc()
    call AddSpecialEffectLoc("", l)
    call RemoveLocation(l)
    set l = null
    set u = null
     


    or..

    Code (vJASS):

    local unit u = GetTriggerUnit()
    call AddSpecialEffect("", GetUnitX(u), GetUnitY(u))
    set u = null
     
     
  11. naitsirk

    naitsirk

    Joined:
    Jan 24, 2009
    Messages:
    570
    Resources:
    0
    Resources:
    0
    The Second one:p But both leaks...
    Code (vJASS):
    DestroyEffect(AddSpecialEffect("", GetUnitX(u), GetUnitY(u))
     
  12. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,665
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    It was just an example. I wrote it in the quick reply box.
     
  13. naitsirk

    naitsirk

    Joined:
    Jan 24, 2009
    Messages:
    570
    Resources:
    0
    Resources:
    0
    ah... never mind then... probelly should stop saying this stuff... Well... Ty for atleast explaining Coordinates...