Aller au contenu

Photo

Help appreciated.


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
customwinternights

customwinternights
  • Members
  • 6 messages
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.

#2
Balduvard

Balduvard
  • Members
  • 71 messages
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

#3
customwinternights

customwinternights
  • Members
  • 6 messages
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?

#4
customwinternights

customwinternights
  • Members
  • 6 messages
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;

}


#5
Rubies

Rubies
  • Members
  • 292 messages
int StartingConditional()

{

object oPC = GetPCSpeaker();

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



if (nInt < 1)

{

return FALSE;

}



else

{

return TRUE;

}

}


#6
420

420
  • Members
  • 190 messages

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 .


#7
customwinternights

customwinternights
  • Members
  • 6 messages
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?

#8
customwinternights

customwinternights
  • Members
  • 6 messages
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.

#9
420

420
  • Members
  • 190 messages

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

#10
HipMaestro

HipMaestro
  • Members
  • 1 515 messages

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.