Page 1 of 1

Random posture change

Posted: Sun Dec 28, 2025 7:50 pm
by ParachuteProne
Hi: I'm very new to Lua.

Is there a script that would check at say the top of every hour giving say a 10% chance that a side or sides change their posture towards another side or sides ?

I see a Lua "scenedit set side posture , however how do I do it randomly ?

I have 4 sides, I would like one to change it's posture towards another if a certain number range is randomly generated.
ie: 0-10% chance.

Thanks for any help !

Re: Random posture change

Posted: Mon Dec 29, 2025 8:21 pm
by Mark352
You can do this with a repeatable Event set to run at 10% probability that uses a Regular Time Trigger set at 1-hour and an Action Lua Script that changes postures and disables the Event. I suspect you want the event to cease repeating once postures are changed.

1. Create the Regular Time Trigger set to 1-hour.
2. Create the Action Lua Script using this example code;

Code: Select all

ScenEdit_SetSidePosture("Blue","Red","H") --Posture of Blue Side towards Red Side hostile

ScenEdit_SetEvent('POSTURE_CHANGE', {IsRepeatable = false}) --Turns off the repeatable POSTURE_CHANGE event
3. Create the repeatable Event using the Trigger and Action you created. Set the probability to 10 percent.

In this example Blue becomes hostile to Red. The Event name in this example is POSTURE_CHANGE. Try it on a small ship on ship scenario to make sure it does what you need. Hope this helps. Good luck.

Re: Random posture change

Posted: Tue Dec 30, 2025 1:30 am
by ParachuteProne
Will give it a shot.
Thanks for the help