Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

[ANSWERED] Technique to test scripts using Unit Damaged/Unit Destroyed trigger.

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> [ANSWERED] Technique to test scripts using Unit Damaged/Unit Destroyed trigger. Page: [1]
Login
Message << Older Topic   Newer Topic >>
[ANSWERED] Technique to test scripts using Unit Damaged... - 12/1/2017 4:12:44 AM   
tjhkkr


Posts: 2428
Joined: 6/3/2010
Status: offline
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?

< Message edited by tjhkkr -- 12/1/2017 6:54:38 PM >


_____________________________

Remember that the evil which is now in the world will become yet more powerful, and that it is not evil which conquers evil, but only love -- Olga Romanov.
Post #: 1
RE: Technique to test scripts using Unit Damaged/Unit D... - 12/1/2017 6:19:03 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
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.

_____________________________

Michael

(in reply to tjhkkr)
Post #: 2
RE: Technique to test scripts using Unit Damaged/Unit D... - 12/1/2017 6:54:12 PM   
tjhkkr


Posts: 2428
Joined: 6/3/2010
Status: offline
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!


_____________________________

Remember that the evil which is now in the world will become yet more powerful, and that it is not evil which conquers evil, but only love -- Olga Romanov.

(in reply to michaelm75au)
Post #: 3
RE: Technique to test scripts using Unit Damaged/Unit D... - 4/14/2018 2:13:27 AM   
Betty_YueTu

 

Posts: 4
Joined: 4/13/2018
Status: offline
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.

(in reply to tjhkkr)
Post #: 4
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> [ANSWERED] Technique to test scripts using Unit Damaged/Unit Destroyed trigger. Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.688