[Solved] Vampiric Aura Ranged

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,601
Hi hi!

I have a little problem. Again. Yeah again. So the problem is that I'm using Vampiric Aura as a passive ability, but I just realised that it doesn't work with my ranged hero. So any ideas how to solve this problem?

Is there any way to just edit the ability or use another ability? Or is it must to create the ability with triggers? Also if the ability is made with triggers wouldn't there be a problem that the ranged hero just starts to attack and gains heal(player could abuse)?

Rep and credits to the helpers.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

I think there is another way, but I don't know how this exaclty works, because I never used it at all.

1) Make a dummy aura for the hero, which only gives the buff to nearby friendly units.

2) Now pick up the ability "Item Life Steal" and modify how you need it.

3) Then create a spellbook (I think it was this), add the ability into it, make a trigger which add this spellbook for the untis with the dummy aura and disable the book with a trigger (something like this - hope you know what I mean else some other need to give a hint)

Hope this can help you a bit

Greetings and Peace
Dr. Boom
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
it is possible to do this in triggers, but DO NOT use Unitisattacked as an event coz as you said, it will abuse...use a damage detection system...

Event:
udg_GDD_Event becomes 0
Condition:
udg_GDD_DamageSource level of vampiric aura greater than 0
Actions:
set HEAL formula here...

EDIT:
http://www.hiveworkshop.com/forums/spells-569/gui-damage-engine-201016/?prev=search%3Ddamage%2520detection%26d%3Dlist%26r%3D20
http://www.hiveworkshop.com/forums/...8/?prev=search=damage%20detection&d=list&r=20

Okay this is last resort coz' I really don't have time now to learn stuff like this. I have campaign to finish!



Moin moin =)

I think there is another way, but I don't know how this exaclty works, because I never used it at all.

1) Make a dummy aura for the hero, which only gives the buff to nearby friendly units.

2) Now pick up the ability "Item Life Steal" and modify how you need it.

3) Then create a spellbook (I think it was this), add the ability into it, make a trigger which add this spellbook for the untis with the dummy aura and disable the book with a trigger (something like this - hope you know what I mean else some other need to give a hint)

Hope this can help you a bit

Greetings and Peace
Dr. Boom

Soooooooo... I don't get this. Isn't the result in the end same?

Anyways I would like to study this ability. Where it is? I don't see any "Item Life Steal" ability anywhere.
 
Level 16
Joined
May 1, 2008
Messages
1,605
No I tested it and the "Item Life Steal" ability if for ranged units/heroes too.
So I thought, when you add this one to a spell book and disable it (somehow the passive "Item Life Steal" still works) your ranged unit (and melee units) get the life steal then.

If I mixed something wrong I'm sorry =S
 
Level 16
Joined
May 1, 2008
Messages
1,605
[Other Topic]

@Maker: I don't have to add it into a spell book first? I thought I remember something, when I want add a passive ability to a unit, which the owning player of this unit shouldn't see, then it must be added to a spell book first, this spell book but have a specific order id or something and then you have to hide it with a trigger.

Isn't this up to date anymore?

[/Other Topic]
 
Level 8
Joined
Apr 26, 2011
Messages
403
Item life steal is not aura right ?

here is another way to make Vampiric Aura Ranged:

- change Ranged's unit damage type from "Missile" to "normal"

So they become melee unit with "long range" :)

now they will lost missile graphic ? .. add an empty ability for missile graphic (base on Lightning Attack ability without any damage effect)
 
mckill2009's solution migh include spell damage, and I'm guessing you don't want that.

yeah but it's still possible, filter ALL TARGET spells and do...

JASS:
local integer order = GetUnitCurrentOrder(udg_GDD_DamageSource)
if order==851983 or order!=852095 then //all others must be specified
   //Actions and formulas...
endif

anyway, taking all target orders is long, so life steal will work fine ;)...
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)


Well .. "Item Life Steal" isn't an aura that's true, but we add this ability to each unit which has the buff of the "Vampiric Aura", so we make the illusion, that the normal Vampiric Aura works for ranged and melee units.

Your way .. well it's possible, but needs more work then the other way.


@Maker: Well I'm so bad. When I tested the first time, I even saw that "Item Life Steal" hasn't any icon ... my bad here ^^

