Npc clone don't use magic. need help

need some help
Hi all.
Thank you in advance!
I hope someone can help me improve what I have.
otherwise I’ll just post version 2 and that’s it.(reserved solution)

my question1: why my clone don’t use magic?
how to fix that.

here link1

here script1

void main()
{

object oUser = GetFirstPC();
 location lTarget = GetLocation(OBJECT_SELF);
effect eSiii =EffectSummonCopy(oUser,  VFX_FNF_GAS_EXPLOSION_EVIL, 0.0f, "co_pyxcharacter82x", 110, "1");
 
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSiii, lTarget, 1800.0);




	
}





i tried use
SpecialTacticsRanged(object)

TalentRangedAttackers

but it don’t help me

also i dont know which script need use(why need script (i just write number i mean 1)
syntax
effect EffectSummonCopy(object oSource, int nVisualEffectId=VFX_NONE, float fDelaySeconds=0.0f, string sNewTag=“”, int nNewHP=0, string sScript=“”);

i write
EffectSummonCopy(oUser, VFX_FNF_GAS_EXPLOSION_EVIL, 0.0f, “co_pyxcharacter82x”, 110, “1”);

also
i have another script(but another script have diffrent problem[ican’t add hencman becase. if do that. i can’t remove hencman\ i get strange bug
it’s a little offensive, I’m trying to make it so that clones can be manipulated like a summoned creature
(not a familiar, not a party member) ] ,

but I’ll save it for another occasion )

here link2

something like this it should look like
only I destroy them (clones)/becase it demo/
Thank you in advance!

1 Like

I don’t think I can help you, but I thought I could at least try. In the second video it looks like you succeed with them casting spells, but there you can’t add them as henchmen, since then you can’t then remove them, correct?
Maybe that could be because they have the same scripts attached to them as your main character (and I don’t actually know which scripts are attached to the main character and what they look like, since you can’t see that in the toolset) and therefore are not considered henchmen by the game, and therefore the bug occurs?

Why in your first video the summoned copy won’t fire spells, I have no idea.

EDIT: I found the following text in this guide http://www.dethguild.com/wp-content/uploads/files/nwn/pdf/nwn2_toolset_guide_iii.pdf

“EffectSummonCopy: This creates a duplicate copy of the existing creatureoSource that appearsfDelaySeconds seconds after the visualeffect nVisualEffectId is played. If nNewTag is a non-nullstring, new creature is assigned that as it’s tag; otherwise ituses the same tag as the original. If nNewHP is non-zero,the copy will be given that many hit points; otherwise itgains the starting hit point total of the original. The sScriptcan be the name of a script to run by the copy.”

Maybe if you use the name of a new script you create in the *EffectSummonCopy(oUser, VFX_FNF_GAS_EXPLOSION_EVIL, 0.0f, “co_pyxcharacter82x”, 110, “ newscript ”);* and in that script command the copy to cast spells it would do that? Just a thought…

Hi andgalf
I am currently testing these 2 scenarios

I just didn’t post code 2 because
I am trying to debug 1 script and want to focus on it.(i add this later)

unfortunately my clone completely ignores
what I write to him in this script
probably the call script can block some commands
I probably need to change something.

I also heard that summoned creatures cannot use magic, is that true?
or maybe you need to write a tactic for my clone somehow
or something else
just don’t know how.

Thank you for your answer!
I will continue to search further

even if I just call nps (slightly different script)
. NPC does not use spells (even memorized)

I think it’s done differently
otherwise there would be no such wrong error
can anyone know how to create a tactic for a monster / npc?

In my third module I used a script where I copied one of the companions. Looking at that script now I see that I used the function CopyObject. Maybe you could try that instead of EffectSummonCopyObject?
And then maybe add the clone to the party?

EDIT: Something like this perhaps?

void AddCloneToRoster()
{
	
object oClone = GetObjectByTag("copyofPC");

int bResult = AddRosterMemberByCharacter("copyofPC", oClone);

//FROM: ga_roster_selectable
SetIsRosterMemberSelectable("copyofPC", 1);

//FROM: ga_roster_party_add
object oPC = GetFirstPC();
AddRosterMemberToParty("copyofPC", oPC);



}


void main()
{

object oPC = GetFirstPC();
	
location lCopy = GetLocation(oPC);

CopyObject(oPC,lCopy,OBJECT_INVALID,"copyofPC");

DelayCommand(0.2, AddCloneToRoster());


}

EDIT2: I tested it, (though not from a custom spell like you have in your scenario) but at least on my end the PC is copied and throws spells at the enemies. Maybe I’ll try removing him as well and see if I get a bug like you did.

EDIT3: I tried removing the clone afterwards and that seemed to work too. So everything should be fine now.

If this doesn’t work for you still, my guess is that I think @kevL_s, @Lance_Botelle or @travus could help you.

2 Likes
// Create a Summon Copy effect.  The creature is copied and placed into the
// caller's party/faction.  Plot, immortal, and DM creatures cannot be be copied.
// All spells per day/memorized spells are cleared.
// - oSource: Source creature to be copied.
// - nVisualEffectId: VFX_*
// - fDelaySeconds: There can be delay between the visual effect being played, and the
//   creature being added to the area.
// - sNewTag: If you are copying a creature (nCopyCreature = TRUE), you can assign it a new tag, otherwise
//   it is assigned the same tag as the source creature.  This argument has no effect for a regular, non-copy
//   summon.
// - nNewHP: The starting HP of the creature you're copying.  Has no effect if you're not copying a creature.
//   If less than or equal to 0, then the copy will have as many HP as the target.
// - sScript: name of a script to be executed by the new copy; this allows you to buff the copy as it appears.
effect EffectSummonCopy(object oSource, int nVisualEffectId=VFX_NONE, float fDelaySeconds=0.0f, string sNewTag="", int nNewHP=0, string sScript="");
note: All spells per day/memorized spells are cleared.

 

X2_SPECIAL_COMBAT_AI_SCRIPT

*intermediate/advanced knowledge of scripting and game-mechanics req’d

2 Likes

That’s amazing ! It reminds me of Dishonoured 2 where you can send in a copy of yourself to do battle and distract people while you watch from elsewhere.

1 Like

Hehe. Yes, quite. One has to modify my script a little bit to accomodate for when it is run though. I had mine as a trigger script on the ground. So the actual code I used when testing looks like this:

void AddCloneToRoster()
{
	
object oClone = GetObjectByTag("copyofPC");

int bResult = AddRosterMemberByCharacter("copyofPC", oClone);

//FROM: ga_roster_selectable
SetIsRosterMemberSelectable("copyofPC", 1);

//FROM: ga_roster_party_add
object oPC = GetFirstPC();
AddRosterMemberToParty("copyofPC", oPC);



}


void main()
{

object oEnter = GetEnteringObject();

object oPC = GetFirstPC();

if(!GetIsPC(oEnter)) return;

if(!GetLocalInt(OBJECT_SELF,"Done"))
{

SetLocalInt(OBJECT_SELF,"Done",1);
	
location lCopy = GetLocation(oPC);

CopyObject(oPC,lCopy,OBJECT_INVALID,"copyofPC");

DelayCommand(0.2, AddCloneToRoster());
}

}

Hi all.

method number one:

oh no/ i mean / is there any way to change this/
is there any way to change this?
because the first method, although it has drawbacks, has a big plus. you can dismiss summoned creature.(unsummon the creature.)
real problem: the creature lose his spells.

question:how to force a creature to use magic.
*how to use this scripts? i mean 1 *
EffectSummonCopy(oUser, VFX_FNF_GAS_EXPLOSION_EVIL, 0.0f, “co_pyxcharacter82x”, 110, “ 1 ”);

(i tried but creature don’t want use use magic.
even fake spell.if think i made some errors)

=======================================================

Tsongo
(inspired by the mirror from Neverwinter Nights: Hordes of the Underdark game:
it made the hero’s evil double)

=======================================================

method number two:
maybe i will try our idea(but im think using ga_roster_party

i have 2 options
Option 1 (summons a copy of yourself, you can summon several copies, they cannot be given commands, but they follow the player and then are destroyed)

but my updated way does the same
only for this i need only 1 new effect(Dominate person)
Option 2 (summons a copy of yourself, you can only summon one copy, because each new copy removes the effect of control from the previous one and becomes aggressive (I like it, maybe I’ll leave it this way / the problem cannot be recalled)

maybe problem: i cant unsummon the creature.|i can only destroy
question:where i can get unsummon creature fucntion?
object. maybe bad or good/or maybe need write some script.
I could publish and so
but I want to improve a little.

=======================================================
my ideas:
1)i have spell = lol =it’s just destroy object and it work perfect.
but I think you need to send something here on interests
2) where i can get unsummon creature fucntion?
i need just button (unsummon the creature.)
3)leave as is
4)blow up clone and player if he so poweful /when time is come.
5)or just summon bad copies pc.

