Aller au contenu

Photo

Battle In Conversation


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

#1
SaveError00

SaveError00
  • Members
  • 14 messages

NERVERWINTER NIGHTS 2 Gog version.

 

Trying to find something on the internet and nothing...

 

I need to start battle in conversation.

One of speaker NPC have to attack meele or cast spell on other NPC.

But after action (when he start attack or spell cast) conversation ends - he attacks or cast spell but in normal game mode.

How to make it happen through the conversation? Maybe make it in Cutscene? But also i don't know what script starts cutscene - I found some big script but i need simple scrip,t something like "when you enter a trigger script will start cutscene" (cutscene name, conversation, end - no more options or variables).

 

Can you help me?



#2
kamal_

kamal_
  • Members
  • 5 250 messages

You'd fake the attack by having npc A run a script calling the PlayCustomAnimation script function and doing an appropriate attack animation (equipping weapons if needed), and then damage/kill npc B appropriate to the attack if desired. You could also use the script to CastFakeSpellAtObject (or whatever it's exact name is) to cast a "spell" (really just the visual effect of the spell).



#3
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages

You can also run the conversation from an i-point speaker, using the speaker and listener tags to refer to the actual NPC.  That way, the conversation can keep running even as the NPC is involved in combat.


  • kamal_ aime ceci

#4
Tchos

Tchos
  • Members
  • 5 054 messages

You can run it from a normal ipoint, but do not use an ipoint speaker unless you're creating it through the CreateIPSpeaker() scripting function.  The ipoint speaker blueprint in the blueprint list is the same as a standard ipoint, except that it has a heartbeat script constantly checking for certain conditions to be true, which will never be true unless you spawned it using CreateIPSpeaker().  It will still work as a reference point for your conversation just like a normal ipoint (any placeable will, in fact), but you will have an object constantly running a useless script forever.

 

In other words, never place a copy of the ipoint speaker blueprint into your areas.  The blueprint is not for placing; it's only there so it can be spawned via script for a specific purpose.  Place a standard ipoint.  The same goes for the ipoint cleaner blueprint.  Do not place it -- it is for spawning via script for a specific purpose.


  • Kaldor Silverwand et 4760 aiment ceci

#5
andysks

andysks
  • Members
  • 1 650 messages

What Tchos said I second. It's the way I do these kinds of things. CreateIPSpeaker is generally the most stable function for a conversation, but here what I think concerning your situation, because a battle in conversation can break if the owner is a combatant, or if a person who's suppose to speak dies, and therefore not around to speak his lines. I understand that you are not really comfortable with scripting, but so am I. This is easy though. It's basically what Tchos says, but with the script as well and reason behind it.

 

Place an ipoint placeable, not the speaker, on the area. Doesn't matter where, and give it a unique tag.

 

Write this script and compile.

#include "ginc_ipspeaker"

void main()
{
  //This is so that we get a location for the ip_speaker spawn
  //And so that the script will only fire for a PC or companion.
  object oPC = GetEnteringObject();
  if (!GetIsPC(oPC))
  return;

  location lLocation = GetLocation(oPC);

  CreateIPSpeaker("TagOfYourIPPlaceable","TagOfConversation", lLocation, 0.5); 
  //Destroy the trigger so that it won't fire again. Up to you...
  DelayCommand(2.0f, DestroyObject(OBJECT_SELF)); 
}

Then on your conversation, define speaker and listener. No matter what happens to them, in battle or not, the convo won't break because they don't own it. They are just a part of it. Your placeable owns the convo. Just be sure to not give them nodes after and if they die. Then the convo will break.

 

Edit, the script goes on a generic trigger's OnEnter event :).


  • Kaldor Silverwand aime ceci

#6
SaveError00

SaveError00
  • Members
  • 14 messages

Still little problem. Okay, I've putted your script on to the trigger as the enterscript, but after conv starts, one line and it's gone.

So tell me, point by point. I've to:

 

- create one generic trigger, it will be our unique trigger. Put it wherever I want.

- create another trigger with on enter script and there put your script, where tag of my IPPlacebeble is the tag of the first generic trigger without any scripts, right?

- after enter generic trigger will gone, yup?



#7
andysks

andysks
  • Members
  • 1 650 messages

Hi there. All you need is one trigger, with the above on the onenter slot. Of course, write your own tags there. That's all. Find the generic trigger on the blueprints, place one down and under its properties put the script. The trigger will get destroyed, yes.

 

I don't know why the convo broke for you... had you specified a speaker who wasn't there maybe? Usually that's the case.



#8
SaveError00

SaveError00
  • Members
  • 14 messages

Okay... now it's works, but not perfect. One NPC cast his fireball and okay, but after another few lines, when 4 other NPCs need to attack spellcaster, and after a few lines he have to kill them, there are on attack animation... they're dying immidietly without attack spellcaster and without his counterattacks. I've putted delays into the script and nothing happen.



#9
andysks

andysks
  • Members
  • 1 650 messages