Greetings and Peace
Dr. Boom
 
Level 3
Joined
Oct 7, 2011
Messages
37
Hi I'm trying to implement this solution adding an item with life steal to units within range and I'm having a small issue
I have created a region for each hero these are off-map at the beginning of the game,
If a hero picks vamp aura the following trigger moves the region around them
  • Update Regions
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • WeHaveVampAura Equal to True
    • Actions
      • For each (Integer TempInt) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • VampAuraHeros[TempInt] Not equal to No unit
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between (Position of VampAuraHeros[TempInt]) and (Center of VampiricAuraRegions[TempInt])) Greater than 50.00
                • Then - Actions
                  • Floating Text - Create floating text that reads (Centering vamp region + ((String(TempInt)) + ( to + (String((Center X of VampiricAuraRegions[TempInt])))))) at (Position of VampAuraHeros[TempInt]) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Set tempPoint2 = (Position of VampAuraHeros[TempInt])
                  • Region - Center VampiricAuraRegions[TempInt] on tempPoint2
                  • Custom script: call RemoveLocation (udg_tempPoint2)
                • Else - Actions
                  • Do nothing
            • Else - Actions
              • Do nothing
This trigger works fine my twelve regions are called VampAura1 -VampAura12 I have tested with the output floating text that the region is moving with the player correctly and that the variable for regions i use does refer to the original vampAura1 region

When a player picks the skill vamp aura the following function adds the item ability to them and turns on the vamp aura triggers if they weren't on already
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • abilityListB[(Player number of (Owner of (Learning Hero)))] Equal to Vampiric Aura
    • Then - Actions
      • Set WeHaveVampAura = True
      • Unit - Add VampAuraItem to (Learning Hero)
      • Unit - Set level of VampAuraItem for (Learning Hero) to (Level of Vampiric Aura for (Learning Hero))
      • Set VampAuraHeros[(Player number of (Owner of (Learning Hero)))] = (Learning Hero)
      • Floating Text - Create floating text that reads (Adding vamp aura to + ((String((Level of Vampiric Aura for (Learning Hero)))) + ( player num = + (String((Player number of (Owner of (Learning Hero)))))))) at (Position of (Learning Hero)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • Else - Actions
      • Do nothing
I have tested this and it does add the item ranged heroes do gain lifesteal the player number corresponds to the correct vamp region that it should

So now we reach the actual issue
  • Enter Region 1
    • Events
      • Unit - A unit enters VampAura1 <gen>
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • WeHaveVampAura Equal to True
          • VampAuraHeros[1] Not equal to No unit
          • ((Owner of (Entering unit)) is an ally of (Owner of VampAuraHeros[1])) Equal to True
    • Actions
      • Set TempInt = 1
      • Floating Text - Create floating text that reads (adding vamp item lvl + ((String((Level of Vampiric Aura for VampAuraHeros[TempInt]))) + ( to + (Proper name of (Entering unit))))) at (Position of VampAuraHeros[TempInt]) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of VampAuraItem for (Entering unit)) Equal to 0
        • Then - Actions
          • Unit - Add VampAuraItem to (Entering unit)
          • Unit - Set level of VampAuraItem for (Entering unit) to (Level of Vampiric Aura for VampAuraHeros[TempInt])
        • Else - Actions
          • Unit - Set level of VampAuraItem for (Entering unit) to (Level of Vampiric Aura for VampAuraHeros[TempInt])
This code never executes I have tried removing all the conditions which makes no difference
I originally though perhaps there is a mismatch between the real region specified in start up for the map and the regions in the variables but i checked that when outputting text showing the variable x coordinate and the VampAura1 x coordinate as the hero was moving around and they were changing in sync

I then thought maybe because the region is always moving the enter condition is not being run so i added the range check so it doesn't always move unless its the hero has gone a certain distance I also tested standing still and letting another hero go into the area and this did nothing again

I have a leave region trigger but its the same for some reason it never fires
  • Leave Region 1
    • Events
      • Unit - A unit leaves VampAura1 <gen>
    • Conditions
      • WeHaveVampAura Equal to True
      • VampAuraHeros[1] Not equal to No unit
      • ((Owner of (Entering unit)) is an ally of (Owner of VampAuraHeros[1])) Equal to True
    • Actions
      • Set TempInt = 1
      • Unit - Remove VampAuraItem from (Leaving unit)
      • Floating Text - Create floating text that reads (vamp item removed from + (Proper name of (Leaving unit))) at (Position of VampAuraHeros[1]) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