any ideas ?
my script 2 (anyway
I will finish everything and publish soon
you can use

#include "x2_inc_spellhook" 
void main(){
object oUser = GetFirstPC();
location lTarget = GetSpellTargetLocation();

 
object oCopy = CopyObject(oUser,lTarget,OBJECT_INVALID,"copy");
effect eDom = EffectDominated();
effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1);
effect eVis2 = EffectVisualEffect(VFX_FNF_FIREBALL);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,   eVis, oCopy, 2.0f);
		
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,  eDom, oCopy, 20.8f);

DelayCommand(19.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY,   eVis2, oCopy, 2.0f));	
	 
DelayCommand(21.0, DestroyObject( oCopy));				  

}

Hello everybody.
Thanks everyone for the answers.

this is exactly the whole script
Almost finished
real question:
but need help (i want do spell more comfortable for players)
i want if pc used light spell
(anywhere)
so that
the copy was destroyed.
unfortunately my check doesn’t work for some reason
*any ideas?*also i tried #include “x2_inc_switches” but,dosn’t help.
Thank you in advance!
code

#include "x2_inc_spellhook" 
#include "nw_i0_spells"
#include "x2_inc_switches"
void main(){
//new
int nSpell     =  GetSpellId ( ) ; 
int nSpellDC   =  GetSpellSaveDC ( ) ; 
int nCastLevel =  GetCasterLevel ( OBJECT_SELF ) ; 


object oUser = GetFirstPC();
location lTarget = GetSpellTargetLocation();


object oCopy = CopyObject(oUser,lTarget,OBJECT_SELF,"copy");
effect eDom = EffectDominated();
effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
effect eVis2 = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
		
	  
AssignCommand(oCopy,SetIsDestroyable(TRUE,FALSE,FALSE));
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eVis, GetSpellTargetLocation(), 3.0f);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,  eDom, oCopy, 40.7f);    
DelayCommand(40.6, ApplyEffectToObject(DURATION_TYPE_TEMPORARY,   eVis2, oCopy, 2.0f));	

