Scripting Help?
#1
Posté 05 décembre 2010 - 05:58
Then I started working on the script it goes like this...
void Actions()
{
// The actions the clones carry out once created.
// Attack nearest enemy
ASSOCIATE_COMMAND_ATTACKNEAREST;
// if there is no master destroy the clone
if (GetMaster(OBJECT_SELF) == OBJECT_INVALID)
{
SetPCLike(GetMaster(OBJECT_SELF), OBJECT_SELF);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_COMMONER);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
DestroyObject(OBJECT_SELF, 0.0);
}
// if the clone dies (so you can't loot it's items) revive then destroy it.
if (GetIsDead(OBJECT_SELF) == TRUE)
{
SetIsDestroyable(FALSE,TRUE,FALSE);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
int nHealed = GetMaxHitPoints(OBJECT_SELF);
effect eRaise = EffectResurrection();
effect eHeal = EffectHeal(nHealed + 10);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, OBJECT_SELF);
SetIsDestroyable(TRUE,FALSE,FALSE);
DestroyObject(OBJECT_SELF, 0.0);
}
// follow the master if there are no enemys, or if not dieing
ASSOCIATE_COMMAND_FOLLOWMASTER;
// repeat checks.
AssignCommand(OBJECT_SELF, Actions());
}
void main()
{
// checking if you have any dominated people in your party if you do no clones will be summoned.
int oCloneHandle;
if (GetAssociate(ASSOCIATE_TYPE_DOMINATED, OBJECT_SELF, 1) == OBJECT_INVALID)
{
oCloneHandle = 0;
} else {
// set clones to summon equal to the casters level
oCloneHandle = GetCasterLevel(OBJECT_SELF);
}
for (;oCloneHandle<=GetCasterLevel(OBJECT_SELF)-1; oCloneHandle++)
{
// this is the clone creation process
object oPC = OBJECT_SELF;
object oClone = CopyObject(oPC, GetLocation(OBJECT_SELF), OBJECT_INVALID, "Clone of "+GetName(oPC));
SetLootable(oClone, FALSE);
SetLocalObject(oClone, "Player", oPC);
ChangeToStandardFaction(oClone, AI_LEVEL_VERY_HIGH);
AssignCommand(oPC, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectCutsceneDominated(), oClone));
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oClone));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE), oPC, 5.0);
AssignCommand(oPC, AddToParty(oPC, oClone));
// tell clone to do it's checks
AssignCommand(oClone, Actions());
}
}
Now When I tested this as a script to make a set number of clones, it worked.
But then I thought it would be awesome to make it a spell!
so I changed the amount of clones to summon to equal your level, and I have all the information for the spell.
then I get the game started the spell is there but when I use it the script wont run, and I did check if I wrote the script name correctly in the spells.2da file.
I think that my script may need to be edited to become a spell can I have some help?
#2
Posté 05 décembre 2010 - 06:39
//::///////////////////////////////////////////////
//:: x0_s3_clonefist
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Create a fiery version of the character
to help them fight.
*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:://////////////////////////////////////////////
#include "nw_i0_generic"
void FakeHB()
{
effect eFlame = EffectVisualEffect(VFX_IMP_FLAME_M);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eFlame, OBJECT_SELF);
int nExplode = GetLocalInt(OBJECT_SELF, "X0_L_MYTIMERTOEXPLODE");
object oMaster = GetLocalObject(OBJECT_SELF, "X0_L_MYMASTER");
if (nExplode == 6)
{
ClearAllActions();
PlayVoiceChat(VOICE_CHAT_GOODBYE);
effect eFirePro = EffectDamageImmunityIncrease(DAMAGE_TYPE_FIRE, 100);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFirePro, oMaster, 3.5);
ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(OBJECT_SELF), METAMAGIC_ANY, TRUE, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
DestroyObject(OBJECT_SELF, 0.5);
SetCommandable(FALSE);
return;
}
else
{
object oEnemy = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, oMaster, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN);
// * attack my master's enemy
if (GetIsObjectValid(oEnemy) )
{
DetermineCombatRound(oEnemy);
}
ActionMoveToObject(GetLocalObject(OBJECT_SELF, "X0_L_MYMASTER"), TRUE);
SetLocalInt(OBJECT_SELF, "X0_L_MYTIMERTOEXPLODE", nExplode + 1);
DelayCommand(3.0, FakeHB());
}
}
void main()
{
object oPC = OBJECT_SELF;
object oFireGuy = CopyObject(oPC, GetLocation(OBJECT_SELF), OBJECT_INVALID, GetName(oPC) + "CLONEFROMFISTS");
object oItem = GetFirstItemInInventory(oFireGuy);
while (oItem != OBJECT_INVALID) {
SetDroppableFlag(oItem, FALSE);
SetItemCursedFlag(oItem, TRUE);
oItem = GetNextItemInInventory(oFireGuy);
}
SetLocalInt(oFireGuy, "X0_L_MYTIMERTOEXPLODE",1);
SetLocalObject(oFireGuy, "X0_L_MYMASTER", oPC);
ChangeToStandardFaction(oFireGuy, STANDARD_FACTION_COMMONER);
SetPCLike(oPC, oFireGuy);
DelayCommand(0.5, SetPlotFlag(oFireGuy, TRUE)); // * so items don't drop, I can destroy myself.
AssignCommand(oFireGuy, FakeHB());
effect eVis = EffectVisualEffect(VFX_DUR_ELEMENTAL_SHIELD);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, oFireGuy);
}
Funky
#3
Posté 05 décembre 2010 - 06:44
it makes one clone, if you attack civilians it attacks you, it only lasts 5 seconds then explodes, if fire resistance fails, and it has failed for me many times, you instantly die.
I made my clone script based off this one so I have seen it many, many times =o
Modifié par Zaxtaj, 05 décembre 2010 - 06:45 .
#4
Posté 05 décembre 2010 - 06:46
Modifié par Baragg, 05 décembre 2010 - 06:47 .
#5
Posté 05 décembre 2010 - 06:48
#6
Posté 05 décembre 2010 - 06:51
#7
Posté 05 décembre 2010 - 01:23
#8
Posté 05 décembre 2010 - 04:05
or ask for it to be moved?
#9
Posté 05 décembre 2010 - 07:38
Be well. Game on.
GM_ODA
#10
Posté 05 décembre 2010 - 08:01
#11
Posté 05 décembre 2010 - 09:11
Depends on how you're implementing it. You need 2da edits to add a new spell, but if you just want to overwrite an old spell, or make an item special power, you can do it all in script. What did you have in mind, exactly?Baragg wrote...
So they should change the call for oPC from OBJECT_SELF to GetLastSpellCaster();? I would never had thought of that thanks ehye_khandee. Learning is a wonderful thing.
Funky
#12
Posté 06 décembre 2010 - 04:47
#13
Posté 06 décembre 2010 - 04:53
ok I took your suggestion and tested it in game, and it still didn't work I think there might be more errors in my code.
#14
Posté 08 décembre 2010 - 04:28
Zaxtaj wrote...
@ehye_khandee
ok I took your suggestion and tested it in game, and it still didn't work I think there might be more errors in my code.
Sorry, did not mean to confuse - it was my brevity.
CopyObject is a function of scripting -
[url=type.object.html]object[/url] CopyObject( [url=type.object.html]object[/url] oSource, [url=type.location.html]location[/url] locLocation, [url=type.object.html]object[/url] oOwner = OBJECT_INVALID, [url=type.string.html]string[/url] sNewTag = "" );
a command such as
object oCopyOfPC = CopyObject(oPC,GetLocation(oPC),,"Copy_"+GetName(oPC));
_should_ work assuming object oPC is the PC you want to copy.
This iirc is all you'd need to copy a PC with all gear, though my memory is shakey on that blank bit between the two commas ... if the code does not work as shown, insert
[/code]
oCopyOfPc
[/code]
between the two commas. I'll follow the thread to see how your results turn out.
Be well. Game on.
GM_ODA
#15
Posté 09 décembre 2010 - 01:23
#include "x2_inc_switches"
void Actions()
{
// The actions the clones carry out once created.
// Attack nearest enemy
ASSOCIATE_COMMAND_ATTACKNEAREST;
// if there is no master destroy the clone
if (GetMaster(OBJECT_SELF) == OBJECT_INVALID)
{
SetPCLike(GetMaster(OBJECT_SELF), OBJECT_SELF);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_COMMONER);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
DestroyObject(OBJECT_SELF, 0.0);
}
// if the clone dies (so you can't loot it's items) revive then destroy it.
if (GetIsDead(OBJECT_SELF) == TRUE)
{
SetIsDestroyable(FALSE,TRUE,FALSE);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
int nHealed = GetMaxHitPoints(OBJECT_SELF);
effect eRaise = EffectResurrection();
effect eHeal = EffectHeal(nHealed + 10);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, OBJECT_SELF);
SetIsDestroyable(TRUE,FALSE,FALSE);
DestroyObject(OBJECT_SELF, 0.0);
}
// follow the master if there are no enemys, or if not dieing
ASSOCIATE_COMMAND_FOLLOWMASTER;
// repeat checks.
AssignCommand(OBJECT_SELF, Actions());
}
void main()
{// checking if you have any dominated people in your party if you do no clones will be summoned.
if(GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
object oPC = GetItemActivator();
object oClone;
int oCloneHandle;
if (GetAssociate(ASSOCIATE_TYPE_DOMINATED, oPC, 1) == OBJECT_INVALID)
{
oCloneHandle = 0;
}
else
{// set clones to summon equal to the casters level
oCloneHandle = GetCasterLevel(oPC);
}
for (;oCloneHandle
{// this is the clone creation process
oClone = CopyObject(oPC, GetLocation(oPC), OBJECT_INVALID, "Clone of "+GetName(oPC));
SetLootable(oClone, FALSE);
SetLocalObject(oClone, "Player", oPC);
ChangeToStandardFaction(oClone, AI_LEVEL_VERY_HIGH);
AssignCommand(oPC, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectCutsceneDominated(), oClone));
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oClone));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE), oPC, 5.0);
AssignCommand(oPC, AddToParty(oPC, oClone));
// tell clone to do it's checks
AssignCommand(oClone, Actions());
}
}
Modifié par Baragg, 09 décembre 2010 - 01:23 .
#16
Posté 09 décembre 2010 - 06:18
nope tried that and it still didn't work.
@Baragg
Ok I understand your script but I'm not sure on how to get an item to activate it do I make an item with the ability use unique power on self?
Also do I have to edit the code to specify a certain item?
or does this work with all items?
Modifié par Zaxtaj, 09 décembre 2010 - 06:31 .
#17
Posté 09 décembre 2010 - 10:15
There are two basic ways to execute script from a item. and probly many more.
Way 1)
//::///////////////////////////////////////////////
//:: Title : MODULE, onUseItem Event
//:: Author:
//:: Module:
//:: Date :
//:: Vers : 1.0
//:://////////////////////////////////////////////
void main() {
location lLoc = GetItemActivatedTargetLocation();
object oItem = GetItemActivated();
object oCaster = GetItemActivator();
object oTarget = GetItemActivatedTarget();
string oCasterName = GetName(oCaster);
string oTargetName = GetName(oTarget);
//=======================================================================
// Add Special Activate Script Here
//=======================================================================
// this would be your script from the forums
}
Way 2)
//:://////////////////////////////////////////////////////////////
//:: Title : mod_on_act
//:: Author: Greyfort
//:: Module: any who need
//:: Date : Aug 18, 2010
//:: Vers : 1.0
//:://////////////////////////////////////////////////////////////
//::///////////////////////////////////////////////
//:: Example XP2 OnActivate Script Script
//:: x2_mod_def_act
//:: © 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
Put into: OnItemActivate Event
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-07-16
//:://////////////////////////////////////////////
#include "x2_inc_switches"
void main()
{
object oItem = GetItemActivated();
// * Generic Item Script Execution Code
// * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module,
// * it will execute a script that has the same name as the item's tag
// * inside this script you can manage scripts for all events by checking against
// * GetUserDefinedItemEventNumber(). See x2_it_example.nss
if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ACTIVATE);
int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
if (nRet == X2_EXECUTE_SCRIPT_END)
{
return;
}
}
}
put this in your module event Activate Item
Open a new script pasete this in..
#include "x2_inc_switches"
void main()
{
int nEvent =GetUserDefinedItemEventNumber();
switch (nEvent)
{
case X2_ITEM_EVENT_ACTIVATE:
ExecuteScript("ac_"+GetTag(GetItemActivated()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_EQUIP:
ExecuteScript("eq_"+GetTag(GetPCItemLastEquipped()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_UNEQUIP:
ExecuteScript("ue_"+GetTag(GetPCItemLastUnequipped()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_ACQUIRE:
ExecuteScript("aq_"+GetTag(GetModuleItemAcquired()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_UNACQUIRE:
ExecuteScript("ua_"+GetTag(GetModuleItemLost()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_SPELLCAST_AT:
ExecuteScript("sp_"+GetTag(GetModuleItemLost()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_ONHITCAST:
ExecuteScript("on_"+GetTag(GetSpellCastItem()),
OBJECT_SELF); break;
}
}
save script the name of your item “itemtag”
Now open a new script, paste code from forums in
#include "x2_inc_switches"
void Actions()
{
// The actions the clones carry out once created.
// Attack nearest enemy
ASSOCIATE_COMMAND_ATTACKNEAREST;
// if there is no master destroy the clone
if (GetMaster(OBJECT_SELF) == OBJECT_INVALID)
{
SetPCLike(GetMaster(OBJECT_SELF), OBJECT_SELF);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_COMMONER);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
DestroyObject(OBJECT_SELF, 0.0);
}
// if the clone dies (so you can't loot it's items) revive then destroy it.
if (GetIsDead(OBJECT_SELF) == TRUE)
{
SetIsDestroyable(FALSE,TRUE,FALSE);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
int nHealed = GetMaxHitPoints(OBJECT_SELF);
effect eRaise = EffectResurrection();
effect eHeal = EffectHeal(nHealed + 10);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, OBJECT_SELF);
SetIsDestroyable(TRUE,FALSE,FALSE);
DestroyObject(OBJECT_SELF, 0.0);
}
// follow the master if there are no enemys, or if not dieing
ASSOCIATE_COMMAND_FOLLOWMASTER;
// repeat checks.
AssignCommand(OBJECT_SELF, Actions());
}
void main()
{// checking if you have any dominated people in your party if you do no clones will be summoned.
if(GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
object oPC = GetItemActivator();
object oClone;
int oCloneHandle;
if (GetAssociate(ASSOCIATE_TYPE_DOMINATED, oPC, 1) == OBJECT_INVALID)
{
oCloneHandle = 0;
}
else
{// set clones to summon equal to the casters level
oCloneHandle = GetCasterLevel(oPC);
}
for (;oCloneHandle
{// this is the clone creation process
oClone = CopyObject(oPC, GetLocation(oPC), OBJECT_INVALID, "Clone of "+GetName(oPC));
SetLootable(oClone, FALSE);
SetLocalObject(oClone, "Player", oPC);
ChangeToStandardFaction(oClone, AI_LEVEL_VERY_HIGH);
AssignCommand(oPC, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectCutsceneDominated(), oClone));
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oClone));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE), oPC, 5.0);
AssignCommand(oPC, AddToParty(oPC, oClone));
// tell clone to do it's checks
AssignCommand(oClone, Actions());
}
}
save script as “ac_tag of item”
be sure item as property unique power self , or unique power and nuber of time to unlimeted just for your testing yu can change that at any time
build mod checking script only, no need to build anything else and test. I prefer the 2nd way because you mod event act item can get rather large with way1). If i missed any thing let me know.
I almost forgot for way2) you need to gointo you module on load and make sure it looks like this:
// * Item Event Scripts: The game's default event scripts allow routing of all item related events
// * into a single file, based on the tag of that item. If an item's tag is "test", it will fire a
// * script called "test" when an item based event (equip, unequip, acquire, unacquire, activate,...)
// * is triggered. Check "x2_it_example.nss" for an example.
// * This feature is disabled by default.
SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
if (GetModuleSwitchValue (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
// * If Tagbased scripts are enabled, and you are running a Local Vault Server
// * you should use the line below to add a layer of security to your server, preventing
// * people to execute script you don't want them to. If you use the feature below,
// * all called item scrips will be the prefix + the Tag of the item you want to execute, up to a
// * maximum of 16 chars, instead of the pure tag of the object.
// * i.e. without the line below a user activating an item with the tag "test",
// * will result in the execution of a script called "test". If you uncomment the line below
// * the script called will be "1_test.nss"
// SetUserDefinedItemEventPrefix("1_");
}
Greyfort
Modifié par Greyfort, 09 décembre 2010 - 10:36 .
#18
Posté 09 décembre 2010 - 10:18
Forgive me I missed the Edit button on the previous post. To clarify what I'm trying to say is this:
When createing a item make a habit of nameing in resref ie:
I maked a Altimeter in tool set misc small, then in properties I make sure it can cast spell unique power self unlimeted, and check id for testing. then when naming it i start with the advanced tab and name in there ie "altim" knowing there is alimit to the size of the resref used in creating script and copy paste that name into tag, then make name "Altimeter".
This insures that when I use the way2) method of executing script for item I call the handler script "altim", the item code script "ac_altim". This way2) also allows you to create unique code for item aquierd "aq_altim" or item eqiped all mod event as seen in the handler code Example belowe:
// handler code
#include "x2_inc_switches"
void main()
{
int nEvent =GetUserDefinedItemEventNumber();
switch (nEvent)
{
case X2_ITEM_EVENT_ACTIVATE:
ExecuteScript("ac_"+GetTag(GetItemActivated()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_EQUIP:
ExecuteScript("eq_"+GetTag(GetPCItemLastEquipped()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_UNEQUIP:
ExecuteScript("ue_"+GetTag(GetPCItemLastUnequipped()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_ACQUIRE:
ExecuteScript("aq_"+GetTag(GetModuleItemAcquired()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_UNACQUIRE:
ExecuteScript("ua_"+GetTag(GetModuleItemLost()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_SPELLCAST_AT:
ExecuteScript("sp_"+GetTag(GetModuleItemLost()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_ONHITCAST:
ExecuteScript("on_"+GetTag(GetSpellCastItem()),
OBJECT_SELF); break;
}
}
once again any questions Drop me a PM if you need, I hope this helps.
Greyfort
Modifié par Greyfort, 09 décembre 2010 - 10:40 .
#19
Posté 09 décembre 2010 - 11:47
#20
Posté 10 décembre 2010 - 04:49
But thank you both for working hard and telling me how to activate my script with an item I have it all set up. =)
right now I'm starting to think that I should reset my script so it will only summon 5 clones instead of your level...
Also the edited version of my script made to work with items had a messed up for command... I'm going to test it again.
Modifié par Zaxtaj, 10 décembre 2010 - 04:59 .
#21
Posté 11 décembre 2010 - 12:08
#22
Posté 11 décembre 2010 - 02:53
but whenever it's time for the script to run it's like its just ignored.
Modifié par Zaxtaj, 11 décembre 2010 - 08:22 .
#23
Posté 11 décembre 2010 - 03:16
Along with the Tag of the item if you are useing tag based scripting.
#24
Posté 11 décembre 2010 - 08:26
#include "x2_inc_switches"
void Actions()
{
ASSOCIATE_COMMAND_ATTACKNEAREST;
if (GetMaster(OBJECT_SELF) == OBJECT_INVALID)
{
SetPCLike(GetMaster(OBJECT_SELF), OBJECT_SELF);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_COMMONER);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
DestroyObject(OBJECT_SELF, 0.0);
}
if (GetIsDead(OBJECT_SELF) == TRUE)
{
SetIsDestroyable(FALSE,TRUE,FALSE);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
int nHealed = GetMaxHitPoints(OBJECT_SELF);
effect eRaise = EffectResurrection();
effect eHeal = EffectHeal(nHealed + 10);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, OBJECT_SELF);
SetIsDestroyable(TRUE,FALSE,FALSE);
DestroyObject(OBJECT_SELF, 0.0);
}
ASSOCIATE_COMMAND_FOLLOWMASTER;
AssignCommand(OBJECT_SELF, Actions());
}
void main()
{
if(GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
object oPC = GetItemActivator();
object oClone;
int oCloneHandle;
if (GetAssociate(ASSOCIATE_TYPE_DOMINATED, oPC, 1) == OBJECT_INVALID)
{
oCloneHandle = 0;
}
else
{
oCloneHandle = GetCasterLevel(OBJECT_SELF);
}
for(;oCloneHandle<=GetCasterLevel(OBJECT_SELF)-1; oCloneHandle++)
{
oClone = CopyObject(oPC, GetLocation(oPC), OBJECT_INVALID, "Clone of "+GetName(oPC));
SetLootable(oClone, FALSE);
SetLocalObject(oClone, "Player", oPC);
ChangeToStandardFaction(oClone, AI_LEVEL_VERY_HIGH);
AssignCommand(oPC, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectCutsceneDominated(), oClone));
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oClone));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE), oPC, 5.0);
AssignCommand(oPC, AddToParty(oPC, oClone));
AssignCommand(oClone, Actions());
}
}
I am calling it through an item, which uses the ability unique power on self, The item is a ring(if this helps) the tag is RingofClones
#25
Posté 16 décembre 2010 - 12:27
EDITED TEXT:
Paste this in you ac_ringofclones script
/////////////////////////////////////////////
//
// ac_ringofclones
//
/////////////////////////////////////////////
#include "x2_inc_switches"
// include files here
void Actions()
{
ASSOCIATE_COMMAND_ATTACKNEAREST;
if (GetMaster(OBJECT_SELF) == OBJECT_INVALID)
{
SetPCLike(GetMaster(OBJECT_SELF), OBJECT_SELF);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_COMMONER);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
DestroyObject(OBJECT_SELF, 0.0);
}
if (GetIsDead(OBJECT_SELF) == TRUE)
{
SetIsDestroyable(FALSE,TRUE,FALSE);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
int nHealed = GetMaxHitPoints(OBJECT_SELF);
effect eRaise = EffectResurrection();
effect eHeal = EffectHeal(nHealed + 10);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, OBJECT_SELF);
SetIsDestroyable(TRUE,FALSE,FALSE);
DestroyObject(OBJECT_SELF, 0.0);
}
ASSOCIATE_COMMAND_FOLLOWMASTER;
AssignCommand(OBJECT_SELF, Actions());
}
///////////////////////////////////////////
void main()
{
if(GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
object oPC = GetItemActivator();
object oClone;
int oCloneHandle;
if (GetAssociate(ASSOCIATE_TYPE_DOMINATED, oPC, 1) == OBJECT_INVALID)
{
// eq=0
oCloneHandle = 0;
//DEBUGING TEXT
SendMessageToPC(oPC,"if oCloneHandle="+IntToString(oCloneHandle)+"");
}
else{
// eq= pc caster levels
oCloneHandle = GetCasterLevel(oPC);
//DEBUGING TEXT
SendMessageToPC(oPC,"else oCloneHandle="+IntToString(oCloneHandle)+"");
}
// oCloneHandle= (1-9) no for loop to execute
for(oCloneHandle; oCloneHandle<=GetCasterLevel(oPC)-1; oCloneHandle++)
{
//was OBJECT_INVALID
oClone = CopyObject(oPC, GetLocation(oPC), oPC, "Clone of "+GetName(oPC));
SetLootable(oClone, FALSE);
SetLocalObject(oClone, "Player", oPC);
ChangeToStandardFaction(oClone, AI_LEVEL_VERY_HIGH);
AssignCommand(oPC, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectCutsceneDominated(), oClone));
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oClone));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE), oPC, 5.0);
AssignCommand(oPC, AddToParty(oPC, oClone));
if(GetIsObjectValid(oClone)==TRUE)
{
//DEBUGING TEXT
SendMessageToPC(oPC,"clone"+IntToString(oCloneHandle)+" valid assign Actions()");
// This function is broken causes PC to freeze
//AssignCommand(oClone, Actions());
//DelayCommand (3.7,AssignCommand(oClone, Actions()));
}
//DEBUGING TEXT
SendMessageToPC(oPC,"for oCloneHandle="+IntToString(oCloneHandle)+"");
SendMessageToPC(oPC,"for GetCasterLevel(oPC)="+IntToString(GetCasterLevel(oPC))+"");
}//needed for statment
}//end of script
This script will create # of spell caster levels clones, I tested it with a level 40 bard which gave me a lvl 10 spell caster score so 10 clones be sure to read on lexicon about this function GetCasterLevel there are some bugs with it.
In your script you had OBJECT_SELF instead of oPC, and your AssignCommand(oClone, Actions()); function cause computer to crash. still looking into that. But you can create clones now
Modifié par Greyfort, 16 décembre 2010 - 01:54 .





Retour en haut






