Another Far Sigh spell XD

Kike

Member
Reaction score
3
ok, its not a reask or something like this ok? I know there is another post talking about creating a Sigh spell but it is diferent.

ok... this ability is an detection aura based on movement of surronding units, ok, something like this:

Far Sense:

The ability makes all nearby anemy units that walk many units in a row (indepedent of changing directions, if it does not stop walking x units in row the effect is launch) have their position reveled, I was wanting to create a 3 level spell and in each level increase the area of effect and lower the number of units they need to walk
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
im totally confused as to what this does at all, can you upload a map or put it in context, or explain better
 

Kike

Member
Reaction score
3
ok, another try:

The Far Sense ability is a passive skill that allows the hero see enemy units out of his view, but only detect those if they are moving for some time. This skill has 3 levels, each level increase the total area of effect
 

keychup

Active Member
Reaction score
34
He means that if a unit moves, for example, 300 spaces then they will be revealed. In order to be kept hidden they will have to move , like, 200 spaces per move order.
 

Kike

Member
Reaction score
3
He means that if a unit moves, for example, 300 spaces then they will be revealed. In order to be kept hidden they will have to move , like, 200 spaces per move order.

Yes! you got it XD Now I need a way to check this movemen, hints anyone?
 

Moradiae

TH.net Regular
Reaction score
14
well now this gets quite tricky, you might wanna consider something like this , tho I don't know how to use them myself :p



but first we can start off (in GUI now) with adding the unit to WithinRangeGroup when it come within range, but since the aura owner may also be moving, this should be periodic and should remove unit from the group when it's outside the range

next, we have to somehow account for movement, there are a couple of ways, each equally annoying to work with:
  • method 1 Detecting movement using
    Trigger:
    • Events
      • Unit - A unit is issued order targeting a point
      • Conditions
        • Issued order = order(smart)
        • Unit is in WithinRangeGroup
      • Actions
        • Unit Group - Add unit to IsMovingGroup


    Then using the unit's movement speed and the distance limit from the skill, you can calculate how long each unit will have to move to traverse the set distance.
    We can then use that time for how long the unit have to be in IsMovingGroup before starting the effect (add Faerie fire, w/e). So I think we need a hashtable here.

    The problem with this method is that there maybe other ways a hero can move without the smart order id

    _
  • method 2 Not sure how this will work myself, but basically periodically check for movement by comparing location/coordinates of the units in WithinRangeGroup, sum the distance if the unit is continuously moving, and reset the distance count whenever the the coordinates are the same in 2 consecutive interval check (the unit is not moving)

    The pros is that this should account for any movement by any means

Don't really like where both methods are going myself, but that's all I have for now, hope it helps :eek:
 

Kike

Member
Reaction score
3
Not so funcional like you said... but is a good start :) is there any way to set point A to old position of the enemy and keep checking until it reaches 300 units traveled?that may be the point B, the radio of a 300 units circle around point A
 

Moradiae

TH.net Regular
Reaction score
14
there may be more than 1 enemy within the range at the same time so you might want to account for that, one way would be to save each unit's x and y coordinate into a hashtable with it's handle ID

not really sure what you mean about the circle part,

but to elaborate on what i meant in method 2, you'd have sth like

Trigger:
  • Events
    • Unit - Unit comes within range (your range) of (your unit)
    • Conditions
      • -------check hero, check ability etc. etc.-------
    • Actions
      • Unit Group - Add (triggering unit) to WithinRange group
      • Set temp_unit = (triggering unit)
      • Custom script: set udg_unitHandle = GetHandleID(udg_temp_unit)
      • Hashtable - Save (X of (Position of (Triggering unit))) as (key x) of (unitHandle) in hash
      • Hashtable - Save (Y of (Position of (triggering unit))) as (key y) of (unitHandle) in hash
      • Hashtable - Save 0 as (key distance count) of (unitHandle) in hash
      • Trigger - Turn on Periodic Checks and Effects <gen>