The region varibles are initilised at Melee Initilisation like so
  • Set VampiricAuraRegions[1] = VampAura1 <gen>
Thats repeated for all 11 more regions
The enter and leave region triggers also have 11 copies with the number incremented for each region and hero indicated

Does anyone know why the enter and exit regions aren't working?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Add units with the aura into a unit group.

Periodically pick every unit in that group.

Pick units around the aura radius. If picked units do not have the ability, give them it. Save this group for the unit with the aura. You should check whether the units previously picked are too far away, remove the ability from them. You can use a dummy aura with a buff or a distance check for this.
 
Level 3
Joined
Oct 7, 2011
Messages
37
Thanks for your reply Maker
I was aware of the option for storing units within a certain distance and doing all the saving units and the checks for distance moving in and out of range and combining multiple auras it seems to me to be an in-elegant solution with a large amount of overhead and unnecessary complexity to make it MUI the region idea doesn't need to be called every second or less and is much easier to implement

For instance I'm going to have to have 12 unit array's of size 100 or more to cope with units walking in and out and needing to be saved to an array to remember them and remove the ability
at some stage
This is entirely unnecessary if the "unit leaves region" code works plus all the issues dealing with variables in war3 means ill probably have to store additional variables to keep abreast of where in each array
the last unit was stored so on where to add the next unit to make it more efficient that just looping through the entire array at every additional unit

I was rather focused on 1 particular bit of my code that wasn't working and getting help for that
Does anyone know why the enter and exit regions aren't working?
If regions just wont work this way then that is fine I'll pursue other ways of accomplishing the same thing such as your suggestion.

I've created an example map with this issue revealed hopefully someone can solve it
It creates a blight for the region size so you know where it is if the hero moves far enough
Example Map

Thx to everyone/anyone for taking a look :)
 
Last edited:
Level 3
Joined
Oct 7, 2011
Messages
37
Jass attempt at moving regions

Thanks for your help again Maker :)
Is it possible to use a JASS script to move the region and re-register it?
I'm not that proficent in JASS Ive been trying to get this working using another similar forum post
Post
This is the code Ive come up with so far
Some of this is just temporary to get it working ie the first function
I've tried TriggerRegisterEnterRegionSimple with my old GUI triggers with the Event disabled and enabled and changed to other regions with no luck
But the main issue at the moment is the regions do not move at all
JASS:
globals
    region VampReg1
endglobals

function HidenGoldConditions takes nothing returns boolean
    local unit u = GetTriggerUnit()
    local player p = GetOwningPlayer(u)
    local string s
    if IsUnitType(u, UNIT_TYPE_HERO) then
        set s = GetPlayerName(p) + "has got into vamp region"
        call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, s)
        call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) + 200)
        call DisableTrigger(GetTriggeringTrigger())
    endif
    set u = null
    set p = null
    return false
endfunction

function LaunchAtMapInitialization takes nothing returns nothing
    local trigger t = CreateTrigger()
    set VampReg1 = CreateRegion()
    call RegionAddRect(VampReg1, gg_rct_NewReg)
    
    call TriggerRegisterEnterRegionSimple(t, VampReg1)
    call TriggerAddCondition(t, Condition(function HidenGoldConditions))
    set t = null
    call TriggerRegisterEnterRegionSimple(gg_trg_Enter_Region_1, VampReg1)
    call TriggerRegisterLeaveRegionSimple(gg_trg_Leave_Region_1, VampReg1)
endfunction

function MoveRectAndRegion takes location centerPos returns nothing
    call RegionClearRect(VampReg1, gg_rct_NewReg)
    call MoveRectToLoc( gg_rct_NewReg, centerPos )
    call DisplayTextToForce( GetPlayersAll(), ( "Moving Region to " + " x=" + R2S(GetRectCenterX(gg_rct_NewReg)) + " y=" + R2S(GetRectCenterY(gg_rct_NewReg))) )
    call RegionAddRect(VampReg1, gg_rct_NewReg)
