lfnetwork.com mark read register faq members calendar

Thread: Script to add saber isn't working
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 03-19-2006, 06:14 PM   #1
Achilles
Dapper Chimp
 
Achilles's Avatar
 
Join Date: May 2004
Posts: 8,204
Helpful! Veteran Modder Forum Veteran 
Script to add saber isn't working

For all my scripting n00bness, I was still pretty sure that this was going to work

Code:
//:: source code for baosbr.ncs
void main() { 

     object oNPC = GetObjectByTag("BaoDur", 0);
     object oWeapon1 = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON ,oNPC);
     object oWeapon2 = GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON ,oNPC);


     /*
      I don't want to destroy any items he may have equipped so I'm 
      having him unequip them instead. Since the game won't let you 
      equip a melee weapon in your main hand if you have a ranged 
      weapon in your off hand, I'm unequipping both slots, just in 
      case the NPC is double-wielding. Also, I'm removing the weapon
      in left hand first, since the engine doesn't like lefties :)
     */

     if (GetIsObjectValid (oWeapon2))
        {
        AssignCommand(oNPC, ActionUnequipItem(oWeapon2));
        }

     if (GetIsObjectValid (oWeapon1))
        {
        AssignCommand(oNPC, ActionUnequipItem(oWeapon1));
        }
     

     //:: NPC can't equip/flourish their new weapon without 
     //:: weapon proficiency - lightsaber.
     GrantFeat(43, oNPC); 

     //:: If BaoDur is LS, give him the LS lsabre... 
     if ((GetAlignmentGoodEvil(oNPC)) > 49){				

            object oLsabre1 = CreateItemOnObject("g_w_lghtsbr01", OBJECT_SELF);
    	     ActionEquipItem(oLsabre1, INVENTORY_SLOT_RIGHTWEAPON);
            ActionWait(0.5);
            ActionDoCommand(CreatureFlourishWeapon(OBJECT_SELF));


       //:: ...otherwise give him the DS lsaber. 
	} else {

                object oLsabre2 = CreateItemOnObject("g_w_lghtsbr02", OBJECT_SELF); 
                ActionEquipItem(oLsabre2, INVENTORY_SLOT_RIGHTWEAPON);
                ActionWait(0.5);
                ActionDoCommand(CreatureFlourishWeapon(OBJECT_SELF));
		
		}

}
Everything works except the part where he get a blue saber if LS aligned. At this point he gets a red saber, no matter what.

FWIW, I'm firing this via ExecuteScript inside a_makejedi.

Code:
    // If Param = 1, then it's Bao-Dur. (Trying to make it consistent with the CNPC integers.)
    if ( nScriptNumber == 1 ) {
        AddMultiClass (CLASS_TYPE_JEDICONSULAR, GetObjectByTag ("BaoDur") );
        ExecuteScript("baosbr", OBJECT_SELF);
    }
I know that some scripts don't like ExecuteScript. Is this going to be one of those cases?

I know that I'm probably just missing something obvious, but I've been staring at it too long to see it at this point. A problem compounded by the fact that I really have no idea what I'm doing.

If any of you veterans have any suggestions, I would love to hear them. Thanks in advance.
Achilles is offline   you may: quote & reply,
Old 03-19-2006, 06:51 PM   #2
Tupac Amaru
Junior Member
 
Tupac Amaru's Avatar
 
Join Date: Mar 2005
Location: Tahuantinsuyu
Posts: 273
You should use GetGoodEvilValue rather than GetAlignmentGoodEvil in the if-statement:
Code:
     //:: If BaoDur is LS, give him the LS lsabre... 
     if (GetGoodEvilValue(oNPC) > 49){
GetAlignmentGoodEvil does not return the exact alignment value. It only returns a value between 0 and 3 for a rough alignment classification. See the ALIGNMENT_ constants in nwscript.nss.
Tupac Amaru is offline   you may: quote & reply,
Old 03-19-2006, 07:48 PM   #3
Achilles
Dapper Chimp
 
Achilles's Avatar
 
Join Date: May 2004
Posts: 8,204
Helpful! Veteran Modder Forum Veteran 
That's two I owe you

I guess I stopped looking after I found the one that I thought was going to work.

Thanks!
Achilles is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Script to add saber isn't working

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:53 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.