View unanswered posts | View active topics It is currently Wed Dec 25, 2024 4:58 pm



Reply to topic  [ 9 posts ] 
 ACrab Weapon Accessing via Pie menu (SOLVED) 
Author Message
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post ACrab Weapon Accessing via Pie menu (SOLVED)
What exactly is the HDFirearm of an ACrab? I know it's part of the turret, but does that mean it's an attachable of an attachable of an actor?

I can't seem to access it through a pie menu action and I can't use aCrab.EquippedItem because it's not an equipped item, it's the turret that has it equipped.

This is what I have for the pie menu action

Code:
function AmmoMissile(actor)
   local MoEnt
   local crab = ToACrab(actor)
   for i = 1, MovableMan:GetMOIDCount()-1 do
      if MovableMan:GetRootMOID(i) == crab.RootID then
         MoEnt = MovableMan:GetMOFromID(i)
         if MoEnt.PresetName == "Crawler Mounted Launcher" then
            print(MoEnt.RootID.PresetName)
            local gun = ToHDFirearm(MoEnt);
            local magSwitchName = "Crawler Missile Launcher Magazine";
            if gun.Magazine == nil or (gun.Magazine ~= nil and gun.Magazine.PresetName ~= magSwitchName) then
               gun:SetNextMagazineName(magSwitchName);
               crab:ReloadFirearm();
            end
         end
      end
   end
end


From what I can tell it not reaching the first print, I've got a hunch it's not getting my ACrab. I don't know how the the actor argument works and what it does to get it or if the ACrab actor has any restrictions towards HDFirearm access.

I can't get the gun to change magazines, I need help :-(

Thanks.


Last edited by Coops on Wed Jul 04, 2012 9:29 pm, edited 1 time in total.



Wed Jul 04, 2012 6:42 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: ACrab Weapon Accessing via Pie menu
Have you tried ToActor instead of ToAcrab?


Wed Jul 04, 2012 7:55 pm
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: ACrab Weapon Accessing via Pie menu
No go.

It does seem to be getting the weapon though, every single weapon though.


Wed Jul 04, 2012 8:22 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: ACrab Weapon Accessing via Pie menu
What is the script attached to and what is the actor in function AmmoMissile(actor) referencing? I may just be being an idiot here but to me you're calling ToACrab(actor) without specifying what actor is, which looks like it wouldn't work. Or am I missing something crucial?


Wed Jul 04, 2012 8:42 pm
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: ACrab Weapon Accessing via Pie menu
actor is the parameter of the function, of which is attached to a pie menu command, which is attached to a HDFirearm, which is attached to an ACrab.

I assume actor of the function is referencing to the actor holding the weapon.

EDIT: Actually, if that's true. Maybe I should check if it's getting the turret and not the ACrab itself. But even then, I'm asking for the RootID of the weapon, not what it's attached to.


Wed Jul 04, 2012 8:47 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: ACrab Weapon Accessing via Pie menu
Oh okay, it's for a pie slice so that makes sense then. Sorry, I should have read your first post more carefully.

Have you tried, as you suggested, print (crab)?
Other than that I'm not sure what's wrong, though it's possible you can just reference the actor in the function without doing ToACrab at all.
i.e.
Code:
for i = 1, MovableMan:GetMOIDCount()-1 do
      if MovableMan:GetRootMOID(i) == actor.RootID then
         MoEnt = MovableMan:GetMOFromID(i)
         etc.

Edit: Though looking at a few other ammo swapping scripts I'm pretty sure this isn't the case.

If you don't mind sharing it (via pm or posting here or whatever) I'd be happy to try to help properly, I find it difficult to properly figure things out without the ability to test ingame so I'm afraid I may not be much help if you don't want to share it. That said, it might not be worth the effort since I don't know what the problem is. Rather I'd just throw in enough prints to find the problem and try to work from there, which is obviously something you can easily do yourself.


Wed Jul 04, 2012 9:01 pm
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: ACrab Weapon Accessing via Pie menu
I got it.

I forgot the number one rule of accessing MOs.

Code:
GetsHitByMOs = 1


Thanks guys.


Wed Jul 04, 2012 9:28 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: ACrab Weapon Accessing via Pie menu (SOLVED)
I'll be interested to see mag swapping on the ACrab when it's done, is it for a new project or an existing one?


Wed Jul 04, 2012 9:39 pm
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: ACrab Weapon Accessing via Pie menu (SOLVED)
New project.

I've been working on it for a while now actually, been getting really anxious to finish this and release it.


Wed Jul 04, 2012 9:51 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 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.045s | 15 Queries | GZIP : Off ]