HomePortalFAQSearchMemberlistUsergroupsRegisterLog in
Making threads to link to banned members content grants an automatic ban
Meet the new KITO admins & hear their plans here.
You can use google search to find threads and posts here now. Example

Share | 
 

 Body/Head Restrictions

View previous topic View next topic Go down 
AuthorMessage
Skyia

avatar

Game username : Skyia
Server : Royal Elements
Female Posts : 144
Join date : 2014-09-14
Age : 16
Location : In your mind

PostSubject: Body/Head Restrictions    Thu Jul 06, 2017 3:45 am

I see that Hyper posted about this but im at lost with it also, could someone help me here?

I tried taking the existing heads and making a restriction for the body

CharScreen:
Code:
  if(partChanged=="Body")
      {
         while(mDef->isRestricted(bodyID,headID))
         {
            bodyID += (increment?1:-1);
            if(bodyID<0)bodyID = mDef->maxBodies-1;
            if(bodyID>=mDef->maxBodies)bodyID = 0;
         }
         return;
ExternalDefs:
Code:
bool isRestricted(const short &bodyID, const short &headID)
   {
      if(bodyID==0)
      {
         if(headID==1||headID==2||headID==3||headID==4||headID==5||headID==6||headID==7||headID==8||headID==9||headID==10||headID==11||headID==12||headID==13||headID==14||headID==15)return true;
      }
      else if(bodyID==2)
      {
         if(headID==16||headID==17)return true;
      }
      return false;

I do have Hamilton's multi body selector and I made it similar to the head
Code:
//body
 if(iID==0)
 {
 bodyID += (increment?1:-1);
 if(bodyID<0)bodyID = mDef->maxBodies-1;
 if(bodyID>=mDef->maxBodies)bodyID = 0;
 applyRestrictions("Body",increment);
 mUnit->replaceBodyMesh(mSceneMgr,meshName("Body",bodyID),(page==PAGE_PRESET1||page==PAGE_PRESET2||page==PAGE_PRESET3));
 doReequip = true;
 }
Back to top Go down
Hamilton

avatar

Game username : Hamilton
Server : Myatar Legends // Dragon's Den
Female Posts : 373
Join date : 2011-10-20
Age : 31
Location : everywhere

PostSubject: Re: Body/Head Restrictions    Thu Jul 06, 2017 7:35 pm

"doReequip=true;" is for resetting item placement on the head2 bone in the event the item equipped had an equip2 animation. it doesn't effect the 'equipping' of body parts.


Your "if(partChanged==)" is on the wrong part. It should be on the part you want to restrict, not the one doing the restricting. The way you have it now, it's saying that depending on which head is chosen, to restrict which body can be picked next. (while the bool isRestricted is doing the opposite.)


what you want to use would be

Quote :
if(partChanged=="Body")
{
//back to head1
headID = 1;
mUnit->replaceHeadMesh(mSceneMgr,meshName("Head",headID));
return;
}
and have a base head1 that both bodies could use (or maybe you want it headless, no judge here XD) (actually, more i think about it, i wonder "is this part is even needed?")

and then have your heads look like

Quote :
if(partChanged=="Head")
{
while(mDef->isRestricted(bodyID,headID))
{
//back to maneless
maneID = 0;
mUnit->replaceManeMesh(mSceneMgr,meshName("Mane",maneID));
return;
}
Back to top Go down
Skyia

avatar

Game username : Skyia
Server : Royal Elements
Female Posts : 144
Join date : 2014-09-14
Age : 16
Location : In your mind

PostSubject: Re: Body/Head Restrictions    Thu Jul 06, 2017 8:15 pm

When I do that I get all these errors
https://gyazo.com/577eed71201399c77f38372ec6b1e5d3
Back to top Go down
Hamilton

avatar

Game username : Hamilton
Server : Myatar Legends // Dragon's Den
Female Posts : 373
Join date : 2011-10-20
Age : 31
Location : everywhere

PostSubject: Re: Body/Head Restrictions    Thu Jul 06, 2017 9:17 pm

Missing a closing } somewhere.

Where are you placing this new "bool isRestricted" at? directly under the one that exists for manes? The closing } for the manes is a bit further down the page, under a bunch of green commented out bits. So it's an easy miss. Try moving the code to the line above the "bool isRestrictedTuft(const short &tuftID)". And then have it as:

Code:

bool isRestricted(const short &bodyID, const short &headID)
   {
      if(bodyID==0)
      {
         if(headID==1||headID==2||headID==3||headID==4||headID==5||headID==6||headID==7||headID==8||headID==9||headID==10||headID==11||headID==12||headID==13||headID==14||headID==15)return true;
      }
      else if(bodyID==2)
      {
         if(headID==16||headID==17)return true;
      }
      return false;
  }
Back to top Go down
Skyia

avatar

Game username : Skyia
Server : Royal Elements
Female Posts : 144
Join date : 2014-09-14
Age : 16
Location : In your mind

PostSubject: Re: Body/Head Restrictions    Fri Jul 07, 2017 2:12 am

I had to change the restriction name cause silly me forgot you cant have the same name
Still getting errors :
Errors:
 
I did what you said to do
https://i.gyazo.com/d80c0cc5fba5a29f3d83a419e644947e.png
https://i.gyazo.com/29a8b06e3643250d284ea1eabfb54fe5.png
Back to top Go down
Hamilton

avatar

Game username : Hamilton
Server : Myatar Legends // Dragon's Den
Female Posts : 373
Join date : 2011-10-20
Age : 31
Location : everywhere

PostSubject: Re: Body/Head Restrictions    Fri Jul 07, 2017 6:24 pm

Please use copy/paste to give the whole text when it comes to errors. Your gyazo screenshots only just barely give the errors' information.

If you double click on any error, it will automatically jump to the line in the code that it's having an issue with.

If you click next to any open or closed bracket "{" "}" or parentheses "(" ")" the program will automatically highlight it's partner in gray. This makes it easy to find where a bracket may be missing it's partner or be partnered to the wrong bracket.

Which, judging by the tiny amount of error message in the screenshot, is what's going on. Still.

"end of file found before the left brace "{" at ..." and then it tells you the line. (or it would if the error wasn't cut off, but I digress)

It means somewhere there is still a bracket left open. So open, that it doesn't allow the entirety of the code to reach an end bracket before running out of lines in that document. A lot of those pieces of errors seem to be pointing to files not even associated with mesh restrictions.
Back to top Go down
Skyia

avatar

Game username : Skyia
Server : Royal Elements
Female Posts : 144
Join date : 2014-09-14
Age : 16
Location : In your mind

PostSubject: Re: Body/Head Restrictions    Fri Jul 07, 2017 10:59 pm

Okay, I found out that I was missing a } so I took out its partner { and It worked, no errors or anything, but when I test it ingame it doesnt.
so then i also added its partner and it still doesnt work
Code:
void applyRestrictions(const String &partChanged, bool increment)
 {
 if(partChanged=="Body")
{
//back to head1
headID = 1;
mUnit->replaceHeadMesh(mSceneMgr,meshName("Head",headID));
return;
 }
 if(partChanged=="Head")
 {
 }
while(mDef->isRestrictedBody(bodyID,headID))
{
 //back to maneless
 maneID = 0;
 mUnit->replaceManeMesh(mSceneMgr,meshName("Mane",maneID));
 return;
 }
 if(partChanged=="Mane")
 {
 while(mDef->isRestricted(headID,maneID))
 {
 maneID += (increment?1:-1);
 if(maneID<0)maneID = mDef->maxManes-1;
 if(maneID>=mDef->maxManes)maneID = 0;
 }
 return;
 }
Back to top Go down
Hamilton

avatar

Game username : Hamilton
Server : Myatar Legends // Dragon's Den
Female Posts : 373
Join date : 2011-10-20
Age : 31
Location : everywhere

PostSubject: Re: Body/Head Restrictions    Sat Jul 08, 2017 1:40 am

Your closing bracket is in the wrong place, homie

Quote :
if(partChanged=="Head")
{
} <-this one should not exist
while(mDef->isRestrictedBody(bodyID,headID))
{
//back to maneless
maneID = 0;
mUnit->replaceManeMesh(mSceneMgr,meshName("Mane",maneID));
} <-you need to place a close here for the mane resetting setup
return;
}
Back to top Go down
 
Body/Head Restrictions
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Keeping I.T. Open :: SUPPORT :: Support-
Jump to: