• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Unit within range of point

Status
Not open for further replies.
Level 5
Joined
Oct 10, 2010
Messages
71
My idea is: altered blizzard spell
This creates a point (point of target ability being cast)

What I want to do is to create region or w/e to check if unit is in region and deal additional damage to it

Problem is caused by my "damage based on attributes system"
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
My idea is: altered blizzard spell
This creates a point (point of target ability being cast)

What I want to do is to create region or w/e to check if unit is in region and deal additional damage to it

Problem is caused by my "damage based on attributes system"

with unit group - pick unit around a point u can do something like this

also u can can check if unit position is in region but have easy pick for this
(!!!unit group and point link must be destroyed, i show this for show a ideea!!)

  • Unit Group - Pick every unit in (Units within 600.00 of (Position of (Triggering unit)) matching (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True)) and do (Actions)
    • Loop - Actions
      • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Real((Intelligence of (Triggering unit) (Include bonuses)))) damage of attack type Spells and damage type Normal
 
Level 5
Joined
Oct 10, 2010
Messages
71
Deal is to get trigger to know that Damage is coming from that ability,or at least owner of caster, also this spell damages allies.

That function You posted will fire whenever anyone attacks enemy

------------ Blizzard spell comes in waves, co I can't create unit group once, also other units can come along..
 
