Neverwinter Nights: Enhanced Edition

Neverwinter Nights: Enhanced Edition

Adventures await!
Gather your mods before venturing forth. Discover planes filled with player-created adventures in Steam Workshop, then build your own Neverwinter Nights modules using the Aurora Toolset to share!
Learn More
Gonar 12 Oct, 2018 @ 12:47am
Run command don't work....
ActionMoveAwayFromObject(oPC, TRUE, 40.0);

I have some NPCs with similar commands to the up line. It work, and the NPC move away from PC, but walking, don't Run ... ¿Is a bug?
Last edited by Gonar; 12 Oct, 2018 @ 12:48am
< >
Showing 1-7 of 7 comments
Julius Borisov  [developer] 12 Oct, 2018 @ 5:05am 
Gonar 12 Oct, 2018 @ 11:40am 
I am nwn scripter since 2002 and make a lot of systems, i have the lexycon in my desktop. The scripting isn't complex for me, i work with my personal libraries. But this function (TRUE run, FALSE walk) don't work correctly.

I go to beamdogs forumns, log mi account, but don't have post button.

Sorry for my english level, i am spanish.

:steamhappy:
Gonar 12 Oct, 2018 @ 1:21pm 
In what discord channel comment this??
wendigo211 3 12 Oct, 2018 @ 6:25pm 
Make sure you clear detect mode and stealth mode from the creature before you call the function. I've used it a few times, although I didn't want the the creature to run.

If clearing the action modes doesn't help, you can write your own function fairly easily. Let me know if you need any help.
Gonar 12 Oct, 2018 @ 11:17pm 
(Sorry for me English, I am Spanish)

Well, this is one creature for example. She has the default IA, but in OnSpawn and UserDefined has custom scripts:

OnSpawn
const int EVENT_USER_DEFINED_PRESPAWN = 1510; const int EVENT_USER_DEFINED_POSTSPAWN = 1511; #include "x0_i0_anims" #include "x0_i0_treasure" #include "x2_inc_switches" #include "ach_inc_personal" void main() { SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_PRESPAWN )); SetListeningPatterns(); WalkWayPoints(); CTG_GenerateNPCTreasure(TREASURE_TYPE_MONSTER, OBJECT_SELF); GenerarNombre(OBJECT_SELF); // Random Name, based in racial and sex SetLocalLocation(OBJECT_SELF, "INICIO", GetLocation(OBJECT_SELF)); // Start position SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_USER_DEFINED_POSTSPAWN)); }

