• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Detecting builder?

Status
Not open for further replies.
Level 2
Joined
Aug 15, 2008
Messages
28
How can i detect building unit via triggers?
I don't mean the structure a unit builds, I need to detect unit that has builded a structure...

Tnx in advance :thumbs_up:
 
Level 2
Joined
Aug 15, 2008
Messages
28
Hmm... maybe it would be but without human or undead i don't think it can be of much use =(

Tnx anyway ;)
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Hmm... maybe it would be but without human or undead i don't think it can be of much use =(

Tnx anyway ;)
It's because human and undead workers are annoying to detect, but i've to agree about the usefulness, even if you can build any building independent of the worker's race, you will still have an hidden solo worker like the elves and orc, and so quite useless for TD or kind of games.
 
Level 5
Joined
Oct 17, 2006
Messages
151
do this:

first find the order that is being sent when a building is produced by doing this trigger:
  • Temp
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (Current order: + (String((Issued order))))
Then in game build the building and remember the order string that is used to build the building then link to is by using this trigger:

  • Temp
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(<the order that was found>))
    • Actions
      • Game - Do the trigger that you want
 
Level 2
Joined
Aug 15, 2008
Messages
28
so I have to detect every order than make it for every order the first trigger finds?
I get it now...
TY SO MUCH =DD

P.S. I would rep you but i can't yet =)

Bump*
I just found a problem =P
It's working just fine but the problem is if you can detect it AFTER it's build so that actions run when building is done and not when i start building? Ty in advance ^^

Bump #2*
Sry I need this as well but I didn't made myself tottaly clear, could you detect the BUILDER after it's build and not the building?

Sry for all misunderstandings =P
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Unit finishes construction?

And no, you can only get the building unit for orc buildings and that needs you to store the builder until the building is done.

With human buildings you can have multiple builders which could be complex as the event would need to fire for each of the units that was buiding the building which would need its own system.
Undead buildings have no builder as they build themselves once started.
Some night elf buildings would cause problems as the builder dies after building like with ancients, but otherwise the same as the orcs would work.
 
Level 2
Joined
Aug 15, 2008
Messages
28
hmm crap how did i forgot all that...nevermind than could you please close this thread and call it solved? tnx... but at least i learned how to detect orders xD
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
The order given to build a building is simply the raw data id of the building.

E.g. if a peasant is ordered to make a farm, the orderid is 'hhou'. If multiple peasants are ordered to, all others will be ordered to "repair".

If you need to detect which unit initiated the build process when the building is finished (i.e. after the even "Unit finishes construction" doesn't "triggering unit" work just fine?
 
Level 2
Joined
Aug 15, 2008
Messages
28
no i tried that first =)

maybe you have some other idea how to do this:
I wanna give the builder exp after he builds something. 100 exp for a farm for example... tnx and sorry for double posting and moderators don't close yet sorry xD
 
Last edited by a moderator:
Level 5
Joined
Oct 17, 2006
Messages
151
store the unit that is selected through my way and then link to him AFTER the building is contructed...

In other words, if its a human type building (there around the building and building it) then add the unit doing the order into a unit group.

Then when building finishes construction select all units say 150 away from constructed unit that are part of the group. Then add your trigger stuff!
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
store the unit that is selected through my way and then link to him AFTER the building is contructed...

In other words, if its a human type building (there around the building and building it) then add the unit doing the order into a unit group.

Then when building finishes construction select all units say 150 away from constructed unit that are part of the group. Then add your trigger stuff!

Which way ?
It is horribly innacurate, since even if you check the orders of the units, you can't know if they are actually building or will do it.

Also a human builder can build structures which race is not human.
 
Level 5
Joined
Oct 17, 2006
Messages
151
Im sure we all know what I mean when I say human type building AFTERALL in the real wc3 that is the style that humans build there buildings.

Second, I would find the order command for "helping" with the building and add him in2 a group 2...

OR

what you could do is just select everyone thats 150 next to the building that is a worker and start your trigger from there.

However this would glitch if a worker happened to walk by.

A really accurate system would be to check periodically through out the entire building process the builders who helped build the building and that way for sure you can know that the builders in the end that have been filtered out with the (unit isnt in this group [the groups that were created through out the entire building process]) and finally locate your builders...

But may I ask why you want to find your builder?
 
Level 2
Joined
Aug 15, 2008
Messages
28
well neavea's way could work if i detect workers and add them to the group regardless of race and pick them afterwards and give them exp...maybe it'll work... i'll try it and post in a few mins...
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Even if you check all units which current order is repair within a range of the human building, you can't know if the units are actually constructing or not.

