Problems when unit gets moved while starting construction of building

Exuro.

New Member
Reaction score
5
hehe

so how do i get this trigger into a condition? hehe

sorry for the trouble hehe, but this problem have been unsolved for a few days now
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Handwritten:

Code:
Erm..
    Events
        Unit - A unit Starts construction
    Conditions
    Actions
        Wait 0.00 seconds
        Set tempPoint = (Position of (Constructing structure))
        Set PeasantBStart = (Units within 1.00 of tempPoint)
        Unit Group - Pick all units in PeasantBStart and do (Actions)
            Loop - Actions
                Unit - Remove (Constructing structure)
        Custom script: call RemoveLocation( udg_tempPoint )
        Custom script: call DestroyGroup( udg_PeasantBStart )

The wait is there to make sure that no time is wasted, since 0.01 seconds is crucial in your situation here.
 

Exuro.

New Member
Reaction score
5
This fine?

Code:
Restrict Exploit
    Events
        Unit - A unit Begins construction
    Conditions
    Actions
        Wait 0.00 seconds
        Set Building = (Position of (Constructing structure))
        Set PeasantBStart = (Units within 1.00 of Building matching (((Matching unit) is A ground unit) Equal to True))
        Unit Group - Pick every unit in PeasantBStart and do (Actions)
            Loop - Actions
                Unit - Remove (Constructing structure) from the game
        Custom script:   call RemoveLocation( udg_Building )
        Custom script:   call DestroyGroup( udg_PeasantBStart )

EDIT: Added the condition to picked units so it doesnt count in structures placed next to it
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Yes, but take a look at the red part:

Code:
Restrict Exploit
    Events
        Unit - A unit Begins construction
    Conditions
    Actions
        Wait 0.00 seconds
        Set Building = (Position of (Constructing structure))
        Set PeasantBStart = (Units within 1.00 of [COLOR="Red"][B](Position of (Constructing structure))[/B][/COLOR] matching (((Matching unit) is A ground unit) Equal to True))
        Unit Group - Pick every unit in PeasantBStart and do (Actions)
            Loop - Actions
                Unit - Remove (Constructing structure) from the game
        Custom script:   call RemoveLocation( udg_Building )
        Custom script:   call DestroyGroup( udg_PeasantBStart )

It's supposed to be 'Building'.
 

Ryuu

