Aller au contenu

Photo

Scripting Help?


  • Veuillez vous connecter pour répondre
30 réponses à ce sujet

#26
Greyfort

Greyfort
  • Members
  • 234 messages
Ok your custom fuction at the top of script was causeign lock up I seporated it not that you need to.  You can paste the include file I made in place of your code at the top of script.  I also left you notes on what caused lock up.

/////////////////////////////////////////////
//
// created by Zaxtaj
// 12.??.2010
// ringclones_inc
//
/////////////////////////////////////////////



// makes clone preform actions
// see ringclones_inc for actions
void ActionsClone(object oClone=OBJECT_SELF);


//
void ActionsClone(object oClone=OBJECT_SELF)

{
ASSOCIATE_COMMAND_ATTACKNEAREST;

if (GetMaster(oClone) == OBJECT_INVALID)
{
SetPCLike(GetMaster(oClone), OBJECT_SELF);

ChangeToStandardFaction(oClone, STANDARD_FACTION_COMMONER);

ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));

DestroyObject(oClone, 0.0);
}

if (GetIsDead(oClone) == TRUE)
{
SetIsDestroyable(FALSE,TRUE,FALSE);

ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));

int nHealed = GetMaxHitPoints(oClone);

effect eRaise = EffectResurrection();

effect eHeal = EffectHeal(nHealed + 10);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, oClone);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oClone);

SetIsDestroyable(TRUE,FALSE,FALSE);

DestroyObject(oClone, 0.0);
}

ASSOCIATE_COMMAND_FOLLOWMASTER;
// The line belowe was causeing lock up
//AssignCommand(oClone, Actions());
}

I have no issues of lock up and the clones seem to do ok.  but if you rest you dont domonate them anylonger you may have to fiddle a little with them not sure if there hamburger for the grinder or you want them to pal around with PC but your script is fixed and works

#27
Greyfort

Greyfort
  • Members
  • 234 messages
paste this in your ac_ringofclones script:

/////////////////////////////////////////////
//
// created by Zaxtaj
// 12.??.2010
// ac_ringofclones
//
/////////////////////////////////////////////

#include "x2_inc_switches"
#include "ringclones_inc"

//////// include files here