endfunction
In the original update Regions GUI trigger i call this custom script instead of the original GUI Move Region
  • Custom script: call MoveRectAndRegion (udg_tempPoint2)
I put a random output text into that function and it never displays so maybe i am using JASS badly do you have any ideas on if JASS could work or how to fix the code?

I tried using my original enter /exit region GUI triggers and adding a new trigger in to call that code inside the initialisation function

Test Map with JASS code
 
Last edited:
Level 3
Joined
Oct 7, 2011
Messages
37
Ok you can move regions at run-time and it works fine using my example code the issue i was having was i didn't call the initialization function to start everything off in JASS

  • Custom script: call LaunchAtMapInitialization()
That said this is not working as i had wanted it to when you move the region it is 100% fine for any new units entering or exiting all triggers will be called correctly
It will not always call them for existing units that don't move but are inside the new region

I have decided to go with Masters suggestion since the regions didn't work as required there is probably a way in JASS to once the move is complete to check units in the region and forcibly call the enter region
but then the exit region would be an issue as my original goal was to not have to store units for exiting the aura

I have made 2 changes a JASS script to add units to an array
JASS:
function AddUnitToVampireUnitArray takes unit newUnit returns nothing
set udg_TempInt = 1
    loop
        exitwhen udg_TempInt > 250
        if ( udg_VampItemUnits[udg_TempInt] == null ) then
            set udg_VampItemUnits[udg_TempInt] = newUnit
            set udg_TempInt = 250 + 1
        endif
        set udg_TempInt = udg_TempInt + 1
    endloop
endfunction
And a single trigger that runs every half a second handles adding new units and deleting old ones that go out of range
  • VampireAura
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
      • WeHaveVampAura Equal to (==) True
    • Actions
      • Do Multiple ActionsFor each (Integer i) from 1 to 12, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • VampAuraHeros[i] Not equal to (!=) No unit
            • Then - Actions
              • Set tempUnitGroup = (Units within 900.00 of (Position of VampAuraHeros[i]) matching (((Matching unit) belongs to an ally of (Owner of VampAuraHeros[i])) Equal to (==) True))
              • Unit Group - Pick every unit in tempUnitGroup and do (Actions)
                • Loop - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of VampAuraItem for (Picked unit)) Equal to (==) 0
                    • Then - Actions
                      • Game - Display to (All players matching ((Matching player) Equal to (==) (Owner of VampAuraHeros[i]))) the text: (Add skill to + (Name of (Picked unit)))
                      • Unit - Add VampAuraItem to (Picked unit)
                    • Else - Actions
                      • Do nothing
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of VampAuraItem for (Picked unit)) Greater than or equal to (>=) (Level of VampAuraItem for VampAuraHeros[i])
                    • Then - Actions
                      • Do nothing
                    • Else - Actions
                      • Game - Display to (All players matching ((Matching player) Equal to (==) (Owner of VampAuraHeros[i]))) the text: (Vamp skill added to + (Name of (Picked unit)))
                      • Unit - Set level of VampAuraItem for (Picked unit) to (Level of Vampiric Aura for VampAuraHeros[i])
                      • Custom script: call AddUnitToVampireUnitArray(GetEnumUnit())
              • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Do Multiple ActionsFor each (Integer TempInt) from 1 to 250, do (Actions)
                  • Loop - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • Multiple ConditionsAnd - All (Conditions) are true
                          • Conditions
                            • VampItemUnits[TempInt] Not equal to (!=) No unit
                            • (Distance between (Position of VampAuraHeros[i]) and (Position of VampItemUnits[TempInt])) Greater than (>) 900.00
                      • Then - Actions
                        • Game - Display to (All players matching ((Matching player) Equal to (==) (Owner of VampAuraHeros[i]))) the text: (Vamp skill removed from + (Name of VampItemUnits[TempInt]))
                        • Unit - Remove VampAuraItem from VampItemUnits[TempInt]
                        • Set VampItemUnits[TempInt] = No unit
                      • Else - Actions
                        • Do nothing
            • Else - Actions
              • Do nothing
I decided on a single array to hold all the aura'ed units as it doesn't matter who gave them the aura when you are removing it
I am hoping 250units is enough for the units within range of all heroes and not to large to cause an issue with the map

Thanks everyone for comments ;)
 
Last edited:
Status
Not open for further replies.
Top