Trigger:
  • Periodic Checks and Effects
    • Events
      • Time - Every 0.1 sec of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in WithinRange group and do (Actions)
        • Loop - Actions
          • -------we want to check the unit's new position against the old position-------
          • Set temp_unit = (picked unit)
          • Custom scipt: set udg_unitHandle = GetHandleID(udg_temp_unit)
          • Set old_x = Load (key x) of (unitHandle) in hash
          • Set old_y = Load (key y) of (unitHandle) in hash
          • -------this should load the coordinate of the unit 0.1 seconds ago-------
          • -------now we want the coordinate of the unit at present-------
          • Set new_x = x of (position of (picked unit))
          • Set new_y = y of (position of (picked unit))
          • -------Now save the new coordinate for next iteration-------
          • Hashtable - Save new_x as (key x) of (unitHandle) in hash
          • Hashtable - Save new_y as (key y) of (unitHandle) in hash
          • -------and check if they are equal-------
          • If (All conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • And
                • old_x = new_x
                • old_y = new_y
            • Then - Actions
              • -------position is the same, unit is not moving, reset the distance count-------
              • Hashtable - Save 0 as (key (distance count)) of (unitHandle) in hash
            • Else - Actions
            • -------unit is moving, check if the distance traveled so far reached 300-------
              • Set temp_int = Load (key (distance count)) of (unitHandle) in hash
              • If (All conditions are true) then do (Then actions) else do (Else actions)
                • If - Conditions
                  • temp_int < 300
                • Then - Actions
                  • -------distance traveled is less than 300, add distance between new point and old point to distance count-------
                  • Set temp_int = (Load (key (distance count)) of (unitHandle) in hash) + (Distance between (Point(old_x, old_y)) and (Point(new_x, new_y)))
                  • Hashtable - Save temp_int as (key (distance count)) of (unitHandle) in hash
                • Else - Actions
                  • -------distance traveled reached the limit, do your effect here and reset distance count (to get ready for more iteration if the unit start moving again)-------
                  • Hashtable - Save 0 as (key (distance count)) of (unitHandle) in hash
          • -------now check if the unit should be remove from the group or not (is it still within range)-------
          • If (All conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • (Distance between (Point(new_x, new_y))and (Position of (your Far sight hero)) is greater than 1000
            • Then - Actions
              • -------Remove unit from group and clean hashtable-------
              • Unit Group - Remove temp_unit from WithinRange group
              • Hashtable - Clear all child key of (unitHandle) in hash
              • -------Turn off this trigger if the group is empty-------
              • If (All conditions are true) then do (Then actions) else do (Else actions)
                • If - Conditions
                  • (Number of units in WithinRange group) equal to 0
                • Then - Actions
                  • Trigger - turn off (this trigger)
                • Else - Actions
                  • -------number of unit in group is not 0, some unit still within range, leave the trigger running-------
            • Else - Actions



whew, sorry that took it quite some time, but I hope it works :p
 

Kike

Member
Reaction score
3
ahn... I can you say the variebles used or put an example map for me? I'm lost in the middle of to many things :x
 

Moradiae

TH.net Regular
Reaction score
14
ah, sorry about that,

i'll post the variables here first, it'll take some time to transfer the whole thing into a map, but i guess i'll just check if it works in the process

anyway, here goes

Variables: (none of them are arrays)
Name / type
temp_unit / unit
unitHandle / integer
old_x
old_y
new_x
new_y / all 4 are reals
temp_int / integer
 

Moradiae

TH.net Regular
Reaction score
14
ah yes, that's right, variable WithinRange of type Unit Group and a hashtable called hash XD


sorry, was just testing the thing, here's the map i have so far
just one issue, just move the last 2 actions that saves the new x and new y up the trigger n that's it,
i'll edit the fix in my post above so you can see




in the demo map, if you move the peasant within 700 range of the farm, it should say "In"
and while you are inside, every 300 distance of continuous movement will say "Boom!" but if you move small steps (less than 300 and stop and go again) many times, it won't go Boom.
when you go out of 700, it will say "out"
 

Attachments

  • within range.w3x
    16.2 KB · Views: 244

Kike

Member
Reaction score
3
Perfect Job! I love it man! serious :D

Edit: Still a small bug in the system :x, sometimes units that get in get out in the same time :x
 

Moradiae

TH.net Regular
Reaction score
14
glad you liked it :)

about the bugs, yes, I see it now :eek:

after a few testings I think it occurs when the unit goes within the range and in the next 0.1 seconds, walks (stays) along the circumference of the range so it's like both within range and outside range at the same time, this becomes clear when you try to "walk along the curve" of the range

easiest fix would be to make the entering and leaving range slightly different, I tried adding 10 to the 700 range and the problem seems to stop now (adding just 1 doesn't do the job tho, it can still cause the same bug), a bit clumsy fix, but i hope the difference of 10 will probably be ok :p
 

Moradiae

TH.net Regular
Reaction score
14
oh emm, either, or only 1 is fine what i meant is to make them slightly different (but small enough so it's pretty much the same)

the fix would be something like:

just leaving range +10

or

both
entering range -5
leaving range +5


be sure to account for leaks in the trigger when you put it in your map tho, this would be a good guide for that
 

Kike

Member
Reaction score
3
ok.. now it's working :) I've just add the creation of a dummy with faery fire and its very near the perfection :D
thanks to all helpers!
 
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