| 06-12-2009, 07:47 PM | #1 |
Hello, I am a newb with the world editor, and I need help! How to make a trigger, which removes the collision size for a unit with a lumber harvesting ability, every time the unit is ordered to harvest on a tree (and to return it back to normal when the unit starts doing something else, although that is probably easy even for me). This would result in the unit to be able to "forest walk", so that it could walk through, or rather between the trees in a forest. I've put a lot of effort into this, but still can't make it work. Help please, if you can. Would be much appreciated, thanks! |
| 06-12-2009, 08:35 PM | #2 |
I believe there is a native called SetCollisionSize. Just search for it using TESH, I am sure that you will find something. Once you find the function just give it the value zero, I believe the rest is easy, and I am almost sure (not 100%) that this will fix your problem. |
| 06-12-2009, 08:39 PM | #3 |
SetCollisionSize doesn't work on values below a certain limit. Adding the 'Ghost - Visible' ability would be better. |
| 06-12-2009, 08:57 PM | #4 |
Ghost ability won't remove the unit's collision. It will only let all other units ignore the "ghost" so they can walk through it. This is a one-sided effect though. native SetUnitPathing takes unit whichUnit, boolean flag returns nothing this turns off a unit's collision but that unit will also be able to walk on usually unwalkable terrain or even water. The unit's pathfinding will act as if the unit's collision was still active though. I think the best way would be to place the trees so that only units with a small collision size can walk through them. You can then reduce the units' collision size via trigger by using the native Flame_Phoenix mentioned. |
| 06-12-2009, 09:46 PM | #5 |
First of all, thanks for the replies. Then... Sorry guys, but I think you've overestimated me! I am a serious noob! I don't know anything about any programming languages, I have no idea whatsoever of what is "a native" or "TESH" (maybe one of those map making tools?). So please bear with me! I have tried simple triggers like: Events Unit - A unit Is issued an order targeting an object Conditions (Unit-type of (Triggering unit)) Equal to Ghoul Actions Unit - Turn collision for (Triggering unit) Off This one would actually satisfy me well, I don't really mind the ghouls walking over water. The problem with this trigger is naturally that it sets the collision off whenever the ghoul does anything, not only when it harvest is ordered on a tree. I've tried ability comparison as a condition, but it doesn't work, probably because we're talking about something classified as "an order" here ;)? But I don't know how to make an order comparison either, it asks for a variable or a function. So I'd have to make some kind of a variable? I don't know how to do that, so I guess I should have probably just tried to search for a tutorial on that, or something. I'd really like to get this matter solved, cos I'll never get my map finished, if things like this will keep holding me back for so long! So if you can still help, then please do! |
| 06-12-2009, 09:51 PM | #6 |
You need Trigger: Conditions
![]() (String((Issued order))) Equal to YourOrderStringHereThat condition is under "String Comparison" => "Convert Order To String". And now go and learn some Jass :D |
| 06-12-2009, 09:52 PM | #7 | |
Ok ... so you don't know what JASS is, and you never heard of JNGP? Anyway I don't think it will be needed for your case. Your code has the condition wrong. Instead of checking if the unit being order is a ghoul, try making that check AND check if the target is a tree ! Done =P Quote:
|
| 06-22-2009, 09:23 PM | #8 |
Thanks again for your help guys, and sorry for posting again after such a long time! I tried order comparison with that "convert order to string" thing, with "harvest" as the order, but it didn't work. I tried so many other ways too, for example harvest (ghouls lumber) etc. Tried to change the unit type from ghoul to peasant and tried "harvest" with that too, didn't work either. However when I tried this: Events Unit - A unit Is issued an order targeting an object Conditions ((Unit-type of (Triggering unit)) Equal to Ghoul) and ((Issued order) Equal to (Order(attack))) Actions Unit - Turn collision for (Ordered unit) Off , it indeed worked when I attacked, but not on any other situation, but as I mentioned before this is not what I'm looking for. So it seems that the failure is because "harvest" isn't the correct value for the order, or because this doesn't "just for some reason" work with the harvesting ability. Do you have any idea that how I might find out the correct value for the order, or if it doesn't work for some other reason? |
| 06-22-2009, 10:06 PM | #9 |
Well if you just order the units by right-clicking then the order will probably be "smart". This includes any other right-click order though so you might need another condition to make sure the trigger only fires if the target is a tree and the ordered unit is a ghoul. |
| 06-23-2009, 12:19 AM | #10 |
Wow... I feel pretty stupid right now, because that trigger would have worked all along, if I just had manually clicked "gather", and not right clicked. However, you can't use gather manually, if you are already carrying resources, so I need this to work with right clicking too. So you're correct; I need another condition (which I most likely don't know how to make myself ), to be sure the trigger only works on trees when right clicking. And I think I found yet another issue, which gladly probably won't cause any trouble though. I think in the WC3 engine is a thing, which causes ghouls to regain collision size when they are harvesting (actually harvesting, not ordered to do so), because of worker units have been made to lose their collision size, when they are (automatically, not manually) returning resources. So this regaining of the collision size prevents a group of ghouls from harvesting at the very same spot on top of each other with 0 collision size. So anyways... I was already going to post this, asking for help on how to do it. But unexpectedly, as I was writing this message, I think I've come up with the simple condition that seems to make things work: (Destructible-type of (Target destructible of issued order)) Equal to Summer Tree Wall Finally I almost did something myself! But I have to thank you two a lot, I could have made it not in an aeon without your help! Now the next thing I will start to work on is a way to make the ghouls have their collision size returned back to normal, when they are told to do something else. If you have any suggestions, please feel free to enlighten me! ;D |
