Trouble with LUA / Activation & Deactivation of No-Navigation Zones

Post bug reports and ask for game support here.

Moderator: MOD_Command

Post Reply
Fer_Cabo
Posts: 111
Joined: Thu Sep 17, 2015 2:39 pm

Trouble with LUA / Activation & Deactivation of No-Navigation Zones

Post by Fer_Cabo »

Hi guys,

I'm having trouble with a LUA instruction for an Action that deactivates an existing and active No-Navigation Zone.

What i found in CMANO manuals and sample scripts is as follows:

mySide = VP_GetSide({Name=”US”})
myZone = mySide:getnonavzone(“AAW Zone 1”)
myZone.isactive = ”False”

In my Scenario case, the script would be as follows, for an Action deactivating the initially activated No-Navigation-Zone defined for "DPRK" side units on Chinese Territory (the No-Navigation Zone is called "PRCSOVEREIGN"), once the side "PRC" has been attacked and the Mutual Defence Agreement between the two countries/Sides enters into effect:

mySide = VP_GetSide({Name=”DPRK”})
myZone = mySide:getnonavzone(“PRCSOVEREIGN”)
myZone.isactive = ”False”

The problem is... when i test this LUA Script in the Script Console, it returns ERROR based on a character position (148) which does not even exist, since the script is apparently not so long.

What'd be the right scripting?

Thanks a (metric)Ton in advance for your help!

Fernando.


User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Trouble with LUA / Activation & Deactivation of No-Navigation Zones

Post by michaelm75au »

Would be easier to see what problem is if you attach the scenario?
The error should report what line the error occurred on.
Michael
Fer_Cabo
Posts: 111
Joined: Thu Sep 17, 2015 2:39 pm

RE: Trouble with LUA / Activation & Deactivation of No-Navigation Zones

Post by Fer_Cabo »

Thanks Michael, but the error only reports unexpected character in position 148 (no line reference - besides, there are only 3 lines in the script).

Thought it could be a typo just like using some Capital letters: GetNonavzone vs. getnonavzone, but doesn't work either
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Trouble with LUA / Activation & Deactivation of No-Navigation Zones

Post by michaelm75au »

I assume you are using the latest version (1.12+)
The " isn't needed around the false.

If you can zip and attach the scenario, I can probably give a clearer answer.
I don't know it is just how it shows, but the quotes marks around DRPK and PRCSOVEREIGN seem to be different.
mySide = VP_GetSide({Name=DPRK})
myZone = mySide:getnonavzone(PRCSOVEREIGN)

Try using the single quote ' instead.
Michael
Fer_Cabo
Posts: 111
Joined: Thu Sep 17, 2015 2:39 pm

RE: Trouble with LUA / Activation & Deactivation of No-Navigation Zones

Post by Fer_Cabo »

mySide = VP_GetSide({Name="DPRK"})
myZone = mySide:getnonavzone("PRCSOVEREIGN")
myZone.isactive = False

It works like this!

Thanks a lot!
Post Reply

Return to “Tech Support”