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

destructables and orders

Status
Not open for further replies.
Level 13
Joined
May 11, 2008
Messages
1,198
IssueTargetOrder
IssuePointOrder
IssuePointOrderById
IssueTargetOrderById

Why aren't these working on destructables?

I even went through the trouble of importing the library called GetClosestWidget "by Bannar aka Spinnaker" and I can do things like get its x/y reals but the main thing I need to do is target it with an ability through the trigger and I can't seem to do it. Doesn't matter if I use eattree string or smart string or even harvest string or any of the various Ids you'd think would work, think one of them was 852416, whatever it was I had it screen shot to make sure I got it right so that's not really important...

IssueBuildOrder

Should I be using this one? Doesn't seem correct at all but I'm not sure what else I can try at this point. Am I messing up in the Object Editor somehow? Because all I'm trying to do is make the unit eat a second tree on a timer after eating the first one. I'm getting the debug message that everything is fine except the order function call. Normally the activate field is blank on a lot of abilities, but I don't think it's necessary to fill that in for using the function call, but if I had to, that would be news to me.
Line is this at the moment:
call IssueTargetOrder(d.cast,"eattree",d.targ)
//or for you that don't know what struct I'm using:
call IssueTargetOrder(unitdevourer,"eattree",destructabletree)
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
JASS:
native IssueTargetOrder             takes unit whichUnit, string order, widget targetWidget returns boolean
native IssueTargetOrderById         takes unit whichUnit, integer order, widget targetWidget returns boolean

should work since it takes widget. Maybe you pass in null?
 
Level 13
Joined
May 11, 2008
Messages
1,198
JASS:
native IssueTargetOrder             takes unit whichUnit, string order, widget targetWidget returns boolean
native IssueTargetOrderById         takes unit whichUnit, integer order, widget targetWidget returns boolean

should work since it takes widget. Maybe you pass in null?

Not sure what you mean by pass in null, the only times I'm using null in the struct is in nulling the timer and in the line for GetClosestDestructable, which seems to work for what it claims to do.

This is the line that is unfamiliar to me but as I explained, I can get the various coordinates, so I figure it's working fine.
set d.targ= GetClosestDestructable(d.x,d.y,null)

You don't think it's getting the dead destructable, do you? Oh, that might be what's going on...edit -- that is definitely what went down.

Yeah, okay this isn't going to work the way I imagined it. It seems as though I will have to go without allowing stumps in the map or else the worker unit might get stuck on stumps? My workaround is to simply remove the destructable when it's eaten, and that part is fitting since it's more of a devouring thing and you don't get the full resource value of the tree out of it...but what am I supposed to do with regards to compatibility with other worker types? I want to keep Shredder-type lumber workers in there at the very least and they would leave a stump behind, logically speaking...which would mess up this worker's trigger.
 
Last edited:
Level 13
Joined
May 11, 2008
Messages
1,198
IssueTargetOrder works on destructables. You are doing something wrong.

Yeah, I figured it out by the third post here. Now the problem is how to use the boolean expression filter from the GetClosestWidget library.
JASS:
function GetClosestDestructable takes real x, real y, boolexpr filter returns destructable

I don't understand why the boolexpr is even in there since you can't ask if it's a tree if you haven't got destructable yet. I don't think that is a usable boolexpr but if someone knows better, feel free to tell about it.

It looks like I have to use EnumDestructablesInRect but I don't understand the final part about code actionfunc.
I don't seem to be good at understanding enumeration, unfortunately. Ugh.
I have another function lying around somewhere that enumerates units and uses a group, but that's different, I can't put trees in groups and this function doesn't take that same entry code actionfunc. You cheated and used null in your demo/example so I don't know how to proceed.
 
Status
Not open for further replies.
Top