Author Topic: Vanishing NPC and Henchman Level Up  (Read 509 times)

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
Vanishing NPC and Henchman Level Up
« Reply #15 on: November 17, 2010, 07:07:42 pm »


               Scripting or any kind of programming can be very frustrating. Also, attention to detail is really really important.

When restarting helps it might mean that you didn't get the new version loaded.  One way this happens to me is that I save a script but forget to save the module and then test.  The fix doesn't work because it isn't there.  I have to go back to save the module to make it work.   It's really easy to miss a step.
               
               

               


                     Modifié par Mudeye, 17 novembre 2010 - 07:08 .
                     
                  


            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Vanishing NPC and Henchman Level Up
« Reply #16 on: November 17, 2010, 07:14:19 pm »


               I automatically receive a "Save Tutorial" gump as soon as I hit the F9 button or exit out and have been doing everything right, as far as I know.

The link to the other tutorial:
http://nwvault.ign.c...r.Detail&id=803

It isn't the official one as I was thinking.

Here is the script I'm running. When I enter the first area, I have the module set a LocalInt on my PC and this script checks for it. For something like, "Speak String" it works just fine but it just doesn't destroy the NPC speaker for some reason. Everything else in there works fine, though.

#include "nw_i0_tool"
void main()
{
object oPC = GetPCSpeaker();
AddJournalQuestEntry("GrimCompanions", 2, oPC, TRUE, FALSE, TRUE);
RewardPartyXP(1000, oPC, FALSE);
object oTarget;
oTarget=GetHenchman(oPC);
RemoveHenchman(oPC, oTarget);
if (GetLocalInt(oPC, "Vanish!")>= 3)
  {
GuessWhatGoesHere
  }
}

I've tried using these two:

oTarget = OBJECT_SELF;
DestroyObject(oTarget, 0.0);

ActionForceMoveToObject (GetObjectByTag ("APsychoticDruid"), TRUE, 0.2, 10.);
   ActionDoCommand( DestroyObject( OBJECT_SELF ) );
   SetCommandable( FALSE );

I'd like to point out that if I just talk to a placed NPC and have him do this in conversation, the latter of the two above works fine. This only seems to be a problem if the NPC I'm attempting to "vanish" is/was a henchman.

I'm also receiving a message "You cannot have more than 1 Henchman at a time" when I run the script to add the NPC speaker to my party. I don't see why I should receive this error since he's the only one I'm adding. It might very well be one of the "and then re-write it, the previously written script is what runs instead of the new one" issue or something just as odd. It's not preventing me from continuing, though, so it's not a big deal.
               
               

               


                     Modifié par Werthers Chewbackas, 17 novembre 2010 - 07:15 .
                     
                  


            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
Vanishing NPC and Henchman Level Up
« Reply #17 on: November 17, 2010, 07:47:33 pm »


               How about trying this with a simplified script for the ActionsTaken script of a conversation node in the henchman's conversation that dismisses the henchman.  (make sure that the "APsychoticDruid" object is in the same area and not far off).

void main()
{
    object oPC = GetPCSpeaker();
    AddJournalQuestEntry("GrimCompanions", 2, oPC, TRUE, FALSE, TRUE);
    RewardPartyXP(1000, oPC, FALSE);
    object druid = GetObjectByTag ("APsychoticDruid");
    ActionForceMoveToObject ( druid );
    ActionDoCommand( DescroyObject(OBJECT_SELF) );
}
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Vanishing NPC and Henchman Level Up
« Reply #18 on: November 17, 2010, 09:58:36 pm »


               

Werthers Chewbackas wrote...

Pretty much everywhere it says resref like:

5. (entered a resref of a creature “c_reddragon” no quotes), No visual effect, (entered At the Waypoint:
“spawn_here” no quotes), Talk to PC


That specific example is an occasion where you are calling on the blueprint to spawn in a creature that (prior to spawning it) does not exist yet in game. Once the creature has been spawned and now exists in game, then you would use it's Tag to reference the object.

Perhaps I should add in a short section about the different uses bewteen a Tag and a ResRef in my next tutorial update...
               
               

               


                     Modifié par _Knightmare_, 17 novembre 2010 - 10:05 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Vanishing NPC and Henchman Level Up
« Reply #19 on: November 17, 2010, 10:31:18 pm »


               The Link you gave was to the TBP toolset manual,  I use it often and find it one of my most usefull resources.   I Have just finished doing a search of the PDF for the word "ResRef". Every use of it that i seen in the manual was used correctly.  



The toolset manual,  However, Does not nor has it ever claimed to cover scripting.
               
               

               
            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Vanishing NPC and Henchman Level Up
« Reply #20 on: November 17, 2010, 10:58:08 pm »


               

Mudeye wrote...
    object druid = GetObjectByTag ("APsychoticDruid");
    ActionForceMoveToObject ( druid );
    ActionDoCommand( DescroyObject(OBJECT_SELF) );


I tried this and it wasn't successful unfortunately. The script I posted earlier is on the ActionsTaken box of the conversation node.

[Edit]
Fixed the spelling error, still nothing '<img'>

As I said about the resref, it might be something strange with my computer. All I'm aware of is that I tried the first script listed in Knightmare's PDF using the resref of a red dragon and it did not work but did after I used that NPC's tag instead.
               
               

               


                     Modifié par Werthers Chewbackas, 17 novembre 2010 - 11:02 .
                     
                  


            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Vanishing NPC and Henchman Level Up
« Reply #21 on: November 18, 2010, 02:37:24 am »


               Tried throwing this on the OnHeartbeat script for him. Still nothing.

420 wrote...

if(GetAssociateType(OBJECT_SELF) != ASSOCIATE_TYPE_HENCHMAN)
  {
  ExecuteScript("destroyself", OBJECT_SELF);
  }


               
               

               


                     Modifié par Werthers Chewbackas, 18 novembre 2010 - 02:37 .
                     
                  


            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Vanishing NPC and Henchman Level Up
« Reply #22 on: November 18, 2010, 05:39:29 am »


               Well, uh, looks like it works now.



void main()

{ RemoveHenchman( GetMaster() );

 SetIsDestroyable( TRUE, FALSE );

 DestroyObject( OBJECT_SELF );

}



Heh. Thanks for everybody's assistance. I might be back on here in the future if I feel like making anything a little more complex.