Neverwinter Nights: Enhanced Edition

Neverwinter Nights: Enhanced Edition

View Stats:
Script Help = Vortex vfx creature
I have a creature that looks like a vfx vortex yellow

I want this creature to teleport the player when it comes in contact with a player.

If a player hits it with a weapon he is sucked into the vortex with a vfx before the teleport.

I want the vortex to teleport the player if it is real close but im not sure if it will.Get distance from pc?

Im trying to figure out what i need to do to teleport a player to a differnt area basicly if he gets close to the vortex.

Im thinking the only thing way to damage this mist is with spells.

The creature moves around.
Last edited by builder_anthony; Jan 21, 2019 @ 3:44pm
< >
Showing 1-15 of 16 comments
builder_anthony Jan 21, 2019 @ 3:39pm 
Last edited by builder_anthony; Jan 21, 2019 @ 3:39pm
Sticky Wicket Jan 21, 2019 @ 4:44pm 
A lot of ideas happening here, but I think you need to be clearer exactly how you want it to work.

This vortex is directly hostile to the PC? or is it some neutral random wandering force of nature ?

If hostile then it will actively engage the PC in combat, not sure if that's what you want.

You also want it to teleport the PC if they strike the Vortex, but also if they get too close?

So they will be teleported if they are using ranged weapons but not ranged spells?

You also want a teleport that is triggered by proximity?

It could be problematic since it is easy enough to trigger via damage done to it but making a difference between spell damage and ranged weapon damage might be challenging script-wise.

Also, does this affect any henchmen, animal companions, familiars summoned creatures etc?
Last edited by Sticky Wicket; Jan 21, 2019 @ 4:54pm
builder_anthony Jan 21, 2019 @ 4:48pm 
yah its hostile but if it hits them in a attack i want it to teleport them i think it be easier to somehow grab the distance between the player and the creature.I basicly want to spawn it in and pcs should be scared of it because it sucks them to a bad area.i would say its like a ravenloft mist.i think ranged weapons like arrows will have no effect since its a mist but i see it being damaged by magic so players can fight it off that way or run around it since its a slow creature.
im thinking to make things simple maybe get the distance between them to solve alot of problems,if they are to close the get teleported.
Last edited by builder_anthony; Jan 21, 2019 @ 4:49pm
Sticky Wicket Jan 22, 2019 @ 9:49am 
Just as a basic start for your proximity teleport.....

This will give you a basic teleport to a wp (in whatever other area) if anything gets within 10 m of it:
Add it to the existing heartbeat script of the vortex (placing it so that it doesn't interfere with any existing script actions of course).

//

object oNearestcreature = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE);
object oDest = GetObjectByTag("wp_vortexenter");
float fDist = GetDistanceBetween(OBJECT_SELF,oNearestcreature);


if (fDist <= 10.0)
{
AssignCommand(oNearestcreature, ClearAllActions());
AssignCommand(oNearestcreature, ActionJumpToObject(oDest,FALSE));
}

//

I'll play about with this a bit more over the next few days.
There might be problems with teleporting hench or other associates without the PC. It might be simpler to make it only apply to player characters and then any associates get teleported along with them.
builder_anthony Jan 22, 2019 @ 10:46am 
Yah it worked.Its kinda cool it sucks in non party npcs .I didnt test it with a npc in my party but that basicly completes the main objective.Once the player is teleported to that waypoint i have some monsters there and its kind of a misty dark planar area.I also created a good portal in that waypoint area.It spawns a portal back to a temple.Theres also a differnt script with a angel flying around and doing stuff but to make things short the angel is more or less createing this good portal so the players can escape the high level mosters there.Its all up and running if you want to check it out.

Zombie Survival Bone Seas Outlook Post 1/255
https://steamcommunity.com/sharedfiles/filedetails/?id=1319391248&searchtext=
Last edited by builder_anthony; Jan 22, 2019 @ 1:45pm
Sticky Wicket Jan 22, 2019 @ 2:14pm 
It was just a very basic script to give you a general idea of how it could work.

It might be better if the teleport is more speciffic about who gets teleported. As said earlier it might work better if it is more directed towards player characters and their associates.

There might be problems otherwise seperating hench from PC. It needs a bit of testing.

The main problem is of course keeping hench away from it!

update/testing:

If your associates get teleported then they just wait there for you on the other side. If you get teleported then your associates automatically go with you. If you destroy the vortex whilst they are still there you might not be able to get them back! You might want to include something (like an object that the vortex creature drops on death that will summon any lost companions in the void back to you).
Last edited by Sticky Wicket; Jan 22, 2019 @ 5:00pm
builder_anthony Jan 22, 2019 @ 6:37pm 
Hmmmm .....i tested it by spawning the vortex.I let a summoned air elemental fight it and another npc that was in my party and they were both sucked into the astral plane.When i hovered over their pictures it showed they were in the abyassl plane.I then ran from the vortex and into another area and both of my party members were inside the building when they should still be in the astral plane because they were sucked into the vortex.This is most likely caused by the loading of the area.


1.I would like my party members that were sucked into the vortex and placed in the astral plane and stay there.
2.I would like to add a journal entry when a party member is sucked into the vortex and sent to the astral plane.
The journal will tell the player his party member has been sent to the astral plane and needs to be rescued.

Well you know this leads things back to the drawing board but its turning out well.

To make things a little more intresting i guess i should explain the astral plane layout.

EDITING
Heres the vortex in front of the player.It moves towards them like a hostile creature and sucks them up.
https://steamcommunity.com/sharedfiles/filedetails/?id=1631800731

Sends them here and theres a bunch of monsters.I have triggers on the floor,one for a angel to spawn and fight and another trigger that spawns in a hovering angel that is actualy a portal that starts a conversation.The conversation allows them to escapse but this agel portal creature cannot be in combat and CAN be killed.I have the angel portal creature able to spawn very quickly and it allows one to spawn far enough away so a creature is out of combat toi be able to actually see the conversation menu pop up.The angel conversation portal creature is the whiteish light with a vortex at the base and the angel script fireing below.
https://steamcommunity.com/sharedfiles/filedetails/?id=1632709003
Last edited by builder_anthony; Jan 22, 2019 @ 7:05pm
Sticky Wicket Jan 22, 2019 @ 10:01pm 
This doesn't suprise me actually, I should have guessed that would happen (hench returning to the player after changing area).

The game does not like it when you try to seperate player characters from their associates! (so much of the existing coding is actually there to keep the party together).

You could automatically fire them from the party if they get teleported; then they are no longer your associates and should theoretically stay in the astral plane as npc's.

You can add a conversation line to rejoin your service once they are rescued of course.
Last edited by Sticky Wicket; Jan 22, 2019 @ 10:08pm
wendigo211 Jan 23, 2019 @ 12:27am 
Originally posted by builder_anthony:
I have a creature that looks like a vfx vortex yellow

I want this creature to teleport the player when it comes in contact with a player.

There are two ways to do this:
  • If you want the creature sentient, use a custom AI script that looks something like the following:
    #include "x2_inc_switches" //Recursive seek and teleport function void Teleport(object oTarget) { location lLoc=GetLocalLocation(OBJECT_SELF, "lTeleport"); if (!GetIsObjectValid(oTarget)) { return; } if (GetDistanceBetween(oTarget,OBJECT_SELF)>=3.0) { AssignCommand(oTarget, ClearAllActions(TRUE)); AssignCommand(oTarget, JumpToLocation(lLoc)); return; } else { ClearAllActions(); ActionForceMoveToObject(oTarget); DelayCommand(1.0, Teleport(oTarget)); } } //Function to select a target object FindTarget() { location lSelf=GetLocation(OBJECT_SELF); object oPC=GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF)); object oTBR=OBJECT_INVALID; while (GetIsObjectValid(oPC)) { if (GetObjectSeen(oPC)&&GetIsPC(oPC)) { if (GetIsObjectValid(oTBR)) { if (GetDistanceToObject(oPC)<GetDistanceToObject(oTBR)) oTBR=oPC; } else oTBR=oPC; } oPC=GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF)); } return oTBR; } void main() { object oTarget=FindTarget(); if (GetIsObjectValid(oTarget)) Teleport(oTarget); SetCreatureOverrideAIScriptFinished(OBJECT_SELF); }
  • If you don't want the creature sentient, have it use ActionRandomWalk() and place a persistent AOE on it (like the silence spell), in the on enter script for the AOE run a check that the entering object is a PC and teleport it if it is.

    If a player hits it with a weapon he is sucked into the vortex with a vfx before the teleport.

    Modify the On Damaged and On Physical Attacked event scripts for the creature, use GetLastDamager and GetLastAttacker respectively to find the damaging object.

    I want the vortex to teleport the player if it is real close but im not sure if it will.Get distance from pc?
    If you aren't using a persistent AoE (in which case the distance is determined by the AoE radius), then use GetDistanceToObject if the NPC is the function caller or GetDistanceBetween if the NPC is not the function caller.

    Im trying to figure out what i need to do to teleport a player to a differnt area basicly if he gets close to the vortex.

    JumpToLocation should work, you'll probably have to write a wrapper function that removes any henchmen the PC has as well.

    Im thinking the only thing way to damage this mist is with spells.

    Give it a custom skin that has 100% damage immunity to bludgeoning, piercing and slashing.