//SPELL_LIGHT check
if(GetLastSpellCaster()== oUser){
if(GetLastSpell() == SPELL_LIGHT){


ApplyEffectToObject(DURATION_TYPE_TEMPORARY,   eVis2, oCopy, 1.0f);
DelayCommand(0.2, RemoveSpecificEffect (EFFECT_TYPE_DOMINATED ,oCopy )) ;
DelayCommand(0.3, DestroyObject( oCopy));	
}	  
}

else
DelayCommand(40.8, RemoveSpecificEffect (EFFECT_TYPE_DOMINATED ,oCopy )) ;	 
DelayCommand(40.9, DestroyObject( oCopy));				  
DelayCommand(41.0,SetModuleOverrideSpellScriptFinished ());
}

little question

it’s not necessary, it’s just not clear why ???
Anyway thanks for answers.
Thank you in advance!
the code seems to be correct, in general it is strange
I tried but for some reason it does not work for me (I use it as a spell)
in other people’s scripts, I do not always understand.

I’m sorry, but I don’t understand the question. Maybe you could rephrase the question? Depending on where you call my version of the script one might have to modify it. The second version of my script is called when walking through a trigger.
If you call the script from a conversation you don’t need the GetEnteringObject part.

Hi andgalf .

i working on clone spell
(i want do spell more comfortable for players)
my idea:if pc used light spell(anywhere),need destroy object.
my actions:i want stop my script (i try use verification)
unfortunately my verification doesn’t work for some reason

general question: why my verification doesn’t work?
it’s quote in my script post above

