Skip to content

"if" Evil script help

I'm trying to phrase a couple lines of code to determine whether the PC is evil. If he's evil then a certain set of instructions will ensue. I'm just trying to see if he's evil.
object oObject;

void main()
{

object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;

oObject = GetObjectByTag("CASTER");

GetAlignmentGoodEvil(oPC); //I'm hung up right here?

ActionCastSpellAtObject(SPELL_AID, oPC, METAMAGIC_ANY,
FALSE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);

}

Comments

  • ZephiriusZephirius Member Posts: 419
    I think I figured it out...
    object oObject;
    
    void main()
    {
    
    object oPC = GetLastUsedBy();
    if (!GetIsPC(oPC)) return;
    
    oObject = GetObjectByTag("CASTER");
    
    int iEvil = ALIGNMENT_EVIL;
    
    if (GetAlignmentGoodEvil(oPC)==iEvil)
       {
       ActionCastSpellAtObject(SPELL_AID, oPC, METAMAGIC_ANY,
       FALSE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
       }
    }
    
  • WilliamDracoWilliamDraco Member Posts: 175
    You could slightly shorten it to simply

    if(GetAlignmentGoodEvil(oPC) == ALIGNMENT_EVIL)

    But yes - The Get simply returns an integer number, but you have to DO something with that number in order for it to be effective. You could either store that number (like `int nAlign = GetAlign....`) or use it directly in the comparison, as your follow-up as done.
  • ZephiriusZephirius Member Posts: 419
    Thanks for the tip.
Sign In or Register to comment.