Aller au contenu

Photo

Controlling henchmen?


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

#1
MrKWMonk

MrKWMonk
  • Members
  • 52 messages
I use and really like OHS.  I also like the granular control you can achieve in BG and NWN2 within a party.

Pls excuse me if this is a dopey qusetion as I don't know much about NWN modding at all... Could the familar mind control functionality be somehow applied to include controlling henchmen to some extent?


-kaos


ps - if there's already some form of henchy control other than leaving it to the voice commands and the the AI pls let me knwo!

:)

Modifié par MrKWMonk, 17 juillet 2013 - 12:53 .


#2
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages
You can make an item that clears henchmen/familiar/summon/animal companion actions and assigns them to either attack a target if one is chosen or move to a location otherwise. Fairly simple to make though it's not perfect by any means.

#3
Killmonger

Killmonger
  • Members
  • 237 messages
<For all of us non-scripters>

Please,

Please do so

<Thanks in advance>

#4
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages
This will hopefully be approved in the near future.

http://nwvault.ign.c....Detail&id=3885

Use this to control minions.

Targeting a creature will cause minions to attack it if hostile and move to its location if friendly or neutral (may be altered to attack neutrals, module dependent).

Targeting a location will cause minions to attempt to move to the location.

Rife with bugginess and odd behavior - general idea is simply to give some very rough control over minions.

/***
    Magical Master's Minion Control (MMMC)

    - Allows some semblance of control over henchmen, summons,
      animal companions, and familiars
    - Should be attached to an item's activate item (long range) or an instant feat
      like the player tools - default set-up is to work with an item and tag-based
      scripting for ease of use but can easily be modified
    - If targeted on a hostile creature, commands all minions to attack that creature
    - If targeted on a location, commands all minions to move to that location
    - If targeted on a friendly/neutral creature, commands all commands to move to
      that creature's location.  However, setting the "attackNeutral" variable to 1
      will cause minions to attack neutral creatures if neutral creatures are targeted

***/

#include "x2_inc_switches"

// Determines behavior when targeting a neutral creature.  Setting this to non-zero will
// cause minions to attack the neutral creature while zero will cause minions to move to
// the neutral creature
int attackNeutral = 0;

void main()
{
    int nEvent = GetUserDefinedItemEventNumber();

    switch (nEvent)
    {
        case X2_ITEM_EVENT_ACTIVATE:
            object oPC = GetItemActivator();
            object oTarget = GetItemActivatedTarget();
            FloatingTextStringOnCreature("Starting activate item", oPC, FALSE);

            // If we have a valid target, use that location, otherwise get the location
            location lTarget = GetLocation(oTarget);
            if (oTarget == OBJECT_INVALID)
            {
                lTarget = GetItemActivatedTargetLocation();
            }

            // Going to loop through members of the party
            object oMinion = GetFirstFactionMember(oPC, FALSE);
            while (GetIsObjectValid(oMinion))
            {
                // If the party member's master (or master's master for minion summons) is the PC, issue orders
                if (GetMaster(oMinion) == oPC || GetMaster(GetMaster(oMinion)) == oPC)
                {
                    FloatingTextStringOnCreature("Commanding " + GetName(oMinion), oPC, FALSE);
                    // Targeted on object
                    if (GetIsObjectValid(oTarget) && GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
                    {
                        // Attack enemies
                        if (GetIsEnemy(oTarget))
                        {
                            FloatingTextStringOnCreature("Attacking " + GetName(oTarget), oPC, FALSE);
                            AssignCommand(oMinion, ClearAllActions());
                            DelayCommand(0.25, AssignCommand(oMinion, ActionAttack(oTarget)));
                        }
                        // Attack or move to neutral depending on variable
                        else if (GetIsNeutral(oTarget))
                        {
                            if (attackNeutral)
                            {
                                FloatingTextStringOnCreature("Attacking " + GetName(oTarget), oPC, FALSE);
                                AssignCommand(oMinion, ClearAllActions());
                                DelayCommand(0.25, AssignCommand(oMinion, ActionAttack(oTarget)));
                            }
                            else
                            {
                                FloatingTextStringOnCreature("Moving to location", oPC, FALSE);
                                AssignCommand(oMinion, ClearAllActions());
                                DelayCommand(0.25, AssignCommand(oMinion, ActionForceMoveToLocation(lTarget, TRUE, 12.0)));
                            }
                        }
                        // Move to friendly targets
                        else
                        {
                            FloatingTextStringOnCreature("Moving to location", oPC, FALSE);
                            AssignCommand(oMinion, ClearAllActions());
                            DelayCommand(0.25, AssignCommand(oMinion, ActionForceMoveToLocation(lTarget, TRUE, 12.0)));
                        }
                    }
                    // Targeted on location
                    else
                    {
                        FloatingTextStringOnCreature("Moving to location", oPC, FALSE);
                        AssignCommand(oMinion, ClearAllActions());
                        DelayCommand(0.25, AssignCommand(oMinion, ActionForceMoveToLocation(lTarget, TRUE, 12.0)));
                    }
                }
                oMinion = GetNextFactionMember(oPC, FALSE);
            }
    }

    SetExecutedScriptReturnValue(X2_EXECUTE_SCRIPT_END);
}


#5
Killmonger

Killmonger
  • Members
  • 237 messages
Coolio !
What took you a week would've taken me much longer to develop
Haven't had a chance to try this out yet, but it is a good step forward... Thank you!!
It is good that it utilises tag based scripting

Does it have a local effect or is it area/module wide?
Would it be very hard to modify it to affect nearby (friendly?) factions rather than just minions/henchmen
When targeting a friendly, (or a location) could the minions be set to defend the site?

There are many ramifications that a low level control system could offer (both for offensive and defensive strategies) It reminds me of the 2002 Genji's Art of War system. <updates? ;-) >
However, his excellent high level system was dependent on the use of detailed "shouts" through the field marshal listener. Your notion appears to be more mouse driven in a fire and forget methodology (Simpler, dialog/radial driven is better)

Thanks again for having a stab at it...
Keep it up

#6
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages
Eh, for what it's worth, that only took me about an hour to actually do (maybe less) - I'm just short on time and didn't get a chance to actually do it for a week.

It currently affects every creature controlled by the PC or any creature controlled by the PC's minions (so if a henchman wizard summons a creature, it'll affect that too).

