Data Realms Fan Forums
http://forums.datarealms.com/

Efficient dual fire?
http://forums.datarealms.com/viewtopic.php?f=73&t=25729
Page 1 of 1

Author:  Naxete [ Mon Oct 03, 2011 5:38 pm ]
Post subject:  Efficient dual fire?

I'm wondering if it would be possible, using lua, to tell cortex command,
while wielding 2 devices at same time, shoot them separately depending with key you choose.

For example: Do you have a regular vanila robot, which carries one saw-off shotgun in the right
arm/hand and one regular uzi in the left arm/hand and I want pressing Z the shotgun shots and
pressing C the uzi shots, that would be somehow possible? (if yes, how would be the script?)

I was thinking to develop something very similar to HARM suits, but sadly, I'm just decent spriting.

Author:  Asatruer [ Mon Oct 03, 2011 6:08 pm ]
Post subject:  Re: Efficient dual fire?

Would there be anything wrong with the primary weapon firing when using the normal fire key, and only the second weapon fire with a special key?

In anycase an offhand weapon can still use its alternate fire mode just fine (not its pie menu though, which is sad). So you could just build the offhand weapon that normally would not shot anything, but that shoots whatever you want when a key is pressed. This way your actor could have an onhand and offhand weapon that shoot independently.

Author:  Lizardheim [ Mon Oct 03, 2011 6:26 pm ]
Post subject:  Re: Efficient dual fire?

Yeah, just use Lua to control the firing. Probably even easier if it's guns tied to the actor.

Author:  Naxete [ Mon Oct 03, 2011 7:08 pm ]
Post subject:  Re: Efficient dual fire?

Asatruer wrote:
In anycase an offhand weapon can still use its alternate fire mode just fine (not its pie menu though, which is sad). So you could just build the offhand weapon that normally would not shot anything, but that shoots whatever you want when a key is pressed. This way your actor could have an onhand and offhand weapon that shoot independently.


I think I've already done something similar to that, with the Slug gunner and
I believe coalition Punisher does that with grabbing hand device its selected...
which grabs with some key and clicking squeezes...

That could work, thanks you booth, guys :wink:

Author:  carriontrooper [ Tue Oct 04, 2011 3:51 pm ]
Post subject:  Re: Efficient dual fire?

Hey, since this request is kinda related to the topic at hand (offhand shooting), could you guys tell me a way for two similar devices to switch firing modes?
So, for example, gun A could be held offhand. There's an actor that exclusively uses gun A on both arms, and gun A has pie-menu mode of changing firing modes. What should I do to make both guns change their fire mode at the same time? So far, all it does is changing the magazine on the front gun, and not the offhand gun. How can I change them both at the same time?

Author:  Asklar [ Tue Oct 04, 2011 6:52 pm ]
Post subject:  Re: Efficient dual fire?

You could use a global variable in order to change the mag of all the guns of that type.

Author:  carriontrooper [ Thu Oct 06, 2011 3:49 pm ]
Post subject:  Re: Efficient dual fire?

Asklar wrote:
You could use a global variable in order to change the mag of all the guns of that type.


But if there's two of that actor in place (complete with their guns) when one changes mags, the other would too, and that would complicate things.
How do I write code to change mags for a gun and another one close to it?

Author:  zoidberg [ Thu Oct 06, 2011 5:05 pm ]
Post subject:  Re: Efficient dual fire?

use old good method - cycle through moids, find mos, if mo's parent id == self parent id and mo is hdfirearm and it's preset name == "blah" then change it's sharpness or something.

same with seperate fire, but look for preset name "blah" and "blah bg"

Author:  Asklar [ Thu Oct 06, 2011 9:14 pm ]
Post subject:  Re: Efficient dual fire?

Well, you can do the check stuff for the BG one, because you can simply do parent.EquippedItem for the FG one.
We need a parent.BGEquippedItem or something.

Author:  carriontrooper [ Sat Oct 08, 2011 3:11 pm ]
Post subject:  Re: Efficient dual fire?

Allright, to clear some confusion, here's the code. Overall, very very similar to the Coalition missile change script.

Code:
function MechMissileLauncherRocket(actor)
   local gun = ToAHuman(actor).EquippedItem;
   if gun ~= nil then
      local gun = ToHDFirearm(gun);
      gun:SetNextMagazineName("RCKTL Mag");
      gun:Reload();
   end
end

function MechMissileLauncherMissile(actor)
   local gun = ToAHuman(actor).EquippedItem;
   if gun ~= nil then
      local gun = ToHDFirearm(gun);
      gun:SetNextMagazineName("MSSLL Mag");
      gun:Reload();
   end
end


how do I make it check for a similar gun a few pixels away/with the same parent MOID? I'm familiar with the range find thingy, but I'm at a loss on how to write the thing.

EDIT: Nevermind, followed the MOID tracking idea, works fine.
EDIT 2: Nevermind that last one, still changes all actors' guns. Works now after a few tweaks, solution below.

Code:
function MechMissileLauncherRocket(actor)
local gun = ToAHuman(actor).EquippedItem;
for i=1,MovableMan:GetMOIDCount() - 1 do
      part = MovableMan:GetMOFromID(i);
      if part.PresetName == "Multi Launcher" and part.RootID == gun.RootID  then
         local part = ToHDFirearm(part);
         part:SetNextMagazineName("RCKTL Mag");
         part:Reload();
      end
end
end

function MechMissileLauncherMissile(actor)
local gun = ToAHuman(actor).EquippedItem;
for i=1,MovableMan:GetMOIDCount() - 1 do
      part = MovableMan:GetMOFromID(i);
      if part.PresetName == "Multi Launcher" and part.RootID == gun.RootID  then
         local part = ToHDFirearm(part);
         part:SetNextMagazineName("MSSLL Mag");
         part:Reload();
      end
end
end

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/