Here's what I'm looking to do, and I'm hoping like heck that there's a solution and I'm just too tired and braindead to see it:
I want to create an item that, when I am perceived by hostile creatures, make them ignore me as if I wasn't there. Basically I'm looking for a faction change, but only for a player that has the item. If the item is dropped, destroyed, whatever...then mobs happily munch on said player as normal. Is this possible, and if so, how might I accomplish it?
Widget for monster apathy?
Débuté par
CyronZarva
, mars 05 2012 08:26
#1
Posté 05 mars 2012 - 08:26
#2
Posté 05 mars 2012 - 12:25
You have to re-write the On-perception scripts to check for the presence of the item. The creatures will still attacked when attacked, though, and will respond to their buddies getting attacked.
#3
Posté 05 mars 2012 - 03:32
That's what I'm looking at, but thought I'd check, given how new I am to the whole scripting thing. Thank you.
#4
Posté 05 mars 2012 - 07:39
I wonder if custom factions may work here.
I think that reputation between standard factions (hostile, defender, commoner) may be fixed, but if you create a custom monster faction, you may be able to use scripting to change the reputation of the person who equips the item to be friendly with the custom monster faction and then at unequpping changes back to unfriendly.
Re-writing your perception scripts and heartbeat scrips and all the other scripts could get difficult and this may be an alternative.
I think that reputation between standard factions (hostile, defender, commoner) may be fixed, but if you create a custom monster faction, you may be able to use scripting to change the reputation of the person who equips the item to be friendly with the custom monster faction and then at unequpping changes back to unfriendly.
Re-writing your perception scripts and heartbeat scrips and all the other scripts could get difficult and this may be an alternative.
#5
Posté 05 mars 2012 - 10:56
//on perception script.
//this code will make a npc neutral to the player if they are wearing a disguise in their chest slot tagged "disguise_me"
//put this code in front of the normal perception code
#include "hench_i0_ai"
#include "ginc_behavior"
void main()
{
object oPC = GetLastPerceived();
object oTarget;
if (!GetIsPC(oPC)) return;
if (!GetLastPerceptionSeen()) return;
if (GetTag(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC)) == "disguise_me")
{
oTarget = OBJECT_SELF;
int nDoOnce = GetGlobalInt("orcs_neutral");
if (nDoOnce==1) return;
SetGlobalInt("orcs_neutral", 1);
AdjustReputation(oPC, oTarget, 50);
// SetIsTemporaryEnemy(oPC, oTarget);
//ActionAttack(oPC);
//DetermineCombatRound(oPC);
}
//default nwn2 perception script code follows...
//this code will make a npc neutral to the player if they are wearing a disguise in their chest slot tagged "disguise_me"
//put this code in front of the normal perception code
#include "hench_i0_ai"
#include "ginc_behavior"
void main()
{
object oPC = GetLastPerceived();
object oTarget;
if (!GetIsPC(oPC)) return;
if (!GetLastPerceptionSeen()) return;
if (GetTag(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC)) == "disguise_me")
{
oTarget = OBJECT_SELF;
int nDoOnce = GetGlobalInt("orcs_neutral");
if (nDoOnce==1) return;
SetGlobalInt("orcs_neutral", 1);
AdjustReputation(oPC, oTarget, 50);
// SetIsTemporaryEnemy(oPC, oTarget);
//ActionAttack(oPC);
//DetermineCombatRound(oPC);
}
//default nwn2 perception script code follows...
Modifié par kamal_, 06 mars 2012 - 01:27 .
#6
Posté 06 mars 2012 - 02:32
It might be done with tag based scripting. If the item is picked up then getnearestcreaturetolocation() and change their faction with setistemporaryneutral()
after thinking about the above functions i realised that they would need to be in a heartbeat or a endless while loop - UNLESS you give the item an activation that has a duration, like a spell.
so another option would be to put in a module property on heartbeat call to a function that gets called in the tag based script for your item then gets turned off when the item is dropped.
just brainstorming here but you may also tag base script an AOE spell that runs constantly but that involves 2da editing and a few other experiment requiring things like scripting the AOE to begin with.
spell and ability scripts are explained here -> http://forum.bouncyr....php?f=22&t=127
hope this all gives you some ideas on how to make your monster pacifier
after thinking about the above functions i realised that they would need to be in a heartbeat or a endless while loop - UNLESS you give the item an activation that has a duration, like a spell.
so another option would be to put in a module property on heartbeat call to a function that gets called in the tag based script for your item then gets turned off when the item is dropped.
just brainstorming here but you may also tag base script an AOE spell that runs constantly but that involves 2da editing and a few other experiment requiring things like scripting the AOE to begin with.
spell and ability scripts are explained here -> http://forum.bouncyr....php?f=22&t=127
hope this all gives you some ideas on how to make your monster pacifier
#7
Posté 06 mars 2012 - 02:54
I think the AOE may be the best solution. You don't need to modify a 2da to create this. Use the function EffectAreaofEffect(effect, script in, heartbeat script, script out). This is how I created my slow aura for mustard jellies. For the effect you can use a visual effect and have the custom scripts do what you want.
The AOE would make it so the player or character with the item is protected. If the characters spread out too far the other creatures and characters outside the AOE would battle.
As for factions this is where it will get a little tricky. You need to use a custom faction. If you change the hostile creatures to another standard faction the other hostile creatures outside the AOE will become hostile to them. To have a hostile join the faction you will need to use use something like a faction pig. I would also suggest setting a local int on the hostiles before changing them then when they exit the effect check for that int before returning them to hostile. This will prevent turning originally non-hostile to hostile as you wander through an area.
The AOE would make it so the player or character with the item is protected. If the characters spread out too far the other creatures and characters outside the AOE would battle.
As for factions this is where it will get a little tricky. You need to use a custom faction. If you change the hostile creatures to another standard faction the other hostile creatures outside the AOE will become hostile to them. To have a hostile join the faction you will need to use use something like a faction pig. I would also suggest setting a local int on the hostiles before changing them then when they exit the effect check for that int before returning them to hostile. This will prevent turning originally non-hostile to hostile as you wander through an area.





Retour en haut






