View unanswered posts | View active topics It is currently Thu Mar 28, 2024 12:44 pm



Reply to topic  [ 10 posts ] 
 Efficient dual fire? 
Author Message
User avatar

Joined: Fri Apr 30, 2010 2:12 pm
Posts: 560
Reply with quote
Post 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.


Mon Oct 03, 2011 5:38 pm
Profile
User avatar

Joined: Thu May 28, 2009 3:59 pm
Posts: 209
Reply with quote
Post 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.


Mon Oct 03, 2011 6:08 pm
Profile
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post Re: Efficient dual fire?
Yeah, just use Lua to control the firing. Probably even easier if it's guns tied to the actor.


Mon Oct 03, 2011 6:26 pm
Profile
User avatar

Joined: Fri Apr 30, 2010 2:12 pm
Posts: 560
Reply with quote
Post 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:


Mon Oct 03, 2011 7:08 pm
Profile
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post 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?


Tue Oct 04, 2011 3:51 pm
Profile YIM WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Efficient dual fire?
You could use a global variable in order to change the mag of all the guns of that type.


Tue Oct 04, 2011 6:52 pm
Profile
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post 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?


Thu Oct 06, 2011 3:49 pm
Profile YIM WWW

Joined: Fri Feb 25, 2011 3:52 pm
Posts: 39
Reply with quote
Post 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"


Thu Oct 06, 2011 5:05 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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.


Thu Oct 06, 2011 9:14 pm
Profile
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post 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


Sat Oct 08, 2011 3:11 pm
Profile YIM WWW
Display posts from previous:  Sort by  
Reply to topic   [ 10 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.438s | 16 Queries | GZIP : Off ]