OnUserDefined
#include "ach_inc_ia_mejor" #include "ach_inc_personal" #include "x2_inc_switches" #include "x0_i0_anims" const int EVENT_USER_DEFINED_PRESPAWN = 1510; const int EVENT_USER_DEFINED_POSTSPAWN = 1511; void Robar(object oPC); void main() { int nUser = GetUserDefinedEventNumber(); if(nUser == EVENT_HEARTBEAT ) //HEARTBEAT { if(GetLocalInt(OBJECT_SELF, "Robando") == 1) return; object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC); float fDistancia = GetDistanceBetween(OBJECT_SELF, oPC); int iRobo = GetLocalInt(oPC, "Robado"); if(GetArea(OBJECT_SELF) != GetArea(oPC)) return; else if(iRobo == 1 || d100() >= 51) ActionRandomWalk(); else if(iRobo == 0 && fDistancia >= 1.5) ActionForceMoveToObject(oPC, FALSE, 1.0, 20.0); else if(iRobo == 0 && fDistancia <= 1.4) Robar(oPC); } else if(nUser == EVENT_USER_DEFINED_PRESPAWN) { object oItem = GetFirstItemInInventory(OBJECT_SELF); while(GetIsObjectValid(oItem)) { SetIdentified(oItem, TRUE); oItem = GetNextItemInInventory(OBJECT_SELF); } EstablecerAltura(OBJECT_SELF); if(GetHasFeat(FEAT_WEAPON_FOCUS_SLING) || GetHasFeat(FEAT_WEAPON_FOCUS_SHURIKEN) || GetHasFeat(FEAT_WEAPON_FOCUS_SHORTBOW) || GetHasFeat(FEAT_WEAPON_FOCUS_LONGBOW) || GetHasFeat(FEAT_WEAPON_FOCUS_LIGHT_CROSSBOW) || GetHasFeat(FEAT_WEAPON_FOCUS_HEAVY_CROSSBOW) || GetHasFeat(FEAT_WEAPON_FOCUS_DART) || GetHasFeat(FEAT_WEAPON_FOCUS_THROWING_AXE)) SetCombatCondition(X0_COMBAT_FLAG_RANGED); } else if (nUser == EVENT_USER_DEFINED_POSTSPAWN) { } } void Robar(object oPC) { int iBuscar = GetSkillRank(SKILL_SEARCH, oPC) + d20(); int iRobar = GetSkillRank(SKILL_PICK_POCKET, OBJECT_SELF) + d20(); if(GetGold(oPC) <= 0) return; int iOro = d20(); if(GetGold(oPC) <= iOro) iOro = Random(GetGold(oPC)) + 1; SetLocalInt(oPC, "Robado", 1); SetLocalInt(OBJECT_SELF, "Robando", 1); if(iRobar > iBuscar) { TakeGoldFromCreature(iOro, oPC); ActionMoveAwayFromObject(oPC, FALSE, 50.0); } else { TakeGoldFromCreature(iOro, oPC); AssignCommand(OBJECT_SELF, ActionMoveAwayFromObject(oPC, TRUE, 120.0)); // She make this, but walking, don't run. AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0, 6.0)); FloatingTextStringOnCreature("Acaban de robarte y empujarte, te has dado cuenta a tiempo. Miras a tu alrededor y no sabes decir quién, el ladronzuelo se escabulle corriendo.", oPC); } DelayCommand(30.0, SetLocalInt(OBJECT_SELF, "Robando", 0)); DelayCommand(1200.0, SetLocalInt(oPC, "Robado", 0)); }
wendigo211 3 13 Oct, 2018 @ 11:56am 
You could try modifying Robar with the following additional commands and see if it helps
void Robar(object oPC) { int iBuscar = GetSkillRank(SKILL_SEARCH, oPC) + d20(); int iRobar = GetSkillRank(SKILL_PICK_POCKET, OBJECT_SELF) + d20(); if(GetGold(oPC) <= 0) return; int iOro = d20(); if(GetGold(oPC) <= iOro) iOro = Random(GetGold(oPC)) + 1; SetLocalInt(oPC, "Robado", 1); SetLocalInt(OBJECT_SELF, "Robando", 1); if(iRobar > iBuscar) { TakeGoldFromCreature(iOro, oPC); ActionMoveAwayFromObject(oPC, FALSE, 50.0); } else { TakeGoldFromCreature(iOro, oPC); SetActionMode(OBJECT_SELF, ACTION_MODE_DETECT, FALSE); SetActionMode(OBJECT_SELF, ACTION_MODE_STEALTH, FALSE); AssignCommand(OBJECT_SELF, ActionMoveAwayFromObject(oPC, TRUE, 120.0)); // She make this, but walking, don't run. AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0, 6.0)); FloatingTextStringOnCreature("Acaban de robarte y empujarte, te has dado cuenta a tiempo. Miras a tu alrededor y no sabes decir quién, el ladronzuelo se escabulle corriendo.", oPC); } DelayCommand(30.0, SetLocalInt(OBJECT_SELF, "Robando", 0)); DelayCommand(1200.0, SetLocalInt(oPC, "Robado", 0)); }

You'll need to add:
#include "nw_i0_generic"
to the script as well.

If that doesn't work, try this version:
void Robar(object oPC) { int iBuscar = GetSkillRank(SKILL_SEARCH, oPC) + d20(); int iRobar = GetSkillRank(SKILL_PICK_POCKET, OBJECT_SELF) + d20(); if(GetGold(oPC) <= 0) return; int iOro = d20(); if(GetGold(oPC) <= iOro) iOro = Random(GetGold(oPC)) + 1; SetLocalInt(oPC, "Robado", 1); SetLocalInt(OBJECT_SELF, "Robando", 1); if(iRobar > iBuscar) { TakeGoldFromCreature(iOro, oPC); ActionMoveAwayFromObject(oPC, FALSE, 50.0); } else { TakeGoldFromCreature(iOro, oPC); SetActionMode(OBJECT_SELF, ACTION_MODE_DETECT, FALSE); SetActionMode(OBJECT_SELF, ACTION_MODE_STEALTH, FALSE); SetLocalObject(OBJECT_SELF, "FleeTarget", oPC); SetLocalFloat(OBJECT_SELF, "FleeDistance", 120.0); ExecuteScript("fleetarget", OBJECT_SELF); AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0, 6.0)); FloatingTextStringOnCreature("Acaban de robarte y empujarte, te has dado cuenta a tiempo. Miras a tu alrededor y no sabes decir quién, el ladronzuelo se escabulle corriendo.", oPC); } DelayCommand(30.0, SetLocalInt(OBJECT_SELF, "Robando", 0)); DelayCommand(1200.0, SetLocalInt(oPC, "Robado", 0)); }

You will need to create the following script with the name fleetarget:
#include "nw_i0_generic" float RandFloat(float fMin, float fMax) { int iMax=32768; return fMin+(fMax-fMin)*IntToFloat(Random(iMax))/IntToFloat(iMax-1); } void main() { object oTarget=GetLocalObject(OBJECT_SELF, "FleeTarget"); float fDist=GetLocalFloat(OBJECT_SELF, "FleeDistance"); object oArea=GetArea(OBJECT_SELF); if (GetDistanceToObject(oTarget)>=fDist||GetArea(oTarget)!=oArea) { DeleteLocalObject(OBJECT_SELF, "FleeTarget"); DeleteLocalFloat(OBJECT_SELF, "FleeDistance"); return; } float fDirection=VectorToAngle(GetPosition(OBJECT_SELF)-GetPosition(oTarget))+RandFloat(-90.0, 90.0); if (fDirection<0.0) fDirection+=360.0; else if (fDirection>=360.0) fDirection-=360.0; vector vDest=GetPosition(OBJECT_SELF)+5.0*AngleToVector(fDirection); location lDest=Location(oArea, vDest, fDirection); ActionMoveToLocation(lDest, TRUE); DelayCommand(1.5, ExecuteScript("fleetarget", OBJECT_SELF)); }

Hopefully, one of these fixes will help you.
Wandering Gypsy 20 Oct, 2018 @ 1:10pm 
Doesn't get any easier than that! Thanks wendigo!
< >
Showing 1-7 of 7 comments
Per page: 1530 50