Level 5
Joined
Dec 12, 2011
Messages
116
So, you want to do, let's say, "custom" damage at Blizzard.
My suggestion is: trigger all the blizzard skill.
Create a skill based on Channel. (called BlizzardAtHero)
Set is to be cast at an area.
Create a blizzard based skill that would be the real skill, set everything as you like to it
- except the damage, that we will handle with triggers, so set damage per wave to 0.01
- call the skill BlizzardAtDummy and make it an Unit Ability
Create a dummy caster (if you don't now what it is take a look at the forums for "dummy casters") and add the BlizzardAtDummy for it (at Object Editor) and call the dummy caster BlizzardDummyCaster
And then:

BLIZZARD INITIALIZATION:
  • Blizzard Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set BlizzardHashTable = (Last created hashtable)
BLIZZARD CAST:
  • Blizzard Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BlizzardAtHero
    • Actions
      • Set TempPoint = (Target point of ability being cast)
      • Unit - Create 1 BlizzardDummyCaster for (Owner of (Triggering unit)) at TempPoint facing 0.00 degrees
      • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
      • Unit - Set level of BlizzardAtDummy for (Last created unit) to (Level of (Ability being cast) for (Triggering unit))
      • Unit - Order (Last created unit) to Human Archmage - Blizzard TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Hashtable - Save Handle Of(Last created unit) as (Key linked_dummy) of (Key (Triggering unit)) in BlizzardHashTable
      • Hashtable - Save Handle Of(Triggering unit) as (Key linked_caster) of (Key (Last created unit)) in BlizzardHashTable
BLIZZARD DAMAGE
  • Blizzard Damage
    • Events
      • Unit - A unit takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to BlizzardDummyCaster
    • Actions
      • Unit - Cause (Load (Key linked_caster) of (Key (Triggering unit)) in BlizzardHashTable) to damage No unit, dealing 500.00 damage of attack type Spells and damage type Normal
BLIZZARD STOPPED
  • Blizzard Stopped
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to BlizzardAtHero
    • Actions
      • Unit - Remove (Load (Key linked_dummy) of (Key (Triggering unit)) in BlizzardHashTable) from the game
      • Hashtable - Clear all child hashtables of child (Key (Load (Key linked_dummy) of (Key (Triggering unit)) in BlizzardHashTable)) in BlizzardHashTable
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in BlizzardHashTable
That's it.

Obs: I like +rep. (=

EDIT: added an action on trigger 2 that I forgot.

hamsterpellet
 
Last edited:
Level 5
Joined
Dec 12, 2011
Messages
116
Hey, first, notice that the EVENT doesn't exist.
There is no generic unit damage event at war3 world editor, just specific one. So, you'll have to implement a Generic Damage Detection System. I suggest that from Weep:
http://www.hiveworkshop.com/forums/spells-569/gui-friendly-damage-detection-v1-2-1-a-149098/

The Damage Source, in this case, will be the GDD_DamageSource variable.

Anyways, I don't see how could you get problems with finding the condition:
unit-type of unit, and unit --> Event Response - Damage Source
 
Level 5
Joined
Dec 12, 2011
Messages
116
lol, now you'll be surprised, I don't know what MPI means. XD

EDIT: I decided to explain better the hashtables here.

First, notice that there are two units involved with your skill:
The hero that casts it, and the dummy that we created.

So, when you hero stops casting the skill, I mean, the duration of the blizzard has ended, we need to remove the dummy, in order to make it stop the real blizzard.

  • Blizzard Stopped
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • -------- we want to remove the dummy --------
      • Unit - Remove (?????????) from the game
The problem here is:
What we put at the ????? to be the dummy? In other words, when your hero stops the blizzard, how can we pick the related dummy?
We could make a unit variable, for example, "LastDummy". But, let's say a hero casts the dummy blizzard (that lasts 7 seconds), and after 2 seconds, other hero also casts the dummy blizzard. The LastDummy variable would be replaced, and when everything ends, only 1 dummy would be removed.

So, I decided to suggest a solution with hashtables to you.
With that, I can do something that would be similar of:

  • Set tempUnit = (dummy-caster linked to (Triggering Unit))
  • Unit - Remove tempUnit from the game
So, hashtables are the solution.

EDIT: thanks for the rep man!
 
Level 5
Joined
Oct 10, 2010
Messages
71
Here comes another problem, I just cant get trough it :(

Firstly how I make Dummy caster to cast ability? (I've checked topic with that issue, altered the function to "IssuePointOrderLoc", passing all the vars (udg_DummyCaster, udg_tempAbilityID, udg_tempPoint).

I had problem with second argument saying "cannot convert integer to string" to i made tempAbilityID variable that converts "A006" - my Ability ID to string..

But I doesn't work.. You solution is good but not enough for that specific spell :(
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Here comes another problem, I just cant get trough it :(

Firstly how I make Dummy caster to cast ability? (I've checked topic with that issue, altered the function to "IssuePointOrderLoc", passing all the vars (udg_DummyCaster, udg_tempAbilityID, udg_tempPoint).

I had problem with second argument saying "cannot convert integer to string" to i made tempAbilityID variable that converts "A006" - my Ability ID to string..

But I doesn't work.. You solution is good but not enough for that specific spell :(

idk really what u want try, coz abilityid is integer and dont need to convert to string, but if u want detect which spell casted then u talk about base order id what is string (example:"channel", "smart", "stop", "firebolt" etc)

Deal is to get trigger to know that Damage is coming from that ability,or at least owner of caster, also this spell damages allies.

That function You posted will fire whenever anyone attacks enemy

------------ Blizzard spell comes in waves, co I can't create unit group once, also other units can come along..

i dont see the preoblem with it, since if u set blizard damage to 0 in object editor and do a loop where every sec check the blizard caster unit order (i think order id string is "blizard") then u can do damage every second or that often how much time have between 2 wave.

what i wrote is single unit damage in loop, its mean i filtered only the enemy and deal 1by1 every enemy in 600 range :p (pick unit group with matching condition good for filter the enemies coz have boolean condition for that)

hashtable is easy, in begining i was confused too but i give a example, hashtable pretty similiar than a 2d variable

a normal variable look like this:
(number a integer arrray, unit a unit array)

number[player number] = 2
or
unit[player number] = triggerunit

hashtable use 2 index

so example

index1, index2 = value

so u can do example this

player number, 1 = 2
player number, 2 = triggerunit

and in trigger this look like a bit invers, coz 1st u give the value then the 2 index

  • Hashtable - Save 2 as (Player number of (Triggering player)) of 1 in (Last created hashtable)
  • Hashtable - Save Handle Of(Triggering unit) as (Player number of (Triggering player)) of 2 in (Last created hashtable)
this usefull if u want save more thing and attach to a single number, in this case u attach a number and unit to player number (example if player 5 cast a ability then player number 5, so it is same than u do unit[5]=triggerunit, number[5]=2 just with hashtable u can skip the global variables)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
ok 1st u added the dummy ability to dummy unit?
a006 ur ability raw code?

a simple spell cast with dummy look like this

example for order a unit

  • Ability 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ability1
    • Actions
      • Set point = (Target point of ability being cast)
      • Unit - Create 1 dummy for (Triggering player) at point facing Default building facing degrees
      • Unit - Add Blizzard to (Last created unit)
      • Unit - Order (Last created unit) to Human Archmage - Blizzard point
  • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
For MUI single timer version (down)
i made a map for u if u want more complex thing, please check that if u want a better blizard alter

here the triggers too

map init

  • Map init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set hashtable = (Last created hashtable)
ability casting trigger, here u just change the values as u want

  • Ability 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ability1
    • Actions
      • Set point = (Target point of ability being cast)
      • Set id = (Player number of (Triggering player))
      • Set x = (X of point)
      • Set y = (Y of point)
      • Set damage = 100.00
      • Set radius = 400.00
      • Set icePerwave = 10
      • Unit - Add Blizzard to (Last created unit)
      • Unit - Order (Last created unit) to Human Archmage - Blizzard point
      • Unit Group - Add (Triggering unit) to castergroup
      • Hashtable - Save damage as id of 1 in hashtable
      • Hashtable - Save x as id of 2 in hashtable
      • Hashtable - Save y as id of 3 in hashtable
      • Hashtable - Save radius as id of 4 in hashtable
      • Hashtable - Save icePerwave as id of 5 in (Last created hashtable)
      • Custom script: call RemoveLocation(udg_point)
      • Set CountUnits = (CountUnits + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CountUnits Equal to 1
        • Then - Actions
          • Trigger - Turn on Periodic Trigger <gen>
        • Else - Actions
periodic trigger, the engine, if u change the periodic time then waves are faster or slower

  • Periodic Trigger
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CountUnits Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Unit Group - Pick every unit in castergroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (String((Current order of (Picked unit)))) Equal to blizzard
            • Then - Actions
              • Set unit = (Picked unit)
              • Set id = (Player number of (Owner of unit))
              • Set damage = (Load id of 1 from hashtable)
              • Set x = (Load id of 2 from hashtable)
              • Set y = (Load id of 3 from hashtable)
              • Set radius = (Load id of 4 from hashtable)
              • Set icePerwave = (Load id of 5 from (Last created hashtable))
              • Set point = (Point(x, y))
              • Unit Group - Pick every unit in (Units within radius of point matching (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True)) and do (Actions)
                • Loop - Actions
                  • Unit - Cause unit to damage (Picked unit), dealing damage damage of attack type Spells and damage type Normal
              • For each (Integer A) from 1 to icePerwave, do (Actions)
                • Loop - Actions
                  • Set point2 = (point offset by (Random real number between 0.00 and radius) towards (Random angle) degrees)
                  • Special Effect - Create a special effect at point2 using Abilities\Spells\Human\Blizzard\BlizzardTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_point2)
              • Custom script: call RemoveLocation(udg_point)
            • Else - Actions
              • Set CountUnits = (CountUnits - 1)
              • Unit Group - Remove (Picked unit) from castergroup
this is mpi, so multiplayer instance but u can make it mui too if u want, if u want skip the useing jass or customscripts just copy a unit indexer to u map and replace get player number to unit custom value, and it is mui, if u want i can make that too tommorow but i think u got the ideea
 

Attachments

  • blizard.w3x
    19.4 KB · Views: 132
Last edited:
Level 5
Joined
Dec 12, 2011
Messages
116
I had problem with second argument saying "cannot convert integer to string" to i made tempAbilityID variable that converts "A006" - my Ability ID to string..:(

The issue here that you must use 'A006' instead of "A006". The reason is that an ability code is actually an hexadecimal number, and using the ' shows to wc3 that you're actually writing a hexadecimal number (and not a string).

Unit - Order (Last created unit) to Human Archmage - Blizzard TempPoint how to make dummy cast MY spell? A006?

call IssuePointOrderByIdLoc(udg_PrzekletaZiemiaDummy, 'AHbz', udg_tempPoint) is not working

To issue an order of using an ability to a unit, you pass to the unit the order string, instead of the ability code. This is why units should not have two skills with the same order string.
At GUI, when you write:

Unit - Order (Last created unit) to Human Archmage - Blizzard TempPoint

You are actually saying:

Send the "blizzard" order to (Last created unit).
In other words, "Human Archmage - Blizzard" is a GUI way to represent the "blizzard" orderstring.

So, if your ability 'A006' is based on blizzard, you will order the dummy to "blizzard". The dummy will look for an ability which orderstring is "blizzard" and cast it.

So, finally, you just write:

Unit - Order (Last created unit) to Human Archmage - Blizzard TempPoint

And it's over. (=
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
So strings like "absorb" or "blizzard" will tell which spell to use? Spells that unit already have of course

when u activate or turn off (if toggl;e ability) a ability then that order action is a string

basically this string tell what ability is activated but when u add/remove/disable/levele up (so anything else than activate the ability) then u use ability raw code

basically at channel ability and spellbook u can check what base ability order id exist, because only at this 2 ability u can change the ability order string this is why the channel ability the most favorit trigger ability (when u trigger the ability effect and make new kind of ability)

anyway u checked that map what i posted or it was time waste from my side?
 
Level 5
Joined
Dec 12, 2011
Messages
116
So I can make only ONE spell based on "blizard" and give it to unit right?

Exactly. This is true for any ability, with two exceptions (as far as I know): Channel ('Ancl') and Spellbook ('Aspb').

At those two skills there is a Data - Order String field. You may choose anything. So, let's say you want to put two Channel-based skill at the same unit. You leave one of them with the "channel" order string, and at the other you change the Data - Order String to anything else that the unit doesn't have, for example, "auravampiric".

Notice that the Text - Order String fields exist for all abilities, but changing them does not solve the problem. (Then I don't know why those fields exist anyway).

Any problems, feel free to send me a private message (PM).
 
Status
Not open for further replies.
Top