Author Topic: Get PC User?  (Read 446 times)

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Get PC User?
« Reply #15 on: April 28, 2012, 08:55:03 am »


               

Dylmani555 wrote...

Yeah, it's just I'm trying to make this portal not work for Half orcs or half elves, or red dragon disciples or purple dragon knights, because they are not allowed on the map I'm making, due to the lore behind the map.
Okay thanks for the help '<img'> I think it should work now.



Ok there  is a better function then the GetclassBy Position that you are currently using.  It is the GetLevelByclass function.  With it you will only need to check if the level returned is greater then 0 to know if the have taken the calss ot not.   That with what we learned above and your If statment can be rewritten as.  

if(
  GetRacialType(oPC)  ==  RACIAL_TYPE_HALFELF ||
  GetRacialType(oPC)  ==  RACIAL_TYPE_HALFORC ||
  GetLevelByclass(class_TYPE_DRAGONDISCIPLE, oPC) > 0   ||
  GetLevelByclass(class_TYPE_DRAGONDISCIPLE , oPC) > 0 ||
  )
  {
     // TRUE Case meaning one of the cases above was true. 
    // You did not want to transport this PC so do nothing.   
  }   
  else
{
    // False clause.   oPC wan not any of the checks above.  
   // This guy is safe to teleport.



As another option you can invert the return of the expression above by using the Not(!) operator.  You would just need to soround the entire expression with parentheses and apply the Not.   
!(expression)  

In that case you would have:

if(
    ! (     
       GetRacialType(oPC)  ==  RACIAL_TYPE_HALFELF ||
       GetRacialType(oPC)  ==  RACIAL_TYPE_HALFORC ||
       GetLevelByclass(class_TYPE_DRAGONDISCIPLE, oPC) > 0   ||
       GetLevelByclass(class_TYPE_DRAGONDISCIPLE , oPC) > 0 ||
     )
  )
  {
      // True Case the PC as not any of the casses above. 
     //  Safe to transport.
  }
               
               

               


                     Modifié par Lightfoot8, 28 avril 2012 - 07:55 .
                     
                  


            

Legacy_Dylmani555

  • Jr. Member
  • **
  • Posts: 95
  • Karma: +0/-0
Get PC User?
« Reply #16 on: April 28, 2012, 08:52:31 pm »


               Wow... Lightfoot.. you are a god among men! I do recall having used the GetLevelByclass function before, but did not think to use it here. Thank you for your help '<img'> I appreciate it greatly.
Although I think it would be
if(
   ! (      
      GetRacialType(oPC)  ==  RACIAL_TYPE_HALFELF ||
      GetRacialType(oPC)  ==  RACIAL_TYPE_HALFORC ||
      GetLevelByclass(class_TYPE_DRAGONDISCIPLE, oPC) > 0   ||
      GetLevelByclass(class_TYPE_PURPLE_DRAGON_KNIGHT , oPC) > 0
    )
 )
 {
     // True Case the PC as not any of the casses above.
    //  Safe to transport.
 }

rather than

if(
   ! (      
      GetRacialType(oPC)  ==  RACIAL_TYPE_HALFELF ||
      GetRacialType(oPC)  ==  RACIAL_TYPE_HALFORC ||
      GetLevelByclass(class_TYPE_DRAGONDISCIPLE, oPC) > 0   ||
      GetLevelByclass(class_TYPE_DRAGONDISCIPLE , oPC) > 0 ||
    )
 )
 {
     // True Case the PC as not any of the casses above.
    //  Safe to transport.
 }
               
               

               


                     Modifié par Dylmani555, 28 avril 2012 - 07:53 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Get PC User?
« Reply #17 on: April 28, 2012, 10:11:00 pm »


               

Dylmani555 wrote...

Although I think it would be...

'Image
               
               

               


                     Modifié par Lightfoot8, 28 avril 2012 - 09:11 .