//SPELL_LIGHT check
if(GetLastSpellCaster()== oUser){
if(GetLastSpell() == SPELL_LIGHT){


ApplyEffectToObject(DURATION_TYPE_TEMPORARY,   eVis2, oCopy, 1.0f);
DelayCommand(0.2, RemoveSpecificEffect (EFFECT_TYPE_DOMINATED ,oCopy )) ;
DelayCommand(0.3, DestroyObject( oCopy));	
}	  
}

Thank you in advance!

(how to fix it?)
1)i check who made the spell
2)i check if the spell was light
why it’s not work ??
Who knows how to do it?
Thank you in advance!

small question:

Thank you in advance!
i want learn/or try different script
I don’t understand why your script doesn’t work
when i cast spell.(i try summon your script using spell)

This is above my knowledge. However, I had a custom spellhook script in my second module (but I didn’t write it, Aqvilinus did). Looking at that though…I don’t know but…maybe you could try something like this in your script:

if(GetLastSpell() == (nSpell == SPELL_LIGHT))

I think you might need the Spell ID in some way to determine what spell was cast.

I don’t know really… Someone with a deeper knowledge of scripting needs to answer this, I think.

EDIT: Looking now at a conversation from two years ago I had with Aqvilinus when he helped me a lot with my scripts…Maybe this is almost the same code as you have but…well, perhaps you could test it, I don’t know. I am really the wrong person to ask about this:

#include "x2_inc_spellhook" 
#include "nw_i0_spells"
#include "x2_inc_switches"
void main()
{
//new
int nSpell     =  GetSpellId ( ) ; 
int nSpellDC   =  GetSpellSaveDC ( ) ; 
int nCastLevel =  GetCasterLevel ( OBJECT_SELF ) ; 


object oUser = GetFirstPC();
location lTarget = GetSpellTargetLocation();


object oCopy = CopyObject(oUser,lTarget,OBJECT_SELF,"copy");
effect eDom = EffectDominated();
effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
effect eVis2 = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
		
	  
AssignCommand(oCopy,SetIsDestroyable(TRUE,FALSE,FALSE));
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eVis, GetSpellTargetLocation(), 3.0f);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,  eDom, oCopy, 40.7f);    
DelayCommand(40.6, ApplyEffectToObject(DURATION_TYPE_TEMPORARY,   eVis2, oCopy, 2.0f));	


int iSpell = GetLastSpell();
object oCaster = GetLastSpellCaster();


	//SPELL_LIGHT check
	if(oCaster == oUser)
	{

	if (iSpell == SPELL_LIGHT)
	
		
		{


		ApplyEffectToObject(DURATION_TYPE_TEMPORARY,   eVis2, oCopy, 1.0f);
		DelayCommand(0.2, RemoveSpecificEffect (EFFECT_TYPE_DOMINATED ,oCopy )) ;
		DelayCommand(0.3, DestroyObject( oCopy));	
		}	  
	}

	else
	DelayCommand(40.8, RemoveSpecificEffect (EFFECT_TYPE_DOMINATED ,oCopy )) ;	 
	DelayCommand(40.9, DestroyObject( oCopy));				  
	DelayCommand(41.0,SetModuleOverrideSpellScriptFinished ());
}

Sorry, that I can’t help you any better. Believe me, I’m trying the best I can.

EDIT: You said this:

Maybe you should change this? (change OBJECT_SELF to oUser):

object oCopy = CopyObject(oUser,lTarget,oUser,"copy");

Since I don’t know how to test your spell (I’ve dealt very little with custom spells, so I have very little knowledge of that) I thought that maybe you could do some debugging in your code to see what it is that doesn’t work. Like this, for example:

#include "x2_inc_spellhook" 
#include "nw_i0_spells"
#include "x2_inc_switches"

void main()
{
int nSpell     =  GetSpellId ( ) ; 
int nSpellDC   =  GetSpellSaveDC ( ) ; 
int nCastLevel =  GetCasterLevel ( OBJECT_SELF ) ; 


object oUser = GetFirstPC();
location lTarget = GetSpellTargetLocation();


object oCopy = CopyObject(oUser,lTarget,OBJECT_SELF,"copy");
effect eDom = EffectDominated();
effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
effect eVis2 = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
		
	  
AssignCommand(oCopy,SetIsDestroyable(TRUE,FALSE,FALSE));
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eVis, GetSpellTargetLocation(), 3.0f);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,  eDom, oCopy, 40.7f);    
DelayCommand(40.6, ApplyEffectToObject(DURATION_TYPE_TEMPORARY,   eVis2, oCopy, 2.0f));	

