Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Need some Lua halp with a Special Action

 
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 >> Need some Lua halp with a Special Action Page: [1]
Login
Message << Older Topic   Newer Topic >>
Need some Lua halp with a Special Action - 2/7/2022 11:04:39 PM   
BeirutDude


Posts: 2625
Joined: 4/27/2013
From: Jacksonville, FL, USA
Status: offline
Want to charge a side (Russia) 2500 VP for requesting release of nuclear weapons. The nuclear release works fine but something I can't figure out is wrong with the subtraction of the VPs...

ScenEdit_SetDoctrine({side="Russia"}, {use_nuclear_weapons="yes" })
ScenEdit_SetAction({mode='add', type='Points', name='Russia loses some ..', SideId='Russia', PointChange=-2500})


_____________________________

"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!
Post #: 1
RE: Need some Lua halp with a Special Action - 2/7/2022 11:09:15 PM   
BDukes

 

Posts: 1695
Joined: 12/27/2017
Status: offline
Hmm.. Isn't the type = PointChange

Mike

_____________________________

Don't call it a comeback...

(in reply to BeirutDude)
Post #: 2
RE: Need some Lua halp with a Special Action - 2/8/2022 12:27:38 AM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
Why do you need an separate action if it's contained in a SA and not just:
ScenEdit_SetScore("Russia", ScenEdit_GetScore("Russia") - 2500,"Nuclear release authority granted"); ?

But if you were trying to create an Action (tied to some trigger) the issue is name vs description.
ScenEdit_SetAction({mode='add', type='Points', Description='Russia Authorizes Nukes (point change)', SideId='Russia', PointChange=-2500})



(in reply to BDukes)
Post #: 3
RE: Need some Lua halp with a Special Action - 2/8/2022 2:42:42 AM   
BeirutDude


Posts: 2625
Joined: 4/27/2013
From: Jacksonville, FL, USA
Status: offline
quote:

ORIGINAL: KnightHawk75

Why do you need an separate action if it's contained in a SA and not just:
ScenEdit_SetScore("Russia", ScenEdit_GetScore("Russia") - 2500,"Nuclear release authority granted"); ?

But if you were trying to create an Action (tied to some trigger) the issue is name vs description.
ScenEdit_SetAction({mode='add', type='Points', Description='Russia Authorizes Nukes (point change)', SideId='Russia', PointChange=-2500})


So I'm trying to do two things in one SA, allow the player to grant nuclear release at a cost of a certain number of VPs (likely -2,500). Seems like the first option will take away any points they gained and set the score to -2,500 which I don't want to do. but if say they have gained 3,000 VPs so far and then decide to go nuclear, after the SA is invoked I want them to have 500 VPs remaining (in that particular example).


< Message edited by BeirutDude -- 2/8/2022 2:43:17 AM >


_____________________________

"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!

(in reply to KnightHawk75)
Post #: 4
RE: Need some Lua halp with a Special Action - 2/8/2022 3:05:39 AM   
BeirutDude


Posts: 2625
Joined: 4/27/2013
From: Jacksonville, FL, USA
Status: offline
quote:

ScenEdit_SetAction({mode='add', type='Points', Description='Russia Authorizes Nukes (point change)', SideId='Russia', PointChange=-2500})


Yeah, this gets me the same thing, nothing. I ran the scenario using this in the SA and in theory Russia should have -2,500 VPs right now but it's still zero. I've been playing with this for hours! Its funny the simple stuff is hard, and the seemingly hard stuff not so bad! This shouldn't be this hard, but it's not working.




Attachment (1)

_____________________________

"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!

(in reply to KnightHawk75)
Post #: 5
RE: Need some Lua halp with a Special Action - 2/8/2022 3:29:02 AM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
quote:

Yeah, this gets me the same thing, nothing. I ran the scenario using this in the SA

You do not run that in the SA itself, that Creates an Action, it does NOT execute it. Go look in your actions you'll see it's there (remove it though). Actions must be tied to triggers if you want them to execute, or if you were like re-using or manually wanted to call the actions you could use ExecuteEventAction('thename') after creating it. Anyway doing either is making it more complicated then it needs to be.

quote:

So I'm trying to do two things in one SA, allow the player to grant nuclear release at a cost of a certain number of VPs (likely -2,500). Seems like the first option will take away any points they gained and set the score to -2,500 which I don't want to do

Nope, it first gets the current score and removes 2500 from the current score and is the simplest way to do what you want.
Put this in your SA and you should be good to go:

ScenEdit_SetDoctrine({side="Russia"}, {use_nuclear_weapons="yes" });
ScenEdit_SetScore("Russia", ScenEdit_GetScore("Russia") - 2500,"Nuclear release authority granted");






< Message edited by KnightHawk75 -- 2/8/2022 3:32:47 AM >

(in reply to BeirutDude)
Post #: 6
RE: Need some Lua halp with a Special Action - 2/8/2022 3:31:38 AM   
BeirutDude


Posts: 2625
Joined: 4/27/2013
From: Jacksonville, FL, USA
Status: offline
OK, I'm headed out the door for work now and will give it a try tomorrow. Thanks for your help!!!!

_____________________________

"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!

(in reply to KnightHawk75)
Post #: 7
RE: Need some Lua halp with a Special Action - 2/8/2022 3:33:45 AM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
Your welcome, let me know if you run into any further issues.

(in reply to BeirutDude)
Post #: 8
RE: Need some Lua halp with a Special Action - 2/8/2022 9:52:45 PM   
BeirutDude


Posts: 2625
Joined: 4/27/2013
From: Jacksonville, FL, USA
Status: offline
quote:

Nope, it first gets the current score and removes 2500 from the current score and is the simplest way to do what you want.
Put this in your SA and you should be good to go:

ScenEdit_SetDoctrine({side="Russia"}, {use_nuclear_weapons="yes" });
ScenEdit_SetScore("Russia", ScenEdit_GetScore("Russia") - 2500,"Nuclear release authority granted");


Thanks that worked and I see what you did. I would have played with it for a week and never through of calling up the score with a Lua function within a function. Again TY.

_____________________________

"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
PRESIDENT RONALD REAGAN, 1985

I was Navy, but Assigned TAD to the 24th MAU Hq in Beirut. By far the finest period of my service!

(in reply to KnightHawk75)
Post #: 9
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Need some Lua halp with a Special Action 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

1.609