Author Topic: Help appreciated.  (Read 852 times)

Legacy_customwinternights

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Help appreciated.
« on: November 22, 2010, 10:51:38 pm »


               Hi, I'm making a module for the GoG contest, and I have my entry nearly complete. Got the items, enemies, transitions, quest givers and such, but I need help with some of the events I want to put. For example, first, I want my main hero say something before opening a door.  Then, I want to make it so a creature that's standing next to another nonplayable attacks the non-playable, but only after the hero has talked with him.  I tried setting variables in the different talking nodes, without results. Could anyone provide me some suggestions please?

appreciated.
               
               

               
            

Legacy_Balduvard

  • Full Member
  • ***
  • Posts: 126
  • Karma: +0/-0
Help appreciated.
« Reply #1 on: November 23, 2010, 02:19:20 am »


               If you want actions/events to occur in the game, it has to be done with scripts. In your first example, you would put a script on the OnOpen properties of the door that would issue a SpeakString command to the PC with the text you wanted said. As for the second, you can specify a script to be executed as part of a conversation, under the "Actions Taken" tab.



For specific questions about scripting, head on over to the Scripting forum. If you need help crafting scripts, a good beginner's tool is Lilac Soul's NWN Script Generator
               
               

               
            

Legacy_customwinternights

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Help appreciated.
« Reply #2 on: November 23, 2010, 03:15:58 am »


               Ok, great, thankyou for the suggestions! I'll check both.  Do you know if there are already done scripts for what I need for my module?
               
               

               
            

Legacy_customwinternights

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Help appreciated.
« Reply #3 on: November 23, 2010, 02:50:45 pm »


               I downloaded that script generator and generated some scripts, but i keep getting compiling errors in the Toolset. I get the  ERROR: PARSING VARIABLE LIST error. Here's the script I generated:



/*   Script generated by

Lilac Soul's NWN Script Generator, v. 2.3



For download info, please visit:

http://nwvault.ign.c...&id=4683&id=625    */



int StartingConditional()

{

object oPC = GetPCSpeaker();



int nInt;

nInt=GetLocalInt(oPC, "NW_JOURNAL_ENTRY1");



if (nInt < 1)

  return FALSE;



return TRUE;

}

               
               

               
            

Legacy_Rubies

  • Hero Member
  • *****
  • Posts: 508
  • Karma: +0/-0
Help appreciated.
« Reply #4 on: November 23, 2010, 06:00:37 pm »


               int StartingConditional()

{

object oPC = GetPCSpeaker();

int nInt=GetLocalInt(oPC, "NW_JOURNAL_ENTRY1");



   if (nInt < 1)

   {

   return FALSE;

   }



   else

   {

   return TRUE;

   }

}

               
               

               
            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Help appreciated.
« Reply #5 on: November 23, 2010, 11:19:08 pm »


               

customwinternights wrote...

I downloaded that script generator and generated some scripts, but i keep getting compiling errors in the Toolset. I get the  ERROR: PARSING VARIABLE LIST error. Here's the script I generated:

That's a spurious error. I cut and pasted your code into a new mod and it compiled just fine. It happens sometimes. Try making a new script, copying the text over and saving it under the same name, overwriting the old script.

Here is the same code with a slightly cleaner format:



int StartingConditional()
{
object oPC = GetPCSpeaker();
int nInt = GetLocalInt(oPC, "NW_JOURNAL_ENTRY1");

if (nInt < 1) return FALSE;

return TRUE;
}

-420
               
               

               


                     Modifié par 420, 23 novembre 2010 - 11:21 .
                     
                  


            

Legacy_customwinternights

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Help appreciated.
« Reply #6 on: November 24, 2010, 06:06:43 am »


               It compiled! Turns out the main() at the beginning was the error. But where do i put the text that shows when the door's opened?
               
               

               
            

Legacy_customwinternights

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Help appreciated.
« Reply #7 on: November 24, 2010, 06:13:37 am »


               For  the other script, this is what the generator created:



/*   Script generated by

Lilac Soul's NWN Script Generator, v. 2.3



For download info, please visit:

http://nwvault.ign.c...&id=4683&id=625    */



//Put this on action taken in the conversation editor

#include "nw_i0_generic"

void main()

{



object oPC = GetPCSpeaker();



object oTarget;

oTarget = GetObjectByTag("01");



AdjustReputation(oPC, oTarget, -100);



SetIsTemporaryEnemy(oPC, oTarget);



AssignCommand(oTarget, ActionAttack(oPC));



AssignCommand(oTarget, DetermineCombatRound(oPC));



oTarget = OBJECT_SELF;



AdjustReputation(oPC, oTarget, -100);



SetIsTemporaryEnemy(oPC, oTarget);



ActionAttack(oPC);



DetermineCombatRound(oPC);



}



Dont know if it's the right one. It's for making a creature attack a nonplayable after he's done talking with the hero.  The creature kills the nonplayable, and it then attacks you.
               
               

               
            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Help appreciated.
« Reply #8 on: November 25, 2010, 12:01:55 am »


               

customwinternights wrote...

It compiled! Turns out the
main() at the beginning was the error. But where do i put the text that
shows when the door's opened?

Not quite sure what you mean by this. You want the PC so say something when they open a door? You can try putting this in the door's OnOpen event.

void main()
{
object oPC = GetLastOpenedBy();

if(GetLocalInt(OBJECT_SELF, "DoOnce") != 1)
    {
    SetLocalInt(OBJECT_SELF, "DoOnce", 1);
    AssignCommand(oPC, ActionSpeakString("I opened the door."));
    }
}


customwinternights wrote...

Dont know if it's the right one. It's for making a creature attack a nonplayable after he's done talking with the hero.  The creature kills the nonplayable, and it then attacks you.

I think this may be what you're looking for:

void main()
{
object oPC = GetPCSpeaker();
object oNPC = OBJECT_SELF;
object oAttacker = GetNearestObjectByTag("01");

AdjustReputation(oPC, oAttacker, -100);
AdjustReputation(oNPC, oAttacker, -100);

AssignCommand(oAttacker, ActionAttack(oNPC));
}
The attacker should automatically attack the PC after the NPC is dead.

-420
               
               

               
            

Legacy_HipMaestro

  • Hero Member
  • *****
  • Posts: 2849
  • Karma: +0/-0
Help appreciated.
« Reply #9 on: November 25, 2010, 01:19:57 am »


               

customwinternights wrote...
For example, first, I want my main hero say something before opening a door.

If you want the speech before opening the door rather than when opening the door you'll need a trigger area where you want the speech to occur and use the same 420 script OnEnter.