builder_anthony Jan 23, 2019 @ 9:23am 
It seems to be working well and capable of captureing multiple players per round.It seems i have it working pretty good.
Heres the on heartbeat scipt
//mist portal

#include "nw_i0_generic"

void main()
{
object oNearestcreature = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE);
effect eVFX = EffectVisualEffect(VFX_IMP_PULSE_WIND);
object oDest = GetObjectByTag("wp_vortexenter");
float fDist = GetDistanceBetween(OBJECT_SELF,oNearestcreature);


if (fDist <= 3.0)
{
AssignCommand(oNearestcreature, ClearAllActions());
AssignCommand(oNearestcreature, ActionJumpToObject(oDest,FALSE));
}
// * if not runnning normal or better Ai then exit for performance reasons
if (GetAILevel() == AI_LEVEL_VERY_LOW) return;

// Buff ourselves up right away if we should
if(GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY))
{
// This will return TRUE if an enemy was within 40.0 m
// and we buffed ourselves up instantly to respond --
// simulates a spellcaster with protections enabled
// already.
if(TalentAdvancedBuff(40.0))
{
// This is a one-shot deal
SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, FALSE);

// This return means we skip sending the user-defined
// heartbeat signal in this one case.
return;
}
}


if(GetHasEffect(EFFECT_TYPE_SLEEP))
{
// If we're asleep and this is the result of sleeping
// at night, apply the floating 'z's visual effect
// every so often

if(GetSpawnInCondition(NW_FLAG_SLEEPING_AT_NIGHT))
{
effect eVis = EffectVisualEffect(VFX_IMP_SLEEP);
if(d10() > 6)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
}
}
}

// If we have the 'constant' waypoints flag set, walk to the next
// waypoint.
else if ( GetWalkCondition(NW_WALK_FLAG_CONSTANT) )
{
WalkWayPoints();
}

// Check to see if we should be playing default animations
// - make sure we don't have any current targets
else if ( !GetIsObjectValid(GetAttemptedAttackTarget())
&& !GetIsObjectValid(GetAttemptedSpellTarget())
// && !GetIsPostOrWalking())
&& !GetIsObjectValid(GetNearestSeenEnemy()))
{
if (GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL) || GetBehaviorState(NW_FLAG_BEHAVIOR_OMNIVORE) ||
GetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE))
{
// This handles special attacking/fleeing behavior
// for omnivores & herbivores.
DetermineSpecialBehavior();
}
else if (!IsInConversation(OBJECT_SELF))
{
if (GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS)
|| GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN)
|| GetIsEncounterCreature())
{
PlayMobileAmbientAnimations();
}
else if (GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS))
{
PlayImmobileAmbientAnimations();
}
}
}

// Send the user-defined event signal if specified
if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_HEARTBEAT));
}
}











Heres the on on physcail attacked

//Can go OnDamaged, OnDisturbed, OnSpellCastAt, creature heartbeats, etc.
void main()
{

object oPC = GetLastHostileActor();
object oNearestcreature = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE);
object oDest = GetObjectByTag("wp_vortexenter");
float fDist = GetDistanceBetween(OBJECT_SELF,oNearestcreature);


if (fDist <= 10.0)
{
AssignCommand(oNearestcreature, ClearAllActions());
AssignCommand(oNearestcreature, ActionJumpToObject(oDest,FALSE));
}
if (!GetIsPC(oPC)) return;

object oTarget;
location lTarget;
oTarget = GetWaypointByTag("here24");

lTarget = GetLocation(oTarget);

if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

SetLocalLocation(oPC, "ls_stored_loc", GetLocation(oPC));

AssignCommand(oPC, ClearAllActions());

DelayCommand(3.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));

oTarget = oPC;

int nInt;
nInt = GetObjectType(oTarget);

if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oTarget));

}
Last edited by builder_anthony; Jan 23, 2019 @ 9:25am
Sticky Wicket Jan 24, 2019 @ 5:26am 
I'm a bit busy with other things atm, but here is a quick basic script to fire hench and add journal entry.

Place in the onenter of the area (astral plain or wherever they get teleported to)

This is assuming there is only 1 player character. If there is more than 1 this script will need to be added to to differentiate players and their respective associates.


