[ANSWERED] Technique to test scripts using Unit Damaged/Unit Destroyed trigger. (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion



Message


tjhkkr -> [ANSWERED] Technique to test scripts using Unit Damaged/Unit Destroyed trigger. (12/1/2017 4:12:44 AM)

Hello,

I am trying to work through a lua script that is triggered by the Unit Damaged/Unit Destroyed triggers. Has anyone found a good way to test this?
I am trying to set up the script that if two bridges are blown up, it shuts down the mission; I have the code, I simply need to test it. I do not know how I can do that from the LUA screen code tester.

Anyone in the community have any ideas?




michaelm75au -> RE: Technique to test scripts using Unit Damaged/Unit Destroyed trigger. (12/1/2017 6:19:03 AM)

While game is running, open the Lua console, and run something like:
ScenEdit_SetUnitDamage({side='SideA', unitname='Ship1', dp=xxx}) where xxx is the damage points
The event should trigger.




tjhkkr -> RE: Technique to test scripts using Unit Damaged/Unit Destroyed trigger. (12/1/2017 6:54:12 PM)

quote:

ORIGINAL: michaelm75au
While game is running, open the Lua console, and run something like:
ScenEdit_SetUnitDamage({side='SideA', unitname='Ship1', dp=xxx}) where xxx is the damage points
The event should trigger.

EXCELLENT... and DUH (the DUH is aimed at me).
Thank you!




Betty_YueTu -> RE: Technique to test scripts using Unit Damaged/Unit Destroyed trigger. (4/14/2018 2:13:27 AM)

Hi,tjhkkr

You can use the 'Message' action to test your code like this:
ScenEdit_SetEvent('destroy_event',{mode = 'add'})
ScenEdit_SetAction({mode = 'add', type = 'Message', name = 'destroy_action', SideId = 'LuaSideA', Text = 'Destroied'})
ScenEdit_SetTrigger({mode = 'add', name = 'destroy_trigger', type = 'UnitDestroyed', targetfilter = {TargetSide = 'LuaSideB',TargetType = '2'}})

ScenEdit_SetEventAction('destroy_event', {mode = 'add', name = 'destroy_action'})
ScenEdit_SetEventTrigger('destroy_event', {mode = 'add', name = 'destroy_trigger'}) 


hope it can help you.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.71875