/*


//
void Actions(object oClone=OBJECT_SELF)

{

ASSOCIATE_COMMAND_ATTACKNEAREST;

if (GetMaster(oClone) == OBJECT_INVALID)

{

SetPCLike(GetMaster(oClone), OBJECT_SELF);

ChangeToStandardFaction(oClone, STANDARD_FACTION_COMMONER);

ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));

DestroyObject(oClone, 0.0);

}

if (GetIsDead(oClone) == TRUE)

{

SetIsDestroyable(FALSE,TRUE,FALSE);

ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));

int nHealed = GetMaxHitPoints(oClone);

effect eRaise = EffectResurrection();

effect eHeal = EffectHeal(nHealed + 10);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, oClone);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oClone);

SetIsDestroyable(TRUE,FALSE,FALSE);

DestroyObject(oClone, 0.0);

}

ASSOCIATE_COMMAND_FOLLOWMASTER;

AssignCommand(oClone, 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()");
    // function in include
    AssignCommand(oClone, ActionsClone());
    //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

with the two scripts it works fine.  I'm sure you know this you can take what i have given you and make it one script:

/////////////////////////////////////////////
// one_script
// created by Zaxtaj
// 12.??.2010
//
// copy and paste whole script
// in your ac_ringofclones script
//
/////////////////////////////////////////////

#include "x2_inc_switches"


//////// include files here

//
// makes clone preform actions
void ActionsClone(object oClone=OBJECT_SELF);


//
void ActionsClone(object oClone=OBJECT_SELF)

{
ASSOCIATE_COMMAND_ATTACKNEAREST;

if (GetMaster(oClone) == OBJECT_INVALID)
{
SetPCLike(GetMaster(oClone), OBJECT_SELF);

ChangeToStandardFaction(oClone, STANDARD_FACTION_COMMONER);

ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));

DestroyObject(oClone, 0.0);
}

if (GetIsDead(oClone) == TRUE)
{
SetIsDestroyable(FALSE,TRUE,FALSE);

ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));

int nHealed = GetMaxHitPoints(oClone);

effect eRaise = EffectResurrection();

effect eHeal = EffectHeal(nHealed + 10);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, oClone);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oClone);

SetIsDestroyable(TRUE,FALSE,FALSE);

DestroyObject(oClone, 0.0);
}

ASSOCIATE_COMMAND_FOLLOWMASTER;
// The line belowe was causeing lock up
//AssignCommand(oClone, 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()");
    // function in include
    AssignCommand(oClone, ActionsClone());
    //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

I think thats everything forgive me if I forgot anything just send me a pm or post here

God Bless

#28
Zaxtaj

Zaxtaj
  • Members
  • 13 messages
Awesome thank you for all your hard work =)

#29
Zaxtaj

Zaxtaj
  • Members
  • 13 messages
Oh and about them no longer being dominated after resting the part of the script...

if (GetMaster(oClone) == OBJECT_INVALID)

{

SetPCLike(GetMaster(oClone), OBJECT_SELF);



ChangeToStandardFaction(oClone, STANDARD_FACTION_COMMONER);



ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));



DestroyObject(oClone, 0.0);

}

Would destroy them if they have no master or if in other words they are no longer dominated

#30
Zaxtaj

Zaxtaj
  • Members
  • 13 messages
It has been a year since I got help with this topic and I did find another way to do this code, This version makes specifically 4 clones only but it works very nicely

What this spell code does is it makes 4 clones and it removes all of your dominated accossicates by killing them this way if you want to summon more clones in case your down to like 2 you don't have to rest or wait until they die it will just summon 4 again and get rid of the 2 you have left.

I also set it up so the clones couldn't summon more clones by putting the spell id for the clone spell in he script, you will have to change that in the script if you don't want a million clones.

void Kill()
{
        effect eDead = EffectDamage(5000, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDead, GetAssociate(ASSOCIATE_TYPE_DOMINATED, GetMaster(OBJECT_SELF), 1));
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDead, GetAssociate(ASSOCIATE_TYPE_DOMINATED, GetMaster(OBJECT_SELF), 2));
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDead, GetAssociate(ASSOCIATE_TYPE_DOMINATED, GetMaster(OBJECT_SELF), 3));
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDead, GetAssociate(ASSOCIATE_TYPE_DOMINATED, GetMaster(OBJECT_SELF), 4));
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDead, GetAssociate(ASSOCIATE_TYPE_DOMINATED, GetMaster(OBJECT_SELF), 5));
}
void Actions()
{
    int InBattle;
    object oEnemy = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN);
    if (InBattle == 0)
    {
        if (GetIsObjectValid(oEnemy) )
        {
            ActionEquipMostDamagingMelee(oEnemy, FALSE);
            ActionAttack(oEnemy, FALSE);
            InBattle = 1;
        }
    }
//  Speel ID of the spell goes here!!!!!!
    if(GetSpellId() == 806)
    {
        if (GetIsObjectValid(oEnemy) )
        {
            ActionEquipMostDamagingMelee(oEnemy, FALSE);
            ActionAttack(oEnemy, FALSE);
            InBattle = 1;
        }
    }
    if (GetGoingToBeAttackedBy(oEnemy) == OBJECT_INVALID)
    {
        InBattle = 0;
    }
    if (GetMaster(OBJECT_SELF) == OBJECT_INVALID)
    {
        AssignCommand(OBJECT_SELF, PlayAnimation(ANIMATION_LOOPING_PAUSE_TIRED));
        int nDie = GetMaxHitPoints(OBJECT_SELF);
        effect eDead = EffectDamage(nDie + 500, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDead, OBJECT_SELF);
    }
    if (GetIsDead(OBJECT_SELF) == TRUE)
    {
        AssignCommand(OBJECT_SELF, RemoveFromParty(OBJECT_SELF));
        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);
    }
    DelayCommand(1.0, Actions());
}
void main()
{
    int KillClo;
    KillClo=0;
    int oCloneHandle;
    while(oCloneHandle<=4)
    {
        object oClone = CopyObject(OBJECT_SELF, GetLocation(OBJECT_SELF), OBJECT_INVALID, "Clone of "+GetName(OBJECT_SELF));
        SetLootable(oClone, FALSE);
        SetLocalObject(oClone, "Player", OBJECT_SELF);
        ChangeToStandardFaction(oClone, AI_LEVEL_VERY_HIGH);
        AssignCommand(OBJECT_SELF, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectCutsceneDominated(), oClone));
        AssignCommand(OBJECT_SELF, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectNegativeLevel(4, FALSE), oClone));
        ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oClone));
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE), OBJECT_SELF, 5.0);
        if (KillClo==0)
        {
            AssignCommand(oClone, Kill());
            KillClo++;
        }
        AssignCommand(OBJECT_SELF, AddToParty(OBJECT_SELF, oClone));
        ASSOCIATE_COMMAND_ATTACKNEAREST;
        AssignCommand(oClone, Actions());
        ASSOCIATE_COMMAND_TOGGLECASTING;
        oCloneHandle++;
    }
}

#31
Darth JoDa

Darth JoDa
  • Members
  • 5 messages
I'd like to know, how to advance eight hours while resting and where to put it?

I don't know if it would be enough to put it in module or if I have to put it in each single map, I create. And how do I get the game to advance 8 hours everytime the PC rests?