Complex Target Designator Launcher with Multiple Designators
Author
Message
Galahir950
Joined: Thu Oct 04, 2012 3:08 am Posts: 90
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.
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
Galahir950
Joined: Thu Oct 04, 2012 3:08 am Posts: 90
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?
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
Galahir950
Joined: Thu Oct 04, 2012 3:08 am Posts: 90
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.
function SmallDig(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then HDFirearm:SetNextMagazineName(Magazine Designator Small Dig) end end
function SmallSurf(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then HDFirearm:SetNextMagazineName(Magazine Designator Small Surf) end end
function LargeDig(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then HDFirearm:SetNextMagazineName(Magazine Designator Large Dig) end end
function LargeSurf(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then HDFirearm:SetNextMagazineName(Magazine Designator Large Surf) end end
One of the Scripts
Code:
function Create(self) self.LaunchTimer = Timer() end
function Update(self) if self.LaunchTimer:IsPastSimMS(1000) then self.Bomb = CreateACRocket("RDI Small Surface Strike") self.Bomb.Pos = Vector(self.Pos.X,-10) self.Bomb.Vel = Vector(0,50) MovableMan:AddActor(self.Bomb) ActivityMan:GetActivity():SetTeamFunds( ActivityMan:GetActivity():GetTeamFunds(0) - 100, 0 ) self:GibThis() elseif self.Vel.Largest > 3 then self.LaunchTimer:Reset()
end end
Wed May 20, 2015 9:08 am
Arcalane
Joined: Sun Jan 28, 2007 10:32 pm Posts: 1609 Location: UK
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")
Wed May 20, 2015 12:24 pm
4zK
Joined: Mon Oct 11, 2010 1:15 pm Posts: 594 Location: Finlandia
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
Galahir950
Joined: Thu Oct 04, 2012 3:08 am Posts: 90
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
Code:
function LargeSurf(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then HDFirearm:SetNextMagazineName("Magazine Designator Large Surf") HeldDevice:Reload() end end
I also can not seem to get the gold LUA right. Is self.Team an already defined variable?
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
Galahir950
Joined: Thu Oct 04, 2012 3:08 am Posts: 90
Re: Complex Target Designator Launcher with Multiple Designators
Re: Complex Target Designator Launcher with Multiple Designators
Cool, good to hear.
Wed May 20, 2015 7:34 pm
Galahir950
Joined: Thu Oct 04, 2012 3:08 am Posts: 90
Re: Complex Target Designator Launcher with Multiple Designators
I have made more progress on the Pie menu.
Code:
function SmallDig(actor) self.SmallDigMag = "Magazine Designator Small Dig" local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then HDFirearm:SetNextMagazineName(self.SmallDigMag) end HeldDevice:Reload() end
function SmallSurf(actor) self.SmallSurfMag = "Magazine Designator Small Surf" local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then HDFirearm:SetNextMagazineName(self.SmallSurfMag) end end
function LargeDig(actor) self.LargeDigMag = "Magazine Designator Large Dig" local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then HDFirearm:SetNextMagazineName(self.LargeDigMag) end HeldDevice:Reload() end
function LargeSurf(actor) self.LargeSurfMag = "Magazine Designator Large Surf" local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then HDFirearm:SetNextMagazineName(self.LargeSurfMag) end end
Now I am only getting this error. I tried all the Pie options.
I am trying to figure out how to fix it.
Wed May 20, 2015 10:01 pm
Arcalane
Joined: Sun Jan 28, 2007 10:32 pm Posts: 1609 Location: UK
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
Galahir950
Joined: Thu Oct 04, 2012 3:08 am Posts: 90
Re: Complex Target Designator Launcher with Multiple Designators
Thank you, I knew it was probably because I was doing something stupid.
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