I am back with Chocolate (:
Reaction score
64
> nothing happens when i test... :(

Lol. Too slow ;)
Because range '1' is very, very, very, very, very small. Invisible to the eye, I guess. Or maybe it is just a dot on a 1x1 square. So try to make it 300 and see if it works.

Off-topic:
My avatar is ugly.
 

Exuro.

New Member
Reaction score
5
Ah that works, structure gets removed!

BUT... the feared BUT... it doesnt fix my problem! unit gets moved and then building gets removed!


Edit: About avatar.. dont be so self-destructive :D



Maybe a return peasant to original position somehow?
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Aha! Try doing this instead:

Code:
Restrict Exploit
    Events
        Unit - A unit Begins construction
    Conditions
    Actions
        Wait 0.00 seconds
        Set Building = (Position of (Constructing structure))
        Set BuilderPt = (Position of (Triggering unit))
        Set PeasantBStart = (Units within 1.00 of Building matching (((Matching unit) is A ground unit) Equal to True))
        Unit Group - Pick every unit in PeasantBStart and do (Actions)
            Loop - Actions
                Unit - Remove (Constructing structure) from the game
        Unit - Move (Triggering unit) instantly to BuilderPt
        Custom script:   call RemoveLocation( udg_BuilderPt )
        Custom script:   call RemoveLocation( udg_Building )
        Custom script:   call DestroyGroup( udg_PeasantBStart )

Off-Topic:
ROFL @ my avatar
 

Exuro.

New Member
Reaction score
5
hmm not working!

I dont think the triggers are fast enough to record the position of the unit before its actually moved


EDIT: Maybe a way to save the peasant location when (player clicks a building type in the building menu for placing?)

EDIT2: Or save the center of the location of the building being placed?
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Lol this is one situation I have never seen before.
Maybe you could try pausing the unit first.
 

Exuro.

New Member
Reaction score
5
Code like this:

Code:
Restrict Exploit
    Events
        Unit - A unit Begins construction
    Conditions
    Actions
        Wait 0.00 seconds
        Set Building = (Position of (Constructing structure))
        Set PeasantBStart = (Units within 300.00 of Building matching (((Matching unit) is A ground unit) Equal to True))
        Set Peasant = (Position of (Triggering unit))
        Unit Group - Pick every unit in PeasantBStart and do (Unit - Pause (Picked unit))
        Unit Group - Pick every unit in PeasantBStart and do (Actions)
            Loop - Actions
                Unit - Remove (Constructing structure) from the game
        Wait 1.00 seconds
        Unit - Move (Triggering unit) instantly to Building
        Unit Group - Pick every unit in PeasantBStart and do (Unit - Unpause (Picked unit))
        Custom script:   call RemoveLocation( udg_Peasant )
        Custom script:   call RemoveLocation( udg_Building )
        Custom script:   call DestroyGroup( udg_PeasantBStart )
 

Ryuu

I am back with Chocolate (:
Reaction score
64
No!

Code:
Restrict Exploit
    Events
        Unit - A unit Begins construction
    Conditions
    Actions
        Wait 0.00 seconds
        Set Building = (Position of (Constructing structure))
        Set PeasantBStart = (Units within 300.00 of Building matching (((Matching unit) is A ground unit) Equal to True))
        Set Peasant = (Position of (Triggering unit))
       [COLOR="Red"][B] Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Pause (Picked unit))[/B][/COLOR]
        Unit Group - Pick every unit in PeasantBStart and do (Actions)
            Loop - Actions
                Unit - Remove (Constructing structure) from the game
        Wait 1.00 seconds
        Unit - Move (Triggering unit) instantly to Building
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Unpause (Picked unit))
        Custom script:   call RemoveLocation( udg_Peasant )
        Custom script:   call RemoveLocation( udg_Building )
        Custom script:   call DestroyGroup( udg_PeasantBStart )

Not right. Just replace the one in red with

Code:
Unit - Pause (Triggering unit)
 

Exuro.

New Member
Reaction score
5
is there no way to set the building point to center of it? because when im moving the unit to the building point, it just moves it to the edge of it, if you know what i mean


EDIT: think i got a funny idea. let me see if it works first thou hehe
 

Exuro.

New Member
Reaction score
5
Just tried setting the move trigger to move the unit to the player start position, and that doesnt work either, so... i dont think its trying to move the correct unit
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Well. Try using

Code:
Restrict Exploit
    Events
        Unit - A unit Begins construction
    Conditions
    Actions
        Wait 0.00 seconds
        Set BuildingPt = (Position of (Constructed structure)
        Set Building = (Center of (Region centered at BuildingPt with size (1.00, 1.00)))
        Set PeasantBStart = (Units within 300.00 of Building matching (((Matching unit) is A ground unit) Equal to True))
        Set Peasant = (Position of (Triggering unit))
        Unit - Pause (Triggering unit)
        Unit Group - Pick every unit in PeasantBStart and do (Actions)
            Loop - Actions
                Unit - Remove (Constructing structure) from the game
        Wait 1.00 seconds
        Unit - Move (Triggering unit) instantly to Building
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Unpause (Picked unit))
        Custom script:   call RemoveLocation( udg_BuildingPt )
        Custom script:   call RemoveLocation( udg_Peasant )
        Custom script:   call RemoveLocation( udg_Building )
        Custom script:   call DestroyGroup( udg_PeasantBStart )
 

Exuro.

New Member
Reaction score
5
nah, its something completly different.

try carefully read trough the code.. why does it have to Pick every unit in PeasantBStart for once?

and wont it just delete every building the peasant creates?


Edit: i just tried that code you posted above! that was the funny idea i had, just a little different
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top