Data Realms Fan Forums http://45.55.195.193/ |
|
Complex Target Designator Launcher with Multiple Designators http://45.55.195.193/viewtopic.php?f=73&t=45954 |
Page 1 of 1 |
Author: | Galahir950 [ Tue May 19, 2015 10:51 pm ] |
Post subject: | 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? |
Author: | Bad Boy [ Wed May 20, 2015 12:36 am ] |
Post subject: | 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. |
Author: | Galahir950 [ Wed May 20, 2015 1:13 am ] |
Post subject: | 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? |
Author: | Bad Boy [ Wed May 20, 2015 3:50 am ] |
Post subject: | 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. |
Author: | Galahir950 [ Wed May 20, 2015 9:08 am ] |
Post subject: | 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 |
Author: | Arcalane [ Wed May 20, 2015 12:24 pm ] |
Post subject: | Re: Complex Target Designator Launcher with Multiple Designators |
'cause you're forgetting the "" around the magazine name. e.g. HDFirearm:SetNextMagazineName("Magazine Designator Small Dig") |
Author: | 4zK [ Wed May 20, 2015 6:05 pm ] |
Post subject: | 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. |
Author: | Galahir950 [ Wed May 20, 2015 6:54 pm ] |
Post subject: | 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) |
Author: | Bad Boy [ Wed May 20, 2015 7:07 pm ] |
Post subject: | 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. |
Author: | Galahir950 [ Wed May 20, 2015 7:23 pm ] |
Post subject: | Re: Complex Target Designator Launcher with Multiple Designators |
That fixed the gold issue, thank you. |
Author: | Bad Boy [ Wed May 20, 2015 7:34 pm ] |
Post subject: | Re: Complex Target Designator Launcher with Multiple Designators |
Cool, good to hear. |
Author: | Galahir950 [ Wed May 20, 2015 10:01 pm ] |
Post subject: | 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. I am trying to figure out how to fix it. |
Author: | Arcalane [ Wed May 20, 2015 11:55 pm ] |
Post subject: | 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. |
Author: | Galahir950 [ Thu May 21, 2015 12:05 am ] |
Post subject: | Re: Complex Target Designator Launcher with Multiple Designators |
Thank you, I knew it was probably because I was doing something stupid. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |