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

Small trigger not working.

Status
Not open for further replies.

SpasMaster

Hosted Project: SC
Level 23
Joined
Jan 29, 2010
Messages
1,969
Hello, Hive!
I am working on a Castle Fight-based project. For those who aren't familiar:
players construct buildings in their base (castle) and buildings automatically spawn units (uncontrollable by players) that move against the opponent's castle. Whoever destroys the enemy castle wins.
That being said, I have a problem with one of the unit's abilities. The Druid autocasts Entangling Roots. The map already has a system [*] that restricts players from giving order to units, so they do everything on their own. The problem is that after the roots expire, the rooted unit has interrupted its attack-move orders and just stands there despite the following trigger that I'm about to show you. I believe the trigger is MUI. Here it is:

[*] When the unit is given the Stop order, it triggers the attack-move system.
Disclaimer: the attack-move system works flawlessly for all units. When they are ordered to 'Stop', they trigger the system properly. The only occasion it doesn't happen is in this case I've just described.

[trigger=""]Entangling Root
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Parasite (Entangling Root)
Actions
Custom script: local unit udg_Root_Target
Set Root_Target = (Target unit of ability being cast)
Set Generic_Point = (Position of (Triggering unit))
Unit - Create 1 Dummy (Generic uses) for (Owner of (Triggering unit)) at Generic_Point facing Default building facing degrees
Unit - Add Entangle to (Last created unit)
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Unit - Order (Last created unit) to Night Elf Keeper Of The Grove - Entangling Roots (Target unit of ability being cast)
Wait 5.05 seconds
Unit - Order Root_Target to Stop
Custom script: set udg_Root_Target = null
[/trigger]
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
well... one thing that can happen is that Wait 5.05 seconds is more like 1 second.
You should use Wait 5.05 seconds of gametime instead (but if you look to that function in JASS you can see it leaks a local timer handle. so youll have to copy and paste that and make it a custom function that youll use)

another thing that can happen is that the unit doesnt get a new order when it is ordered to stop.

(also you leak a location)
 

SpasMaster

Hosted Project: SC
Level 23
Joined
Jan 29, 2010
Messages
1,969
well... one thing that can happen is that Wait 5.05 seconds is more like 1 second.
That's only when the game is interrupted in some way, right? If that's the case then, this isn't the thing we're looking for since I didn't have anyone lagging or anything while seeing the issue.
another thing that can happen is that the unit doesnt get a new order when it is ordered to stop.
Someone didn't read my red-colored disclaimer it seems. :)
(also you leak a location)
Yeah, I noticed. Forgot to clean it, but its already fixed. But isn't that irrelevant to the issue?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You can use this to detect the orders given

  • Untitled Trigger 129
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Custom script: call BJDebugMsg(UnitId2String(GetUnitTypeId(GetTriggerUnit())) + " : " + OrderId2String(GetIssuedOrderId()) + " - "+ I2S(GetIssuedOrderId()))

Does the dummy have 0.00 as animation cast point and backswing? The 5.05 might not be enough, the unit could still be rooted.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
That's only when the game is interrupted in some way, right? If that's the case then, this isn't the thing we're looking for since I didn't have anyone lagging or anything while seeing the issue.
Wether you pause the game or not doesnt matter.
Everything that makes the game run faster, slower, not at all, etc doesnt matter for this wait.
This is a Real Life Time wait so it uses Real Life Time seconds.
It is not accurate either so isnt a good use to many things.
However, if your gamespeed is set to slow, your 5.05 seconds are actually 3 or something like that in game time seconds.
Try using the wait with gametime.
Also display if the target has the buff or not after that wait.

Yeah, I noticed. Forgot to clean it, but its already fixed. But isn't that irrelevant to the issue?
Hence the () brackets.
 
Status
Not open for further replies.
Top