Author Topic: Double question  (Read 1470 times)

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Double question
« on: May 16, 2016, 12:11:59 pm »


               

Okay I got two questions


 


1) 


Is it possible to make a NPC stand still or cower while a hostile creature is around?


 


Basically I am recreating the episode "nightmares" from buffy the vampire slayer and just figured that it would not be very logical if the NPC is fighting when it is supposed to be scared.


 


2)


I have an spawn on conversation for this quest but I do not get the summon creature VFX for the summoning, it just spawns the spider.


 




#include "nw_i0_plotwizard"

#include "pqj_inc"

void main()

{

    // Set the variables

    SetLocalInt(GetPCSpeaker(), "p003state", 100);

// Get the PC who is in this conversation.

    object oPC = GetPCSpeaker();

 

    // Update the player's journal.

    AddPersistentJournalQuestEntry("p003", 1, oPC, FALSE);

 

    {

    effect eVFX;

    object oTarget;

    object oSpawn;

 

    // Spawn "zep_mspiderm016".

    oTarget = GetWaypointByTag("WP_ARACHNID");

    oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "zep_mspiderm016", GetLocation(oTarget));

 

    // Apply a visual effect.

    eVFX = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);

    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSpawn);

}

}

 

 



Can anyone tell me how to fix this?



 



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Double question
« Reply #1 on: May 16, 2016, 12:33:32 pm »


               


http://www.nwnlexico...etBehaviorState



This might allow you to make the npcs into cowards - as for making them immobile - you would have to paralyze them or Immobilize them with Cutscene paralysis / immobilize.


You could also repeatedly make the npc play the animation : ANIMATION_LOOPING_TALK_PLEADING   Which will kinda look like a begging animation (while standing)


 


As for your second question:


 


I don't think you need the braces around the effect/spawning bit.


However I think the reason for your effect not playing, is perception based.


 


When a creature is spawned, there is a small delay during which they are not perceived yet by the player.


If they are not perceived, how will the player be able to see any effects playing on the npc, if the npc itself is invisible at this time.


 


To solve this:


Play the vfx at the location of the npc instead. This way, your perception of the vfx is not tied to the creature itself.


ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVFX, GetLocation(oSpawn));


               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Double question
« Reply #2 on: May 16, 2016, 01:00:41 pm »


               


 


This might allow you to make the npcs into cowards - as for making them immobile - you would have to paralyze them or Immobilize them with Cutscene paralysis / immobilize.


You could also repeatedly make the npc play the animation : ANIMATION_LOOPING_TALK_PLEADING   Which will kinda look like a begging animation (while standing)


 


As for your second question:


 


I don't think you need the braces around the effect/spawning bit.


However I think the reason for your effect not playing, is perception based.


 


When a creature is spawned, there is a small delay during which they are not perceived yet by the player.


If they are not perceived, how will the player be able to see any effects playing on the npc, if the npc itself is invisible at this time.


 


To solve this:


Play the vfx at the location of the npc instead. This way, your perception of the vfx is not tied to the creature itself.



ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVFX, GetLocation(oSpawn));



thanks bu I just fixed the second question on my own but thanks anyway and yay will check it out thanks! '<img'>


               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Double question
« Reply #3 on: May 16, 2016, 01:17:17 pm »


               

okay am reading this but I am a bit confused by the link you send me Baaleos....



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Double question
« Reply #4 on: May 16, 2016, 01:29:14 pm »


               

at the moment made my own little way around it, making the NPC paralyzed for the duration of the fight (paralyzed of fear mwuahaha) 



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Double question
« Reply #5 on: May 16, 2016, 01:34:25 pm »


               

Sorry 



            NW_FLAG_BEHAVIOR_HERBIVORE
         
            0x00000008
         
            

Will never attack. Will alway flee.


            

 


            

 


         
      

 


 


 


This behavior state when used on an NPC will make them flee, but never attack.


Eg: Like rabbits, or Deer etc


Basically, you could use it to ensure that the NPC never attempts to strike the creature/monster.



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Double question
« Reply #6 on: May 16, 2016, 01:50:30 pm »


               

okay now it worked at first but then I added the persistence of the quest and then summoning of the hostile creature and now it does not work anymore.


 




#include "nw_i0_plotwizard"

#include "pqj_inc"

void main()

{

    // Set the variables

    SetLocalInt(GetPCSpeaker(), "p003state", 100);

// Get the PC who is in this conversation.

    object oPC = GetPCSpeaker();

 

    // Update the player's journal.

    AddPersistentJournalQuestEntry("p003", 1, oPC, FALSE);

 

 

effect eEffect;

    object oSelf = OBJECT_SELF;

    object oTarget;

    object oSpawn;

    effect eVFX;

 

 

    // Apply an effect.

    eEffect = EffectParalyze();

    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oSelf, 50.0);

 

    // Spawn "zep_mspiderm016".

    eVFX = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1);

    oTarget = GetWaypointByTag("WP_ARACHNID");

    oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "zep_mspiderm016", GetLocation(oTarget));

    DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSpawn));

 

}

 

 



 



Can anyone help me with this?



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Double question
« Reply #7 on: May 16, 2016, 01:51:28 pm »


               


Sorry 


NW_FLAG_BEHAVIOR_HERBIVORE 0x00000008

Will never attack. Will alway flee.


 


 


 


 


 


This behavior state when used on an NPC will make them flee, but never attack.


Eg: Like rabbits, or Deer etc


Basically, you could use it to ensure that the NPC never attempts to strike the creature/monster.




great will check this out '<img'> 


               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Double question
« Reply #8 on: May 16, 2016, 01:57:21 pm »


               

okay it worked like a charm! Now I just need to get the NPC to return to its original spot after the fight but I think a Waypoint could easily fix that '<img'> 



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Double question
« Reply #9 on: May 16, 2016, 03:09:41 pm »


               

If it is dynamic at all - you can also store the location information on the NPC itself.


 


Eg:


SetLocalLocation(oNPC,"START_LOCATION",lLoc);


 


 


You could have the creature run a script on Spawn to capture the location: lLoc


 


 


Eg:


 


onSpawn:


location lLoc = GetLocation(OBJECT_SELF);


SetLocalLocation(OBJECT_SELF,"Start_Location",lLoc);


 


 


Then when you need him to return to the start:


 


 


location lLoc = GetLocalLocation(oNPC,"Start_Location");


AssignCommand(oNPC,JumpToLocation(lLoc));  < - To teleport him there, or you can have him walk if you want.


               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Double question
« Reply #10 on: May 16, 2016, 10:37:52 pm »


               A POST waypoint will do that automatically.


Fleeing combat trumps walkwaypoints, so NPC should only return when threat removed.
               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Double question
« Reply #11 on: May 17, 2016, 06:29:58 am »


               


A POST waypoint will do that automatically.


Fleeing combat trumps walkwaypoints, so NPC should only return when threat removed.




yeah I tested that and it works like a charm! Thanks everyone for your help, you guys are the best! '<img'>:D