• 🏆 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!

[General] How to make this follow

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

How to make this thing follow the paladin without making it to leak?

  • Actions
    • Set TempLoc = EPIC_POINT1
    • Custom script: call RemoveLocation(udg_EPIC_POINT1)
    • Set TempLoc2 = (Position of Paladin 0002 <gen>)
    • Set TempReal = (Angle from TempLoc to TempLoc2)
    • Set EPIC_POINT1 = (TempLoc offset by 100.00 towards TempReal degrees)
    • Special Effect - Create a special effect at EPIC_POINT1 using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_TempLoc)
    • Custom script: call RemoveLocation(udg_TempLoc2)
Rep for the helpers.
 

Attachments

  • HOMING MISSILE.w3x
    23.9 KB · Views: 54
Level 20
Joined
Jul 14, 2011
Messages
3,213
Why do you set TempLoc equal to a point that you haven't declared in this trigger before? It would take the value that EPIC_POINT1 had before, if it had any. At the end of the trigger, you have to remove "EPIC_POINT1" together with TempLoc and TempLoc2.

So far, what is it? What do you want to achieve? What's the idea? It's just an special effect? Does it have another effect? What do you want to achieve?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I don't if this fact is true or not, but I've tested it once and run into this problem before.
Let's say you have 2 variables, TempLocA and TempLocB.
Let's say, you create a point at target point of an ability and set it as TempLocA.
A few seconds later, you decided to make that point disappear and replace it with the new variable, so you will do like this;
  • Custom script: Set TempLocB = TempLocA
  • Custom script: call RemoveLocation(udg_TempLocA)
I know it's called as replacing the point, but when you destroy the original data, all other data attached to it will be destroyed too, thus TempLocB returns a null location (probably center of map)

This should work;
  • Untitled Trigger 002
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set TempLoc = (Position of Paladin 0002 <gen>)
      • Set TempReal = (Angle from TempLoc to TempLoc2)
      • Set TempLoc2 = (TempLoc offset by 15.00 towards TempReal degrees)
      • Special Effect - Create a special effect at TempLoc2 using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call RemoveLocation(udg_TempLoc2)
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
Hey,

Excellent try defskull but it didn't work like I wanted. My fault, I didn't gave enough information. Anyway, with help of my friend we created this. I'm not familiar with Hastables yet, so I ask: does this leak? It at least works.

  • Untitled Trigger 002
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set TempLoc = (Position of Paladin 0002 <gen>)
      • Set TempReal = (Angle from EPIC_POINT1 to TempLoc)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between TempLoc and EPIC_POINT1) Less than or equal to 40.00
        • Then - Actions
          • Set TempLoc2 = (Position of Paladin 0002 <gen>)
          • Special Effect - Create a special effect at TempLoc2 using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_TempLoc2)
        • Else - Actions
          • Hashtable - Save Handle Of(EPIC_POINT1 offset by 40.00 towards TempReal degrees) as 0 of 1 in EventHashtable
          • Custom script: call RemoveLocation(udg_EPIC_POINT1)
          • Set EPIC_POINT1 = (Load 0 of 1 in EventHashtable)
          • Special Effect - Create a special effect at EPIC_POINT1 using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_TempLoc)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Hashtable - Save Handle Of(EPIC_POINT1 offset by 40.00 towards TempReal degrees) as 0 of 1 in EventHashtable
You should make it as variable before saving it.
Your are creating locations by using offset, it would leak twice.

Something like this is okay;
  • Set TempLoc2 = (TempLoc offset by 15.00 towards TempReal degrees)
  • Hashtable - Save Handle OfTempLoc2 as 0 of 1 in EventHashtable
You did not stated clearly what you want to do, I can't say for sure.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
I don't if this fact is true or not, but I've tested it once and run into this problem before.
Let's say you have 2 variables, TempLocA and TempLocB.
Let's say, you create a point at target point of an ability and set it as TempLocA.
A few seconds later, you decided to make that point disappear and replace it with the new variable, so you will do like this;
  • Custom script: Set TempLocB = TempLocA
  • Custom script: call RemoveLocation(udg_TempLocA)
I know it's called as replacing the point, but when you destroy the original data, all other data attached to it will be destroyed too, thus TempLocB returns a null location (probably center of map)

Handle variables just point to handles, you don't attach data to them. Obviously, if 2 variables point to same handle and you destroy it, you won't be able to retrieve it from any of them.
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
Okay, hmm. What I'm trying to create here is a boss spell. When boss casts a spell, an explosion starts to follow player's hero. The explosion explodes every 0,25 second going forward to player's hero and damages nearby units.

What you tried defskull before didn't work because when I for example put my paladin to top-right corner, the explosion teleported instantly where paladin was. It should take many seconds to reach there.

And I don't want to use missile this time.

Here's the latest map. Maybe someone here could help me to create a leakless version of this map? But no JASS, please.

Map attached.

(because this is just a simple test map, the explosion starts from the middle of map and no need extra things like damage, I'll do that later)
 

Attachments

  • HOMING MISSILE.w3x
    24.2 KB · Views: 66
Level 33
Joined
Mar 27, 2008
Messages
8,035
So what I can understand from your request is;
1. You want the boss to cast spell (target unit) to Player Hero (Red)
2. When the spell is casted, an explosion (thunder clap) per interval will "travel" towards Player Hero's unit
3. While travelling, the explosion will damage nearby enemy units.
4. When the explosion comes in contact with Player Hero, it will deal the last damage and the spell stops.

Is this the correct spell chronology ?

Whatever the reason, I'll edit the test map and will give you the result.

EDIT:
The test map is edited, download it.

NOTE: The spell is not MUI, I thought well, it's for Boss, what the heck.
 

Attachments

  • HOMING MISSILE (1).w3x
    25.9 KB · Views: 83
Last edited:
Status
Not open for further replies.
Top