Lua for changing name on contact

Post bug reports and ask for game support here.

Moderator: MOD_Command

Post Reply
User avatar
AdmiralSteve
Posts: 288
Joined: Mon Mar 28, 2011 2:32 pm
Location: Red Bluff, CA

Lua for changing name on contact

Post by AdmiralSteve »

I've been looking for a Lua script (presumably) that will allow to change the name of a contact, similar to what the "R" hot key will do. SetUnit only changes the name on the units side, i.e. Red Side and the detecting side, Blue Side remains the original name. Can this be done?

Thanks, Steve
“There are no extraordinary men...just extraordinary circumstances that ordinary men are forced to deal with.”
Admiral William Frederick Halsey Jr. 1882-1959

Parel803
Posts: 952
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

Re: Lua for changing name on contact

Post by Parel803 »

Good evening,

No answer, sorry, but just wondering: woudn't a contact change names along the (WRA) classification/identification line?

best regards GJ
User avatar
AdmiralSteve
Posts: 288
Joined: Mon Mar 28, 2011 2:32 pm
Location: Red Bluff, CA

Re: Lua for changing name on contact

Post by AdmiralSteve »

No answer, sorry, but just wondering: woudn't a contact change names along the (WRA) classification/identification line?

Once the bogey, skunk or goblin is identified, the name will change to, what I believe, will be the name in the DB. I though wish to give the contact a specific track number, as it does on an actual navy radar.
“There are no extraordinary men...just extraordinary circumstances that ordinary men are forced to deal with.”
Admiral William Frederick Halsey Jr. 1882-1959

User avatar
blu3s
Posts: 1267
Joined: Fri Jul 08, 2022 9:45 am

Re: Lua for changing name on contact

Post by blu3s »

You can use an Event with the trigger unit detected from your side as unit detector, and create a Lua Script for the action as follows to rename the contact:

Code: Select all

local unit = ScenEdit_UnitC()

--Logic to create the new name--

unit.name = 'New Contact'
Captura.JPG
Captura.JPG (68.61 KiB) Viewed 445 times
Parel803
Posts: 952
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

Re: Lua for changing name on contact

Post by Parel803 »

I understand the tracknumber.
best regards GJ
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

Re: Lua for changing name on contact

Post by michaelm75au »

Have you tried this?
local u = ScenEdit_GetContact( { side="United States", guid="c4114322-900c-428d-a3e3-0af701e81a7a" } )
u.name ='my contact'
Michael
Post Reply

Return to “Tech Support”