//SPELL_LIGHT check
	if(GetLastSpellCaster()== oUser)
	{
		SendMessageToPC(oUser,"Last spell caster is the player");
		
		if(GetLastSpell() == SPELL_LIGHT)
		{
	
		SendMessageToPC(oUser,"The spell cast is a light spell");
			
		ApplyEffectToObject(DURATION_TYPE_TEMPORARY,   eVis2, oCopy, 1.0f);
		SendMessageToPC(oUser,"Effect Summon Monster run");
		DelayCommand(0.2, RemoveSpecificEffect (EFFECT_TYPE_DOMINATED ,oCopy )) ;
		SendMessageToPC(oUser,"Dominated Effect removed from clone");
		DelayCommand(0.3, DestroyObject( oCopy));
		SendMessageToPC(oUser,"Clone destroyed");	
		}	  
	}

	else
	DelayCommand(40.8, RemoveSpecificEffect (EFFECT_TYPE_DOMINATED ,oCopy )) ;	 
	DelayCommand(40.9, DestroyObject( oCopy));				  
	DelayCommand(41.0,SetModuleOverrideSpellScriptFinished ());
}

I also see in your code that you have a lot of different delays. That may cause problems if you’re not careful. For instance, why is there such a long delay for the clone to be dominated? You have a 40 sec delay for that, if I read your code correctly.

EDIT: If you like, to make the community be able to help you even better, you could perhaps post a test module here with an area and all your scripts (like in your videos) and triggers for this situation. That way we could load it into the toolset and better help you buy doing thorough testing ourselves. When I’ve had complicated problems I’ve done it like that, and that has really helped me when others have been able to take a look in the toolset exactly how I’ve set up things.

2 Likes

Hello andgalf

if you want to help me understand what’s wrong

Those who are interested in looking for an error, like me
you need to download files
archive.7z (36.1 KB)

instruction
1)download
2)add files to override
3)create new character
4)(level up to 2 )get new spell by level 2
5)try use spell

(I don’t even know, something is clearly wrong, because I’ve already tried more than 5 different ariants and almost always one mistake)
this is how it looks:
hecmen version \and sometimes controll effect version
( https://youtu.be/A-dHi5H77Zc )

**yep!Power! unlimited delay! **
it simple
1var controll effect version
1)i create clone
2)i add controll effect to clone
3)i remove controll effect by clone
3)i describe later
4)i describe later

2var hecmen version
1)i create clone
2)add hecmen
3)remove hecmen (dosen’t works)
4)i destroy clone (and get error )

real problem :the point is that my spell must execute its script
but i need a check
1) if there is no spell on the clone = do nothing
2) if there is
(and if I cast a spell on a temporary object (clone))
it should intercept this event and exhaust

here is my fallback solution: i will improve it a little and publish it
1 version with 1 challenge (only 1 copy can be summoned and controlled)
2 version with multiple summons (cannot be controlled, but 2 copies can be summoned)
2 video version
( https://youtu.be/OwI-Uyikv7k )

(I will release my fallback solution soon //
but I want to know what’s wrong)

I checked my bugged version and found that the bug is removed on reboot.
but i’m not sure about that
(how can this be verified?)
( https://youtu.be/A-dHi5H77Zc )
archive.7z (36.1 KB)

I thought and decided that all the same

I use my backup solution
1 version
with the effect of control (can be controlled as a henchman)
(only 1 copy / or if you summon another one then 1 will become hostile)

2 version with the effect of following (but cannot be controlled)
( https://youtu.be/OwI-Uyikv7k )
(2 or more can be summoned / but I think this is a bit too much)
there is only one problem to them (cannot be instantly revoked)
but i am working on it

I’ll work with the effects a bit.
and decide how long the call will last
approximate time (1-2 min)
this will be a 7-9 level spell for magicians / sorcerers
I also have another surprise (although I’m not very sure if this can be used)

I think I’ll leave it like this for now (I think I’ll try to look for a mistake myself)
because finding this error already takes a long time
(in the buggy version I’m not sure / I think it’s better not to use it for now)

I will post content soon
I think the topic is closed

Thank you all for your answers and advice.
Thanks again to everyone.