- Joined
- Aug 26, 2016
- Messages
- 204
Hello, I am interested in the generation of scenery and landscape, I have one question, in the screenshot there is an area with four trees, how can I create trees in the same position in the neighboring area?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Actions

Set VariableSet CenterPoint = (Center of Region 000 <gen>)

Set VariableSet OffsetPoint = (CenterPoint offset by 256.00 towards 45.00 degrees.)

Destructible - Create a Summer Tree Wall at OffsetPoint facing (Random angle) with scale 1.00 and variation 0

Set VariableSet OffsetPoint = (CenterPoint offset by 256.00 towards 135.00 degrees.)

Destructible - Create a Summer Tree Wall at OffsetPoint facing (Random angle) with scale 1.00 and variation 0

Set VariableSet OffsetPoint = (CenterPoint offset by 256.00 towards 225.00 degrees.)

Destructible - Create a Summer Tree Wall at OffsetPoint facing (Random angle) with scale 1.00 and variation 0

Set VariableSet OffsetPoint = (CenterPoint offset by 256.00 towards 315.00 degrees.)

Destructible - Create a Summer Tree Wall at OffsetPoint facing (Random angle) with scale 1.00 and variation 0
Actions

Set VariableSet CenterPoint = (Center of Region 000 <gen>)

Set VariableSet Angle = -45.00

For each (Integer A) from 1 to 4, do (Actions)


Loop - Actions



Set VariableSet Angle = (Angle + 90.00)



Set VariableSet OffsetPoint = (CenterPoint offset by 256.00 towards Angle degrees.)



Destructible - Create a Summer Tree Wall at OffsetPoint facing (Random angle) with scale 1.00 and variation 0
Custom script: call RemoveLocation( udg_CenterPoint )
Custom script: call RemoveLocation( udg_OffsetPoint )
It's not easy and may not even be possible to get this working the way you want. There's very limited functions related to Destructibles, you can't get their variation, facing angle, etc... This is the best I could do:All that remains is to teach you to remember the positions of all deorations in an area when creating them in another
Copy Destructibles

Events

Conditions

Actions


-------- Note: You must Set Destructible_Region_First and Destructible_Region_Second before running this trigger! --------


-------- --------


-------- Copy destructibles in first region: --------


Set VariableSet Destructible_Index = 0


Set VariableSet Destructible_Center_Point = (Center of Destructible_Region_Old)


Destructible - Pick every destructible in Destructible_Region_Old and do (Actions)



Loop - Actions




Set VariableSet Destructible_Index = (Destructible_Index + 1)




Set VariableSet Destructible = (Picked destructible)




Set VariableSet Destructible_Position = (Position of Destructible)




-------- --------




-------- Store the type, distance, angle of the destructible: --------




Set VariableSet Destructible_Type[Destructible_Index] = (Destructible-type of Destructible)




Set VariableSet Destructible_Offset_Distance[Destructible_Index] = (Distance between Destructible_Center_Point and Destructible_Position)




-------- Try to account for floating point error: --------




Set VariableSet Destructible_Offset_Distance[Destructible_Index] = (Destructible_Offset_Distance[Destructible_Index] + 0.01)




Set VariableSet Destructible_Offset_Angle[Destructible_Index] = (Angle from Destructible_Center_Point to Destructible_Position)




-------- --------




Custom script: call RemoveLocation( udg_Destructible_Position )


Custom script: call RemoveLocation( udg_Destructible_Center_Point )


-------- --------


-------- Paste destructibles in second region: --------


Set VariableSet Destructible_Center_Point = (Center of Destructible_Region_New)


For each (Integer Destructible_Loop) from 1 to Destructible_Index, do (Actions)



Loop - Actions




Set VariableSet Destructible_Position = (Destructible_Center_Point offset by Destructible_Offset_Distance[Destructible_Loop] towards Destructible_Offset_Angle[Destructible_Loop] degrees.)




-------- --------




Destructible - Create a Destructible_Type[Destructible_Loop] at Destructible_Position facing (Random angle) with scale 1.00 and variation 0




-------- --------




Custom script: call RemoveLocation( udg_Destructible_Position )


Custom script: call RemoveLocation( udg_Destructible_Center_Point )
Copy Example

Events


Time - Elapsed game time is 1.00 seconds

Conditions

Actions


Set VariableSet Destructible_Region_Old = First Region <gen>


Set VariableSet Destructible_Region_New = Second Region <gen>


Trigger - Run Copy Destructibles <gen> (ignoring conditions)


-------- --------


Set VariableSet Destructible_Region_Old = Third Region <gen>


Set VariableSet Destructible_Region_New = Fourth Region <gen>


Trigger - Run Copy Destructibles <gen> (ignoring conditions)
I would probably use a combination of locusted units and destructables-with-no-model-but-with-a-pathing-map to simulate actual destructables. That would allow you to use unit functions for facing/scaling/color/height/etc. and still block unit pathing as necessary.It's not entirely clear how to do this.
