The folling situation is given: I met a group of baddies. The faction reputation to the PC is set to neutral. I have a nice chat with the boss which results in a battle.
To make the baddies hostile, I change the faction reputation of the PC to -100, which perfectly works. But then, those guys just stand there around, watching how I butcher the boss.
Is there an easy way to get them into fight at once? A single command line?
Something like
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
//MM: This obviously only works in the on_death script
Note: looping through all faction members nearby and issue the attack command is not the preferred solution.
The shout might work. I donât know about the comment about the on_death script. That should be irrelevant. As long as they are in the same faction and are listening (on spawn setup) Iâd think you could get them to attack.
Another approach would be to make them re-perceive the PC after the reputation change. This can be done by giving the PC a really short invisibility effect, for example.
Thanks guys, and yes a loop is not what Iâm looking for. Actually I already have a loop, a terrible sample of code which needs a lot of settings. I want just a simple single line. Iâm still wondering why the shouting doesnât work.
Meanwhile I tested temporary invisibility. It works in general, but not reliable enough in the given scenario.
@xorbaxian : Maybe the little doggie nearby, which has nothing to do with the conflict will bite me as well? Only faction members of the boss should get the attack command. But youâve given me an idea how to make my loop a little bit better.
you need to tell the creatures you target that you want them to act, otherwise they wonât act. silent shouts are often troublesome for several reasons : first (as youâve seen) they may not work the way you want because your assumptions may not be valid ; the shout depends on factors you might not have taken into account. second, silent shouts are notoriously laggy, because you end up w/all your mobs shouting back and forth to each other any time one of them so much as stubs its little toe. you can see quantitatively how costly this is if you profile your scripts w/nwnx.
well, as i mentioned, there are lots of approaches to this. if youâve taken the trouble to set your hostiles to a separate unique faction and all other creatures in the area donât belong to that faction, then you can use GetFirstFactionMember/GetNextFactionMember, which arenât nearly as costly as the various GetNearestx functions. however, if youâre still dead-set against using a loop and still want to use silent shouts, there are a few things you can check.
have you set appropriate flags on-spawn for your baddies? in order for them to react to silent shouts, youâll need to have set SetSpawnInCondition(NW_FLAG_SHOUT_ATTACK_MY_TARGET). this will allow other faction members to process the shout if they receive it.
have you set SetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT) ? this will allow your in-spawned creature to react to OnDialog events it receives. youâll need to write an event handler to get them to move their arses once they receive the event.
are all enemies near enough ? (i donât remember how far apart they can be, but if theyâre dispersed in a map whose size is greater than 4x4 i can tell you from personal experience that some will âmissâ the call for some arcane reasonâŚ).
have you called DetermineCombatRound ? the function is ridiculously messy, but it does set many many conditions that arenât set w/a simple ActionAttack.
if you want the silent shout approach, let me take a look at this once i get home from work tonight and iâll work something up for you.