JASS More Precise Timer

ImmortaL_GoD

New Member
Reaction score
4
Trigger:
  • Mana Draw
    • Events
      • Unit - A unit enters Mana Draw <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) |cffffcc00Slave
    • Actions
      • Game - Display to (Owner of (Triggering unit)), at offset (0.00, 0.00) the text: |c00d9d9ffYou cast ...
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Triggering unit) is owned by Player 1 (Red)) Equal to (==) True
            • ((Owner of (Triggering unit)) Current gold) Greater than or equal to (>=) 5000
          • Then - Actions
            • Set temp_group = (Units in Red Spawn <gen> matching ((Unit-type of (Matching unit)) Equal to (==) |c00ff0000Orc Raider))
            • Unit Group - Pick every unit in temp_group and do (Actions)
              • Loop - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Number of units in temp_group) Greater than (>) 9
                  • Then - Actions
                    • Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
                      • Loop - Actions
                        • Unit - Kill (First unit of group temp_group)
                        • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) + 4000)
                  • Else - Actions
                    • Do nothing
Need help getting this to work. Think I need to do it in vJASS, because it's simpy just killing one unit from this group. I need it to kill all units and give 4k mana (when the player has 5k mana).
 

Naga'sShadow

Ultra Cool Member
Reaction score
49
Not really a jass issue so much as an incorrect line. Instead of first unit of temp_group use picked unit. The group snytax will automatically go through them one by one. It won't with the first because the unit is never removed from the group afterwards.
 

ImmortaL_GoD

New Member
Reaction score
4
Wow, it worked, you're a fucking genius, I love you. I thought I tried Picked unit.. but I guess not o_O.

On the exact same topic, well I have a spell like:
Trigger:
  • Then - Actions
    • Set temp_group = (Units in (Playable map area) matching (((Matching unit) is owned by Player 1 (Red)) Equal to (==) True))
    • Unit Group - Pick every unit in temp_group and do (Actions)
      • Loop - Actions
        • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
        • Unit - Add Enchantment (Damage) to (Picked unit)
        • Unit - Add Enchantment (Armor) to (Picked unit)
    • Wait 3.00 seconds
    • Unit Group - Pick every unit in temp_group and do (Actions)
      • Loop - Actions
        • Unit - Remove Enchantment (Damage) from (Picked unit)
        • Unit - Remove Enchantment (Armor) from (Picked unit)
        • Special Effect - Destroy (Last created special effect)
    • Custom script: call DestroyGroup (udg_temp_group)

And I need a JASS timer for it I think to work, since it doesn't remove the abilities. So was wondering how/what would I implement..? My friend helped me with the code in vJASS as well, so I have that in case I can't just throw it in the raw script. The vJASS code is:
JASS:
function EnhancementC takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit())=='u005' and GetPlayerState(GetOwningPlayer(GetTriggerUnit()),PLAYER_STATE_RESOURCE_GOLD)>=6000
endfunction

function EnhancementA takes nothing returns nothing
    local unit triggerU = GetTriggerUnit()
    local group inRect=CreateGroup()
    local integer currentGold=GetPlayerState(GetOwningPlayer(GetTriggerUnit()),PLAYER_STATE_RESOURCE_GOLD)
    local unit firstUnit
    set udg_temp_point=Location(GetRectCenterX(gg_rct_Enhancement_Finish),GetRectCenterY(gg_rct_Enhancement_Finish))
    call SetUnitPosition(GetTriggerUnit(),GetRectCenterX(gg_rct_Enhancement_Finish),GetRectCenterY(gg_rct_Enhancement_Finish))
    call SetPlayerState(GetOwningPlayer(GetTriggerUnit()),PLAYER_STATE_RESOURCE_GOLD,currentGold-6000)
    call DisplayTextToPlayer(GetOwningPlayer(GetTriggerUnit()),0,0,"|cffd9d9ffYou cast Enhancement...|r")
    call GroupEnumUnitsInRect(inRect,bj_mapInitialPlayableArea,null)
    set udg_temp_group=inRect
    loop
        exitwhen FirstOfGroup(udg_temp_group)==null
        set firstUnit=FirstOfGroup(udg_temp_group)
        if GetOwningPlayer(firstUnit)==GetOwningPlayer(GetTriggerUnit()) then
            set bj_lastCreatedEffect=AddSpecialEffectTarget("Abilities\\Spells\\Human\\Resurrect\\ResurrectCaster.mdl",firstUnit,"overhead")
            call UnitAddAbility(firstUnit,'A06S')
            call UnitAddAbility(firstUnit,'A06T')
        endif
        call GroupRemoveUnit(udg_temp_group,firstUnit)
    endloop
    call TriggerSleepAction(15)
    set udg_temp_group=inRect
    loop
        exitwhen FirstOfGroup(udg_temp_group)==null
        set firstUnit=FirstOfGroup(udg_temp_group)
        if GetOwningPlayer(firstUnit)==GetOwningPlayer(GetTriggerUnit()) then
            call DestroyEffect(bj_lastCreatedEffect)
            call UnitRemoveAbility(firstUnit,'A06S')
            call UnitRemoveAbility(firstUnit,'A06T')
        endif
        call GroupRemoveUnit(udg_temp_group,firstUnit)
    endloop
    call DestroyGroup(inRect)
    call DestroyGroup(udg_temp_group)
endfunction

function InitTrig_Enhancement takes nothing returns nothing
    set gg_trg_Enhancement=CreateTrigger()
    call TriggerRegisterEnterRectSimple(gg_trg_Enhancement,gg_rct_Enhancement)
    call TriggerAddCondition(gg_trg_Enhancement,Condition(function EnhancementC))
    call TriggerAddAction(gg_trg_Enhancement,function EnhancementA)
endfunction


For the sake of the topic.
 
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