Construction Script Question

make adding a segemnt a function, and then call that function when you need to add a segment

Hi All, I have a construction Script that makes it so I can construct a ladder. The issue is that I need to change the height of the ladder during play. Is there any way to override the construction script and change the variable I need to change (LadderTop)

I need to take away segments. Think it will work the same way? Also, have any thoughts on how to make that function?

What @Mootbing is hinting at here is that the ladder should have an Add Segment function and a Remove Segment function. You run the Add Segment in the Construction Script X times to make a ladder.

During gameplay you can then either Add Segment or Remove Segment.


The script that is running during loop iteration should be a function so it can be reused later on. Make it modular.

The way its working now is that LadderTop has a 3d widget so I can extend the ladder as far as needed so it can be used multiple times throughout the map. Should that be not part of the function?

Should that be not part of the
function?

The widget should call the add / remove functions. If I were to made a procedural ladder, I’d:

  • add a step:

  • remove a step:

  • so the Construction Script can:

Image from Gyazo

  • and then in game the widget could call:

331336-04-addingremove.jpg

Image from Gyazo

Somewhat oversimplified compared to yours, but it’s a legit approach. Add / Remove function can check the length of the array and add a ladder initial / final steps should these have a unique look.

This is just like an overview of the approach; pretty sure it’s applicable to your situation. You can add steps already - put that in a function, if Construction Script can call it, so can the Widget.

The only data you need to pipe in is the index of the next step or… It would not hurt to keep the static mesh comps in an array so you can remove the last one. This way the index of the step is the length of the array.

Thanks, I’ll try that. I’m super far in with this ladder setup, so I don’t want to have to go back and fix every ladder in the levels just for this one thing