Looking to see if a specific pup attachment is equipped

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: Looking to see if a specific pup attachment is equipped

Post by bluesolarflare » Mon Sep 28, 2015 9:22 am

So something along the lines of

Code: Select all

bool getSetAttachment(not sure what to declare here)

for (int i = 0; i < 12; i++)
     {
       if(m_Equip.Attachments[i] == 8643) //cycle thru slot ids 0-11 for damage gauge
          {
             return true;
          }
      else 
        {
             return false;
       }
}
      



Also please excuse my noobishness as I am still learning as I go along :D

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: Looking to see if a specific pup attachment is equipped

Post by bluesolarflare » Mon Sep 28, 2015 4:59 pm

The above didn't work. I guess one of the issues I am having is understanding m_Equip.Attachments. From my understanding it looks for a value 0-11 (since there are 12 equipable attachment slots) and I can create a loop to cycle through all slots. That much I get, but I guess I don't understand how to correlate the slot to the actual attachment id. This is about as far as I get in terms of the actual loop

Code: Select all

bool getSetAttachment() //not sure if this is the correct statement
for (int i = 0; i < 12; i++)
     {
       if(m_Equip.Attachments[i])
      //What to do here?
     }

Then I am guessing once that is done I would simply call it in ai_automaton to see if it equals the attachment ID?

Code: Select all

if (PPet->getSetAttachment() == 8643)

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Looking to see if a specific pup attachment is equipped

Post by kjLotus » Mon Sep 28, 2015 6:07 pm

you're not too familiar with C++ then, I assume? good to read up on it if you're planning on doing any C++ stuff in the core

in the meantime, I'll implement that function for you since I have a bit of refactoring I want to do in that file anyways

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: Looking to see if a specific pup attachment is equipped

Post by bluesolarflare » Mon Sep 28, 2015 9:27 pm

Thanks. I am learning as I go and to be honest I was quite surprised I was able to get the automaton ai as far as I have in the core. Casting and ws decision making wasn't too difficult I just have a lot more to learn.

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: Looking to see if a specific pup attachment is equipped

Post by bluesolarflare » Tue Sep 29, 2015 12:08 am

One last question KJ,

I saw the changes that were made. What is the proper syntax to call the function? I am guessing hasAttachment?

I tried m_PPet->hasAttachment() == 8643 for damage gauge, but Visual Studio says that the function doesn't take 0 arguments.

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Looking to see if a specific pup attachment is equipped

Post by kjLotus » Tue Sep 29, 2015 1:40 am

it doesn't take 0 arguments, it takes one argument (the attachment id to look for)

Code: Select all

if (m_PPet->hasAttachment(8643))

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: Looking to see if a specific pup attachment is equipped

Post by bluesolarflare » Wed Sep 30, 2015 11:08 am

Thanks that worked. Apparently I had some left over attempts and VB was throwing an error because of it. I'll be spending the next few days programing logic for attachments since there are so many. I can definitely see why PUP wasn't touched as much since there are a lot of things going on behind the scenes in the automaton ai that you really don't think about. I'm attempting to keep things simple so that it can be posted to GitHub in the future after ai_xxx is rewritten.

Post Reply