View unanswered posts | View active topics It is currently Sun Dec 01, 2024 3:57 am



Reply to topic  [ 14 posts ] 
 Complex Target Designator Launcher with Multiple Designators 
Author Message

Joined: Thu Oct 04, 2012 3:08 am
Posts: 90
Reply with quote
Post Complex Target Designator Launcher with Multiple Designators
I am trying to make a grenade launcher that launches target designators that call in a delivery of an orbital round w/ payload if you have enough gold. I would also like to add Pie menu options that switch between magazines that fire a (surface detonated small warhead) designator, a (surface detonated large warhead) designator, a (digging small warhead) designator, and a (digging large warhead) designator.

Is this possible with LUA?


Tue May 19, 2015 10:51 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
Yes, though it'll take a bit of effort. Arcalane's Warhammer 40K mod is probably a good place to look for target designators, it'll likely prove useful for you.
Keep in mind you'll still have to do the work to set up pie button options for the different warhead types (and of course make the different warheads) and fiddle with the script so it works well on your gl.


Wed May 20, 2015 12:36 am
Profile

Joined: Thu Oct 04, 2012 3:08 am
Posts: 90
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
Thank you, I will look into that.

EDIT: Is there any way to make it spawn a delivery at the beacon like you bought something from the store or make it spawn a craft with a payload?


Wed May 20, 2015 1:13 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
Sort of. You can't do it exactly as the buy menu would, as right now lua can only modify an order, not force a purchase.
However, you can add an objective arrow instead, and, using that as the spawn indicator, simply use lua to spawn in a craft with the payload. Keep in mind that if you're using objective arrows you'll probably have to readd them each frame, since most activities will clear them every frame.


Wed May 20, 2015 3:50 am
Profile

Joined: Thu Oct 04, 2012 3:08 am
Posts: 90
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
I have everything set up, including the Pie Menu, and it works perfectly, EXCEPT, I can not figure out how to make it remove the gold from the team that fired it and I can not figure out how to change the magazines. I tried "HDFirearm:SetNextMagazineName", but that did not work.

The Pie Items


Pie.lua


One of the Scripts


Wed May 20, 2015 9:08 am
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
'cause you're forgetting the "" around the magazine name. :roll:

e.g. HDFirearm:SetNextMagazineName("Magazine Designator Small Dig")


Wed May 20, 2015 12:24 pm
Profile YIM
User avatar

Joined: Mon Oct 11, 2010 1:15 pm
Posts: 594
Location: Finlandia
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
If the particle is fired by something that has a designated team, you can always just do self.Team

Also maybe do a check whether there is enough money left, unless you want the funds to go negative.


Wed May 20, 2015 6:05 pm
Profile

Joined: Thu Oct 04, 2012 3:08 am
Posts: 90
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
Okay, I added the quotation marks around the magazine, but it still says the same thing in the console.
Code:
no overload of "HDFirearm:SetNextMagazineName" matched the arguments (<HDFirearm>,string)
candidates are:
HDFirearm:SetNextMagazineName(string)


One of the magazine scripts


I also can not seem to get the gold LUA right. Is self.Team an already defined variable?
Code:
Activity:SetTeamFunds(Activity:GetTeamFunds(self.Team) - 100, self.Team)

I also tried this, but it did not work either.
Code:
ActivityMan:GetActivity():SetTeamFunds(ActivityMan:GetActivity():GetTeamFunds(self.Team) - 100, self.Team)


Wed May 20, 2015 6:54 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
Hard to say for sure without knowing what the error you're getting is but try making sure it's treating the activity you get as a game activity:
Code:
local activity = ToGameActivity(ActivityMan:GetActivity());
activity:SetTeamFunds(activity:GetTeamFunds(self.Team) - 100, self.Team);


You can merge that into one line if you want, I split it up primarily for readability (also less overhead but that's unimportant).
Also, I haven't looked at what you put this script on but it might be a good idea to make sure that if you drop a print in somewhere, self.Team gives the correct value.


Wed May 20, 2015 7:07 pm
Profile

Joined: Thu Oct 04, 2012 3:08 am
Posts: 90
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
That fixed the gold issue, thank you.


Wed May 20, 2015 7:23 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
Cool, good to hear.


Wed May 20, 2015 7:34 pm
Profile

Joined: Thu Oct 04, 2012 3:08 am
Posts: 90
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
I have made more progress on the Pie menu.


Now I am only getting this error. I tried all the Pie options.
Image
I am trying to figure out how to fix it.


Wed May 20, 2015 10:01 pm
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
Because you're still doing it wrong, albeit this is something I overlooked at first because I'd just woken up.

This is a single magazine switching function;

Code:
function BolterMagHEHeavy(actor)
   local gun = ToAHuman(actor).EquippedItem;
   if gun ~= nil then
      local gun = ToHDFirearm(gun);
      gun:SetNextMagazineName("Heavy Bolter HE Magazine");
      gun:Reload();
   end
end


See how in this instance it checks for a held item, changes the value of 'gun' appropriately, then tells 'gun' to change mag, not 'HDFirearm'?

Your 'self.####Mag' is redundant/unnecessary because it's not the broken part any more.


Wed May 20, 2015 11:55 pm
Profile YIM

Joined: Thu Oct 04, 2012 3:08 am
Posts: 90
Reply with quote
Post Re: Complex Target Designator Launcher with Multiple Designators
Thank you, I knew it was probably because I was doing something stupid.


Thu May 21, 2015 12:05 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.104s | 13 Queries | GZIP : Off ]