It would not be hard to modify it to affect nearby factions - you'd simply change the while loop or add another while loop with different conditions.

The minions can't really be set to defend since the default AI will make them come back to you and follow you unless in combat. I haven't looked at the scripts, but it's probably in the heartbeat. If you made it so the minions did not automatically try to follow you every heartbeat, then it could be used to make them defend, yes. This also means that if you tell them to go to a location, they often won't even reach it (because the heartbeat makes them return to you).

The point of this was to make something very simple that could be easily imported and gave basic functionality. If you want it improved you're going to probably have to change other scripts too.

#7
Nevercallmebyname

Nevercallmebyname
  • Members
  • 102 messages
Sounds like a cool way of turning NWN into a sort of RTS.
With the script expanded to include a faction and the heatbeat modified you could start moving around entire armies in defense of a castle.

#8
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages
Well, if you use it on non-henchmen, they don't have a script to follow the PC, so you might not even need to modify the heartbeat. But yes, this could fairly easily be expanded (could also make different items affect different NPCs - archers versus fighters versus mages or whatever).

#9
Nevercallmebyname

Nevercallmebyname
  • Members
  • 102 messages
I cant wait to see what can be done with this script.

#10
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages
Well, I don't have any plans to do anything myself at the moment, but I'd be willing to modify it if people have specific requests.

#11
Nevercallmebyname

Nevercallmebyname
  • Members
  • 102 messages
Yeah I'm not about to use it either. I'm an RPGer and like NWN how it is.
That said I could try recreating the NWN2 campain in NWN1 and use your script to make runing crossroad keep that little bit more interesting?
Doubt I will though. Too many stories of my own to tell.

#12
WebShaman

WebShaman
  • Members
  • 913 messages
It would be nice to have this implemented into the OHS!!! Perhaps an add-on for it?

#13
WebShaman

WebShaman
  • Members
  • 913 messages
BTW, the Stand your ground command will prevent your henchies from following you. So having the ability to manually direct your henchies to place them tactically for an encounter is very nice!

#14
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages
A few things.

1, I uploaded v2 which fixed a few bugs I noticed and removed some debugging strings I had left in.

2, WebShaman's idea about telling them to stand their ground and THEN telling them to move to a location works very well - since they don't try to return to you. However, it does seem to cause some spellcaster AI problems where spellcaster henchmen will only attack with physical weapons instead of spells if you tell them to hold location and then target an enemy with the control script.

3, I'd be perfectly fine with this being implemented into henchmen packs or whatever

Modifié par MagicalMaster, 02 août 2013 - 07:02 .


#15
OldMansBeard

OldMansBeard
  • Members
  • 152 messages
If someone wants to modify the OHS to incorporate this, go right ahead.

I've been intending to remove all restrictions from the OHS - just haven't gotten round to it.

Consider this posting as an interim notice, if you like.

"OldMansBeard said, henceforth, you can do anything you like with the OHS".

#16
Killmonger

Killmonger
  • Members
  • 237 messages
