Problems when unit gets moved while starting construction of building

Ryuu

I am back with Chocolate (:
Reaction score
64
> why does it have to Pick every unit in PeasantBStart for once?

Well because first of all it detects if any unit is in the Unit Group (Units within 300.00 of Building matching (((Matching unit) is A ground unit) Equal to True)).

> and wont it just delete every building the peasant creates?

It only deletes those in the Unit Group.
 

Exuro.

New Member
Reaction score
5
well i just tested and it removes all buildings im making no matter what!

BUT...

I got another great idea!

How about we do it like this:

Event
Unit Finish construction
Condition
Unit within 1 of constructed unit equal false
Actions
Then Destroy last created structure
Move unit unstantly to (Spot of the constructed structure)



Think this could work, as everytime you build a building you will be within 1 of it, UNLESS you get pushed away from it (like that cap on my screenshot)

You following me?


EDIT:
> why does it have to Pick every unit in PeasantBStart for once?

Well because first of all it detects if any unit is in the Unit Group (Units within 300.00 of Building matching (((Matching unit) is A ground unit) Equal to True)).

Wont there always be a unit within the area of a constructed building?
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Test it and tell me the results. I'm very interested to know too. :p
 

Exuro.

New Member
Reaction score
5
how do i make this the way i want:

Code:
Set PeasantBStart = (Units within 1.00 of Building matching (((Matching unit) is A peon-type unit) Equal to True))

Now its setting PeasantBStart to all units within 1, how can i make it the opposite? that it picks every unit outside of it? (ill make a condition so it doesnt pick every single unit on the map hehe)


EDIT: think i figured a way around it
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Code:
Set Building = [COLOR="Red"][B][I was lost, so I couldn't remember what your Building is][/B][/COLOR]
Set PeasantBStart = (Units in (Playable map area))
Set OneRangeGrp = (Units within 1.00 of Building matching (((Matching unit) is A peon-type unit) Equal to True))
Unit Group - Pick every unit in PeasantBStart and do (Actions)
    Loop - Actions
        If (All Conditions are True) then (Then Actions) else (Else Actions)
            If - Conditions
                ([COLOR="Red"][B][Unit][/B][/COLOR] is in OneRangeGrp) Equal to False
            Then - Actions
                [COLOR="Red"][B][Actions][/B][/COLOR]
            Else - Actions

How about this?
 

Exuro.

New Member
Reaction score
5
think i got a way alrdy, will know soon if it works! but its something similar to yours hehe
 

Exuro.

New Member
Reaction score
5
holy crap im beautiful... check this out:

link comming soon:

Code:

Code:
Restrict Exploit
    Events
        Unit - A unit Finishes construction
    Conditions
    Actions
        Set Building = (Position of (Constructed structure))
        Region - Center RestrictLocation1 <gen> on Building
        Set Peasant_Allowed = (Units within 100.00 of Building matching (((Matching unit) is A peon-type unit) Equal to True))
        Set Peasant_NotAllowed = (Units within 200.00 of Building matching (((Matching unit) is A peon-type unit) Equal to True))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Peasant_Allowed is empty) Equal to True
            Then - Actions
                Unit - Kill (Constructed structure)
                Unit Group - Pick every unit in Peasant_NotAllowed and do (Actions)
                    Loop - Actions
                        Unit - Move (Picked unit) instantly to (Center of RestrictLocation1 <gen>)
            Else - Actions
                Game - Display to (All players) for 30.00 seconds the text: Worked
        Custom script:   call RemoveLocation( udg_Building )
        Custom script:   call DestroyGroup( udg_Peasant_Allowed )
        Custom script:   call DestroyGroup( udg_Peasant_NotAllowed )


Map: (Try it out)

View attachment 26475
 

Ryuu

I am back with Chocolate (:
Reaction score
64
> Try it out

Sorry, I'll do that tomorrow.
My computer is too lag to handle WE.
 

Exuro.

New Member
Reaction score
5
works like a charm hehe!

i found out that thing about the units within!

Collision Size of the Structure is 72, so the peasant gets pushed to 73 if it works, now im just testing how far away the peasant goes if he gets pushed trough a gap..


EDIT: Repped you, you kinda got me to the point of a succesful trigger for this hehe!
 

OneBadPsycho

10100111001
Reaction score
93
Uhm, I just found some bugs with your code:
If you build the building above your peasant (on a valid spot) it gets removed anyway.
If you don't finish your building (on an invalid spot for instance) it won't get removed and you can continue on the other side.
 

Exuro.

New Member
Reaction score
5
The:

Code:
Set Peasant_Allowed = (Units within 100.00 of Building matching (((Matching unit) is A peon-type unit

Needs to be somewhere around 20-25 ish higher than the units collision size!

Then the building on top of yourself not trigger the destroy
 

OneBadPsycho

10100111001
Reaction score
93
Well, it works now, but if you build like this: (In the big square)

view


Red squares are buildings. The number indicates some kind of order.
The green circle is the peasant.
The blue arrow indicates that the peasant gets moved out of the square.
White square is the bounds of the build area.



The peasant gets moved out of the square and can move to another place.
 

Exuro.

New Member
Reaction score
5
i made a semi tutorial to this in the section for those...

The:

Peasant_Allowed: This one is the size of the building your making
Peasant_NotAllowed: This is the max distance the peasant are able to move, so setting this slightly above that will work!

so simply by making the Peasant_NotAllowed higher fixes your problem..



EDIT: I just quickly tried what you said and set it to 400 to make sure, and it worked again! then i guess you just have to take 5 off each test to make it optimal..

EDIT2:
Ohh and by adding this little trigger into the loop the player gets his gold back to :D
Code:
Player - Set (Owner of (Constructing structure)) Current gold to (((Owner of (Constructing structure)) Current gold) + (Point-value of (Constructing structure)))
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top