I know what i say because i did many tests, but if a lame solution is enough for you, then go with that, anyway you don't have really the choice :p
 
Level 2
Joined
Aug 15, 2008
Messages
28
I know this is bad triggering but it's for testing purposes only and it works...i think so xD

  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(farm))
    • Actions
      • Unit Group - Add (Ordered unit) to group
      • Set worker = (Triggering unit)
  • Untitled Trigger 002
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (worker is in group) Equal to True
    • Actions
      • Unit - Change color of worker to Dark Green
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Simply no.
First, build orders are only point order.
Second, you never remove the unit of the group if she get an other order, and when the unit get the order doesn't mean, the building is starting yet.
Simply forget this idea, live with that, there is no good way to detect human and undead workers. :(

Believe me i've tried it few hours, but you can waste your time if you really want.
 
Level 2
Joined
Aug 15, 2008
Messages
28
crap xD

btw,i didn't even bother removing it and it can be done with event unit cancels construction... i just need to make better variables =P
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
crap xD

btw,i didn't even bother removing it and it can be done with event unit cancels construction... i just need to make better variables =P
No you can't the construction can be stopped, but the event won't fire.
And trust me, it's just impossible.
If you don't, then you will realize later that you have waste your time for nothing.
 
Level 5
Joined
Oct 17, 2006
Messages
151
Simply no.
First, build orders are only point order.
Second, you never remove the unit of the group if she get an other order, and when the unit get the order doesn't mean, the building is starting yet.
Simply forget this idea, live with that, there is no good way to detect human and undead workers. :(

That gives me an Idea that for sure will be it!!!

I need to go now but what I will do is come back later and try to have a solution. I say that everything is possible (xept for a lot of local variables and a couple other things) with GUI and I know that there has to be a solution (it may be a REAL LONG thing) for this!
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
That gives me an Idea that for sure will be it!!!

I need to go now but what I will do is come back later and try to have a solution. I say that everything is possible (xept for a lot of local variables and a couple other things) with GUI and I know that there has to be a solution (it may be a REAL LONG thing) for this!
I bet 10 000 dollars that you won't have a good solution (good means accurate and working in all cases without any error).
 
Level 5
Joined
Oct 17, 2006
Messages
151
okay... I cant quite remember what I was onto so Ill try to figure out my "amazing idea" but until then hold on =]

Oh and also, are you trying to find out who are the builders who helped building it as well? (like hopped in the middle of building and sped up the building pace)

And are you looking for builders who only helped build the entire thing or those who just started it (and say someone else finished it)

oh and finally are you only going to have one builder or many that gain exp?
 
Level 2
Joined
Aug 15, 2008
Messages
28
well the base idea is to give the building one EXp, but if you think you can make it ( ;D )
try to give them EXp based on time they were building, so for an example if unit_1 started building it and stopped after 5 sec's he will get 50 exp and then unit_2 starts where he has stopped for another 12 secs he gets 120 exp and so on... i hope you get what i mean =)
 
Level 5
Joined
Oct 17, 2006
Messages
151
oohh...

Well ive been working on it and so far the only way I have gathered that is functional is to constantly check up on the building every sec get all the builders and count em. Then from that give them say 10 exp for that sec (instead of getting the exp after they get it during the construction.

It might be easier to have you builder trigger based on stuff happening now instead of later when the building is done being built. this could easily be done like so: (note its crude coding)

Event
Unit is issued order
Condition
Order = build or repair or whatever it is you want.
unit is not in unit group called "exp_gainers"
Action
Add unit to unit group called "exp_gainers"

Then your second trigger is the constant update that gives exp

Event
Every 1 sec
Condition
Action
Pick every unit "Exp_Gainers"
Add 10 exp to unit

Then your final trigger to remove anybody who isnt repairing/building

Event
Unit is issued order
Condition
Issued order not equal to build/repair
Put all of your other orders that you want here and yada yada.
Action
Remove unit from unit group exp_gainers

And that is the best solution I have found... Good luck with your map. Builders as a hero sounds cool!!! =]

Edit: WOOT 100TH POST!!!!!!!!!!!!
 
Last edited:
Level 2
Joined
Aug 15, 2008
Messages
28
thank you I hope it will work xD
and the builder isn't "the" hero...
it's just an altered meele map where all units are heroes and they get exp for various things...
EXAMPLE: builders get exp for building and gathering, footmans for smashing, etc. =PP
 
Status
Not open for further replies.
Top