There was an old game called "Myth". (Not Myst)
In it, through the various levels, one was given a limited supply of elvish archers, dwarven men at arms, and gnomish bombers. The objective was to use the real time physics to achieve and maintain a specific goal-state. These groups would march to a user defined waypoint and then fulfil their function as described by their type.

Let henchmen be henchmen, what I was trying to infer is the PC's ability to command nearby friendly forces due to the PC's status ( charisma perhaps) then predefined scripts could be assigned to those "found" friendly npcs via the PC's "persuasive" nature and then behave according to simplistic catagories to complete their assigned tasks.

If the PC could lay down a marker (a mouse click) and the local farmers & villagers (per se) could made to perform a simple task (like defend a spot & burn all monsters repectively) then the PC and henchmen could be free to escape the locale, leaving the locals to complete a rear guard action. Evil bosses could also have this option too.
Alternately, per se, the "Guards" could be so assigned to defend and relay warnings to the PC as the specific enemy type was detected in their locale when the PC & henchmen were elsewhere

Low level interactivity with allied factions, locally, could help prevent the PC "hero team" from being overwhelmed by an opposing forces' onslaught (or possibly lead them to their fate like lambs...)

jmo

Modifié par Killmonger, 04 août 2013 - 01:42 .


#17
Nevercallmebyname

Nevercallmebyname
  • Members
  • 102 messages

Killmonger wrote...

There was an old game called "Myth". (Not Myst)
In it, through the various levels, one was given a limited supply of elvish archers, dwarven men at arms, and gnomish bombers. The objective was to use the real time physics to achieve and maintain a specific goal-state. These groups would march to a user defined waypoint and then fulfil their function as described by their type.

Let henchmen be henchmen, what I was trying to infer is the PC's ability to command nearby friendly forces due to the PC's status ( charisma perhaps) then predefined scripts could be assigned to those "found" friendly npcs via the PC's "persuasive" nature and then behave according to simplistic catagories to complete their assigned tasks.

If the PC could lay down a marker (a mouse click) and the local farmers & villagers (per se) could made to perform a simple task (like defend a spot & burn all monsters repectively) then the PC and henchmen could be free to escape the locale, leaving the locals to complete a rear guard action. Evil bosses could also have this option too.
Alternately, per se, the "Guards" could be so assigned to defend and relay warnings to the PC as the specific enemy type was detected in their locale when the PC & henchmen were elsewhere

Low level interactivity with allied factions, locally, could help prevent the PC "hero team" from being overwhelmed by an opposing forces' onslaught (or possibly lead them to their fate like lambs...)

jmo


I'm sure I've played that.

#18
WebShaman

WebShaman
  • Members
  • 913 messages

OldMansBeard wrote...

If someone wants to modify the OHS to incorporate this, go right ahead.

I've been intending to remove all restrictions from the OHS - just haven't gotten round to it.

Consider this posting as an interim notice, if you like.

"OldMansBeard said, henceforth, you can do anything you like with the OHS".


Awesome sauce OMB!!!

A big thanks from this user of the OHS!!!

*scrambles off to incorporate MM henchie controls into OHS*

#19
Tarot Redhand

Tarot Redhand
  • Members
  • 2 675 messages
@WebShaman when you get it working please post this somewhere. Preferably multiple somewheres ie both vaults.

TR

#20
OldMansBeard

OldMansBeard
  • Members
  • 152 messages

WebShaman wrote...
Awesome sauce OMB!!!
A big thanks from this user of the OHS!!!
*scrambles off to incorporate MM henchie controls into OHS*


For the avoidance of doubt, I've posted a version of the OHS on NeverwinterVault with all of my copyright notices stripped out of the source code and permission to do what you like with it.

#21
MrKWMonk

MrKWMonk
  • Members
  • 52 messages
Wow, didn't expect to get so much traction with this one. Thanks all.

And a very big thank you and much kudos to OldMansBeard. OHS is the best mod there is for NWN in my opinion and I've used it with just about every character I've played.

Will keep a closer eye on developments here

:)

#22
Jugonshi

Jugonshi
  • Members
  • 142 messages
Controlling henchmen will be good. But also, if a better AI can be incorporated into OHS, that will be wonderful.

Unfortunately, with the default generic henchman AI, henchmen are even dumber than those in OC/SoU/HotU or NPCs. They do not even switch between ranged/melee.

If OHS henchmen start to switch weapons, and to use more abilities which the default AI ignores (Taunt, Rage, Divine Might, Imbue Arrow and such), the gaming experience will be largely improved.

#23
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

They do not even switch between ranged/melee

The funny thing is that usually that's a good thing.  With more "advanced" AI often you can't give NPCs certain weapons or they'll stupidly switch to them when it's a bad idea to do so.

Modifié par MagicalMaster, 12 août 2013 - 03:23 .