void main()
{
object oArrival = GetEnteringObject();
object oPC = GetFirstPC();

if (GetIsPC(oArrival))
{
AddJournalQuestEntry("thevortex", 2, oPC, FALSE, FALSE, TRUE);
}

else if(GetAssociateType(oArrival) == ASSOCIATE_TYPE_HENCHMAN)
{
RemoveHenchman(oPC, oArrival);
AddJournalQuestEntry("thevortex", 1, oPC, FALSE, FALSE, TRUE);
}
}
builder_anthony Jan 24, 2019 @ 7:31am 
Actually i think thats all im going to do on this one.I have the scripts and areas pretty finely tuned in game.One thing i noticed is that you can see if your henchman is fighting in the other area which is kinda neat,I just think adding jounal at this time is just going further then i want to right now even though i said before i wanted it.It looks good if you want to see it its pretty impressive the way i have the areas set up and spawns.Appreciate the help.
Last edited by builder_anthony; Jan 24, 2019 @ 7:31am
wendigo211 Jan 24, 2019 @ 7:37am 
You might need to remove the henchman before you jump the player to the new location. I would recommend including the following function in your heartbeat script:
void VortexJumpToObject(object oTarget) { object oDest = GetObjectByTag("wp_vortexenter"); if (GetIsPC(oTarget)) { int i=GetMaxHenchmen(); while (i>0) { object oAssociate=GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oTarget, i); if (GetIsObjectValid(oAssociate)) { RemoveHenchman(oTarget, oAssociate); //Add any code here to jump the associate to a place where //the PC can recruit them later } i--; } object oAssociate=GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oTarget); if (GetIsObjectValid(oAssociate)) RemoveSummonedAssociate(oTarget, oAssociate); oAssociate=GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oTarget); if (GetIsObjectValid(oAssociate)) RemoveSummonedAssociate(oTarget, oAssociate); oAssociate=GetAssociate(ASSOCIATE_TYPE_SUMMONED, oTarget); if (GetIsObjectValid(oAssociate)) RemoveSummonedAssociate(oTarget, oAssociate); oAssociate=GetAssociate(ASSOCIATE_TYPE_DOMINATED, oTarget); if (GetIsObjectValid(oAssociate)) { effect eTBR=GetFirstEffect(oAssociate); while (GetIsEffectValid(eTBR)) { if (GetEffectType(eTBR)==EFFECT_TYPE_DOMINATED) RemoveEffect(oAssociate, eTBR); eTBR=GetNextEffect(oAssociate); } } RemoveFromParty(oTarget); AssignCommand(oTarget, ClearAllActions(TRUE)); AssignCommand(oTarget, ActionJumpToObject(oDest,FALSE)); AddJournalQuestEntry("thevortex", 2, oTarget, FALSE, FALSE, TRUE); return; } object oPC=GetMaster(oTarget); if (!GetIsObjectValid(oPC)) return; int iAType=GetAssociateType(oTarget); switch (iAType) { case ASSOCIATE_TYPE_HENCHMAN: RemoveHenchman(oPC, oTarget); AddJournalQuestEntry("thevortex", 1, oPC, FALSE, FALSE, TRUE); AssignCommand(oTarget, ClearAllActions(TRUE)); AssignCommand(oTarget, ActionJumpToObject(oDest,FALSE)); break; case ASSOCIATE_TYPE_ANIMALCOMPANION: case ASSOCIATE_TYPE_FAMILIAR: case ASSOCIATE_TYPE_SUMMONED: RemoveSummonedAssociate(oPC, oTarget); break; case ASSOCIATE_TYPE_DOMINATED: effect eTBR=GetFirstEffect(oTarget); while (GetIsEffectValid(eTBR)) { if (GetEffectType(eTBR)==EFFECT_TYPE_DOMINATED) RemoveEffect(oTarget, eTBR); eTBR=GetNextEffect(oTarget); } AssignCommand(oTarget, ClearAllActions(TRUE)); AssignCommand(oTarget, ActionJumpToObject(oDest,FALSE)); break; }; }

Then replace the lines in your heartbeat script:
AssignCommand(oNearestcreature, ClearAllActions());
AssignCommand(oNearestcreature, ActionJumpToObject(oDest,FALSE));
With:
VortexJumpToObject(oNearestcreature);
builder_anthony Jan 24, 2019 @ 8:09am 
hi wendigo i think i remember u from the old nwn forums
wendigo211 Jan 24, 2019 @ 8:32am 
Yeah, I was on the old BioWare fora. More the NWN2 ones than the NWN ones. I spent a lot of time in the scripting fora.
< >
Showing 1-15 of 16 comments
Per page: 1530 50

Date Posted: Jan 21, 2019 @ 3:35pm
Posts: 16