That second problem, when the four need to attack the caster is another problem. If the conversation fires, and the battle happens then the script which fires the convo is fine. Which method are you using to make the four attack the caster? I would make a ga_attack_target, and make the caster with something like... 10 hp. Perhaps even add a death effect on the node to be certain that he is dead. You have to play with that and see which looks best for you.

 

Edit, I read yourpost wrong. The caster needs to kill the four... then just make him plot or immortal, and use the ga_attack_target for them. He will retaliate and kill them eventually. However note, that this is random and the convo might go to next node if your delays run out. So make them have 1 hp each, cast a fireball with the caster and kill them manually with ga_effect and param Death. That's what I would do... That way you are certain that they die within the node you want them to.



#10
SaveError00

SaveError00
  • Members
  • 14 messages

Everything works, thank you... but I've got another question in another topic xD



#11
andysks

andysks
  • Members
  • 1 650 messages

You're welcome. I know this can be tough to pull off, and the only reason I could guide you is because I had the same problem as you :). Just two years ago :D.



#12
SaveError00

SaveError00
  • Members
  • 14 messages

Okay so another question.... the owner of conversation is the trigger that disappear. How to put the thnik, that listner will be PC and, more important, how to put script cast fake spell which will be targeted to PC? When I putted ga_cast fake spell and take target as "oPC" conversation crashed.

 

Other question - how to freeze PC in that convo in NWN1 style? In NWN 2 style it's no problem, you cannot move, but in NWN 1 style i choosed in first NPC line of talk action freeze party ... but my PC still could move and break the convo.



#13
andysks

andysks
  • Members
  • 1 650 messages

No no. The owner is your ipoint placeable. Also, PC is always the listener unless specified otherwise.

 

If you want to target the PC with any script like the fake spell, or ga_move etc, you have to write $PC on the parameter instead of oPC. This is possible on every script which has the ginc_param_const as an include. Here's the available targets.

const string TARGET_KEY		 	= "$";
const string TARGET_OBJECT_SELF	= "$OBJECT_SELF";	// OBJECT_SELF
const string TARGET_OWNER 	 	= "$OWNER";			// OBJECT_SELF (conversation owner)
const string TARGET_OWNED_CHAR	= "$OWNED_CHAR";	// GetOwnedCharacter
const string TARGET_PC	 	 	= "$PC";			// PCSpeaker
const string TARGET_PC_LEADER	= "$PC_LEADER"; 	// FactionLeader (of first PC)
const string TARGET_PC_NEAREST	= "$PC_NEAREST";	// NearestPC (owned and alive)
const string TARGET_PC_SPEAKER	= "$PC_SPEAKER";	// PCSpeaker

const string TARGET_MODULE	 	= "$MODULE";
const string TARGET_LAST_SPEAKER = "$LASTSPEAKER";

It goes on about factions too.



#14
andysks

andysks
  • Members
  • 1 650 messages

Forgot to answer the second thing. Under conversation properties, click on the multiplayer cutscene and read what it does :).



#15
SaveError00

SaveError00
  • Members
  • 14 messages

Okay, everyting is workin' alomst... one thing. I set to time advance script in convo at the end of it and teleport the charcter. Character teleports, but in the teleported area are normal day... there are stars at the sky, but is incredibly light. Even if I choose in area the always night are still lightly... AND ALSO i set the starting time of module, but I never cannot find the clock and date?! Sorry, I installed NWN2 only for toolset, I've played a lot in NWN1 and use toolset a little and before all the BG & ID series, so I even don't know, if there is a time (clock) in normal campaign.



#16
andysks

andysks
  • Members
  • 1 650 messages

The always night doesn't mean that it's always night time. It's there for rules and stuff. Uhm, I would check my area properties in general. What with how it should look, and find a nice lighting. Clock was not available in the OC, but they made one in the MotB. 

 

All you need to do is put this script on the OnPlayerLoad slot... or something like that, under module properties. View -> Module properties

//On PC load for the clock

#include "ginc_time"

void main()

{
	object oPC = GetFirstPC();
	SetClockOnForPlayer(oPC, TRUE);
	
}	


#17
kevL

kevL
  • Members
  • 4 061 messages

+ the heartbeat:

--
the #include 'ginc_time' contains the clock functions

Example:
onPCLoaded - the SoZ module event file 'k_mod_pc_loaded' adds the clock to player w/ SetClockOnForPlayer()
onModuleHB - the ditto file 'k_mod_hb' updates the clock w/ UpdateClockForAllPlayers()

( those are Campaign-level files in SoZ, btw )

note there's a global, "CAMPAIGN_SWITCH_ONLY_SHOW_TIME", that condenses info shown to player. If true i think it leaves off the month & year.


  • andysks aime ceci

#18
Tchos

Tchos
  • Members
  • 5 054 messages

If you want it to be always night in appearance in that area, in addition to the "always night" box which you need for the rules as Andy said, you need to turn off the day/night cycle, and change the settings of the "Default" light settings to look like night time.