Aller au contenu

Photo

summoning headaches


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

#1
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
can someone help me understand what i need to do to fix my script? im trying to make my item summon a rat but it summons on everysingle unique item use (they're multiplying!), he has no stamina and instead of having fireball, poison making and stealths, he has shield bash and precise striking

this is my entire module script :

           
            #include "wrappers_h"
            #include "events_h"
            #include "log_h"
            #include "utility_h"


#include "ability_h"
#include "combat_h"
#include "2da_data_h"

#include "sys_autoscale_h"
#include "talent_constants_h"
#include "spell_constants_h"
#include "sys_autolevelup_h"

            void main()
            {
                event ev = GetCurrentEvent();
                int nEvent = GetEventType(ev);
                Log_Events("",ev);
                switch (nEvent)
                {
                    case EVENT_TYPE_MODULE_START :
                    {
                        object oHero = GetHero();
                        object oBomb = GetObjectByTag("bomb_chu_call_v1");
                        UT_AddItemToInventory(R"bomb_chu_call_v1.uti",1);
                        break;
                    }
                    case EVENT_TYPE_MODULE_LOAD :
                    {
                        object oHero = GetHero();
                        object oBomb = GetObjectByTag("bomb_chu_call_v1");
                        UT_AddItemToInventory(R"bomb_chu_call_v1.uti",1);
                        break;
                    }
                    case EVENT_TYPE_UNIQUE_POWER :
                    {
                            int nAbility = GetEventInteger(ev, 0); // [Undocumented]
                            object oItem = GetEventObject(ev, 0); // [Undocumented]
                            object oCaster = GetEventObject(ev, 1); // [Undocumented]
                            object oTarget = GetEventObject(ev, 2); // [Undocumented]


                    object oRat = GetObjectByTag("bomb_chu_rat_v1");
                    resource rRat = R"bomb_chu_rat_v1.utc";
                    location  lSummonspot = GetLocation(oCaster);
                    object oSummon = CreateObject(OBJECT_TYPE_CREATURE,rRat,lSummonspot,"",FALSE);
                    location lLoc = GetFollowerWouldBeLocation(oSummon);
                    SetLocation(oSummon,lLoc);
                           
                            // -----------------------------------------------------------------
                            // Calculate the level to scale to
                            // -----------------------------------------------------------------
                            //float fScale = bMaster? 0.9 : 0.75;
                            int nLevel = FloatToInt(GetLevel(oCaster) * 0.75);



                            int nLevelToScale =  Max(1,nLevel);       //AS_GetCreatureLevelToScale(oSummon,Max(1,GetLevel(oCaster) -1)) + (bMaster?2:0);
                            int nclass = 0;

                            // -----------------------------------------------------------------
                            // Now, we scale the creature.
                            //   1. Force XP to 0, which triggers a stat reset in AS_Init.
                            //   2. For animate dead, force a class to be set on the target.
                            // -----------------------------------------------------------------
                            SetCreatureProperty(oSummon, PROPERTY_SIMPLE_EXPERIENCE, 0.0f);

                            // -----------------------------------------------------------------
                            // Force summon to 'Normal' rank and initialize them with an
                            // override class
                            // -----------------------------------------------------------------
                            SetCreatureRank(oSummon,CREATURE_RANK_CRITTER);
                            AS_InitCreature(oSummon, nLevelToScale, FALSE, nclass);

                               
                            // -----------------------------------------------------------------
                            // Activate the summon and add it to the active party.
                            // This has to happen AFTER scaling to avoid it being
                            // rescaled and messed with by Yaron's follower catchup code.
                            // -----------------------------------------------------------------
                            WR_SetObjectActive(oSummon, TRUE);
                            WR_SetFollowerState(oSummon, FOLLOWER_STATE_ACTIVE);

                            // -----------------------------------------------------------------
                            // Prevent it from accessing the levelup UI and gaining XP.
                            // -----------------------------------------------------------------
                            SetCanLevelUp(oSummon, FALSE);
                            SetLocalInt  (oSummon, CREATURE_REWARD_FLAGS, 1);

                            effect eSummon = Effect(EFFECT_TYPE_LOCK_CHARACTER);
                            ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eSummon, oSummon, 0.0, OBJECT_SELF, 0);


                            break;
                    }
                    default:
                    {break;}
                }
            }

Modifié par Baracuda6977, 08 février 2010 - 12:09 .


#2
anakin5

anakin5
  • Members
  • 258 messages
I don't know how EVENT_TYPE_UNIQUE_POWER works but I will try to answer. First did you make something with engineevents.GDA ?

If you don't want a rat for each unique power, I would say you have to test what item raised the event or what is the ability ID :
if (nAbility == your_id_here) at the start of your script

Then I think you don't have the right abilities because your creature is reinit in EVENT_TYPE_PARTY_MEMBER_HIRED.
You cannot affect abilities to party members by their model object except summoned pet. (but you didn't set SetLocalInt(oSummon, IS_SUMMONED_CREATURE,TRUE) so I assume you don't want a pet),
To affect abilities to a follower, you need to have these abilities spread between, CLA_base, RACE_base, Auto Level tables (AL*.gda) ...

Modifié par anakin5, 08 février 2010 - 12:47 .


#3
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
this is supposed to do something similar to a rangers summon wolf spell

so what am i supposed to do for that?



how would i find the nAbility?




#4
anakin5

anakin5
  • Members
  • 258 messages
You writed it, here is the ability, it is the ability ID used by your item :

case EVENT_TYPE_UNIQUE_POWER :
{
    int nAbility = GetEventInteger(ev, 0); // [Undocumented]



Then, if you want it to act like a summoned work, you have to add SetLocalInt(oSummon, IS_SUMMONED_CREATURE,TRUE); just after the CreateObject function.

#5
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
ability ID as in ITEM_ABILITY_UNIQUE_POWER_SINGLE_USE?



explain this like your talking to a mentally retarded person, maybe make a printout flipbook, with some coloring pages, and popouts and a maze at the end

#6
anakin5

anakin5
  • Members
  • 258 messages
Forget the ability id.

In your item editor, give your item a "Tag". For example, "my_item_tag".

Then, in the event :

case EVENT_TYPE_UNIQUE_POWER:
{
    object oItem = GetEventObject(ev, 0);

    if (GetTag(oItem) == "my_item_tag")
    {
       // your code here
    }
}

Keep your actual code but just add one line :

After
object oSummon = CreateObject(OBJECT_TYPE_CREATURE, rRat, lSummonspot, "", FALSE);

Add
SetLocalInt(oSummon, IS_SUMMONED_CREATURE, TRUE);


Then at the end :

Replace
effect eSummon = Effect(EFFECT_TYPE_LOCK_CHARACTER);                           ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eSummon, oSummon, 0.0, OBJECT_SELF, 0);

With
effect eSummon = EffectSummon(oCaster, oSummon);
Ability_ApplyUpkeepEffect(oCaster, nAbility, eSummon);
ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eSummon, oSummon, 0.0f, oCaster, nAbility);


#7
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
ok, now it fires properly, he doesnt resurect and doesnt have shield bash or precise striking



so he is like 90% done



although he still doesnt have the skill i want him to have, advice on how to change his skills/talents/spells?

#8
anakin5

anakin5
  • Members
  • 258 messages
Int the toolset, edit the template of your creature to give him talents/spells and skills. In your case it seems to be bomb_chu_rat_v1.utc

#9
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
i did that, that is why i am confused as to why it doesnt work

#10
anakin5

anakin5
  • Members
  • 258 messages
Hum, it works for me, I can't see where is the problem.



Did you try to print some log in every events involved in the process to know where abilities disappear ?

#11
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
i dont understand the log thing...

anyways, im making things more complicated but may get it to work, will post new code shortly,

how do you make a new string reference and associated ID?

edit:
got the skills to show up, although they are inexplicatly greyed out, stealth skill says only main character active at main camp, wtf?

at this point there is too much stuff to post in here exactly so, any idea what would cause this greying out?

Modifié par Baracuda6977, 09 février 2010 - 11:13 .


#12
anakin5

anakin5
  • Members
  • 258 messages
you mean the debuff icon is grey ?

You can set the skill icon in the ABI_*.xls file if you have not done it yet. And if the ID of your skill is too high (500 000 ?), the ability is considered as a debuff and works differently.

But I say is written here : http://social.biowar...hp/ABI_base.xls

Modifié par anakin5, 10 février 2010 - 06:16 .


#13
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
nothing is over 500000, i believe the only ID's i have are the custom one 321414, the given stealth one 10067 or something, 5 for the summons M2DA



i took a screenshot, but cant upload it as my online storage is currently plagued with hundreds of automatically queued story screenshots



the skills arent clickable, they can be seen in the quickslot but not clicked, and there is a grey square debuf saying unique item power, there is no portrait either, i feel i am just missing a few lines of code or something...

#14
anakin5

anakin5
  • Members
  • 258 messages
I need to know what is exactly in your ABI_* file and also what you have finally written in your script.

#15
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
int nAbility = GetEventInteger(ev, 0); // [Undocumented]

object oItem = GetEventObject(ev, 0); // [Undocumented]

object oCaster = GetEventObject(ev, 1); // [Undocumented]

object oTarget = GetEventObject(ev, 2); // [Undocumented]

int bMaster = FALSE;

if (GetTag(oItem) != "bomb_chu_call_v1")

break;

int nSummon = 5;

string sCol = (bMaster) ? "masterTemplate" : "template";

resource rTemplate = GetM2DAResource(TABLE_SUMMONS, sCol, nSummon);

int nAbility0 = GetM2DAInt(TABLE_SUMMONS, SUMMON_DATA_ABILITY_0, nSummon);

int nAbility1 = GetM2DAInt(TABLE_SUMMONS, SUMMON_DATA_ABILITY_1, nSummon);

int nPassiveAbi0 = GetM2DAInt(TABLE_SUMMONS, "PassiveAbi0" , nSummon);

int nPassiveAbi1 = GetM2DAInt(TABLE_SUMMONS, "PassiveAbi1" , nSummon);

object oRat = GetObjectByTag("bomb_chu_rat_v1");

resource rRat = R"bomb_chu_rat_v1.utc";

location lSummonspot = GetLocation(oCaster);

object oSummon = CreateObject(OBJECT_TYPE_CREATURE,rRat,lSummonspot,"",FALSE);

SetLocalInt(oSummon,IS_SUMMONED_CREATURE,TRUE);

location lLoc = GetFollowerWouldBeLocation(oSummon);

SetLocation(oSummon,lLoc);

//float fScale = bMaster? 0.9 : 0.75;

int nLevel = FloatToInt(GetLevel(oCaster) * 0.75);

int nLevelToScale = Max(1,nLevel); //AS_GetCreatureLevelToScale(oSummon,Max(1,GetLevel(oCaster) -1)) + (bMaster?2:0);

int nclass = 0;

SetCreatureProperty(oSummon, PROPERTY_SIMPLE_EXPERIENCE, 0.0f);

SetCreatureRank(oSummon,CREATURE_RANK_NORMAL);

AS_InitCreature(oSummon, nLevelToScale, FALSE, nclass);

WR_SetObjectActive(oSummon, TRUE);

WR_SetFollowerState(oSummon, FOLLOWER_STATE_ACTIVE);

//SetCanLevelUp(oSummon, FALSE);

// SetLocalInt (oSummon, CREATURE_REWARD_FLAGS, 1);

float fArmorBase = GetM2DAFloat(TABLE_SUMMONS, "ArmorBase", nSummon);

float fArmorBonus = GetM2DAFloat(TABLE_SUMMONS, "ArmorBonus", nSummon);

SetCreatureProperty(oSummon, PROPERTY_ATTRIBUTE_ARMOR, fArmorBase + (fArmorBonus * nLevelToScale));

float fDexBonus = GetM2DAFloat(TABLE_SUMMONS, "DexBonus", nSummon) * nLevelToScale;

UpdateCreatureProperty(oSummon, PROPERTY_ATTRIBUTE_DEXTERITY,fDexBonus, PROPERTY_VALUE_MODIFIER);

float fAPBonus = 1.0f + GetM2DAFloat(TABLE_SUMMONS, "APBonus", nSummon) * nLevelToScale;

UpdateCreatureProperty(oSummon, PROPERTY_ATTRIBUTE_AP, fAPBonus, PROPERTY_VALUE_MODIFIER);

AddAbilityEx(oSummon, nAbility0,0);

AddAbilityEx(oSummon, nAbility1,1);

effect eSummon = EffectSummon(oCaster, oSummon);

//Ability_ApplyUpkeepEffect(oCaster, nAbility, eSummon); there isnt any

ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eSummon, oSummon, 0.0f, oCaster, nAbility);

break;







that is my script (no i dont know the format for setting it off as a code). could you please be more specific on the ABI file, as it is absolutely massively long (basically fire bomb but changed ID to 321414, label to DETONATE, ability type to 1, prereqlev to 0, range to 1, speed to 1, spellscript to bomb_chu_bomb_script (my bombing script))

#16
anakin5

anakin5
  • Members
  • 258 messages
This script works for me :

[color="#99ccff"]int[/color] nAbility = GetEventInteger(ev, [color="#cc99ff"]0[/color]);
[color="#99ccff"]object[/color] oItem = GetEventObject(ev, [color="#cc99ff"]0[/color]);
[color="#99ccff"]object[/color] oCaster = GetEventObject(ev, [color="#cc99ff"]1[/color]);
[color="#99ccff"]object[/color] oTarget = GetEventObject(ev, [color="#cc99ff"]2[/color]);

[color="#99ccff"]if[/color] (GetTag(oItem) != [color="#3366ff"]"bomb_chu_call_v1"[/color])
  [color="#99ccff"]break[/color];

[color="#99ccff"]int[/color] nSummon = [color="#cc99ff"]5[/color];
[color="#99ccff"]location[/color] lSummonspot = GetLocation(oCaster);

[color="#99ccff"]int[/color] bMaster = [color="#99ccff"]FALSE[/color];
[color="#99ccff"]string[/color] sCol = (bMaster) ? [color="#3366ff"]"masterTemplate"[/color] : [color="#3366ff"]"template"[/color];

[color="#99ccff"]resource[/color] rTemplate = GetM2DAResource(TABLE_SUMMONS, sCol, nSummon);

[color="#99ccff"]int[/color] nAbility0 = GetM2DAInt(TABLE_SUMMONS, SUMMON_DATA_ABILITY_0, nSummon);
[color="#99ccff"]int[/color] nAbility1 = GetM2DAInt(TABLE_SUMMONS, SUMMON_DATA_ABILITY_1, nSummon);
[color="#99ccff"]int[/color] nPassiveAbi0 = GetM2DAInt(TABLE_SUMMONS, [color="#3366ff"]"PassiveAbi0"[/color] , nSummon);
[color="#99ccff"]int[/color] nPassiveAbi1 = GetM2DAInt(TABLE_SUMMONS, [color="#3366ff"]"PassiveAbi1"[/color] , nSummon);

[color="#99ccff"]object[/color] oSummon = CreateObject(OBJECT_TYPE_CREATURE, rTemplate, lSummonspot, "", [color="#99ccff"]FALSE[/color]);

[color="#99ccff"]if[/color] (IsObjectValid(oSummon))
{
  SetLocalInt(oSummon, IS_SUMMONED_CREATURE, [color="#99ccff"]TRUE[/color]);
  
  [color="#99ccff"]location[/color] lLoc = GetFollowerWouldBeLocation(oSummon);
  SetLocation(oSummon,lLoc); 
    
  [color="#99ccff"]int[/color] nLevel = FloatToInt(GetLevel(oCaster) * [color="#cc99ff"]0.75[/color]);
  [color="#99ccff"]int[/color] nLevelToScale = Max([color="#cc99ff"]1[/color], nLevel);
  [color="#99ccff"]int[/color] nclass = [color="#cc99ff"]0[/color];

  SetCreatureProperty(oSummon, PROPERTY_SIMPLE_EXPERIENCE, [color="#cc99ff"]0.0f[/color]);

  SetCreatureRank(oSummon, CREATURE_RANK_NORMAL);

  AS_InitCreature(oSummon, nLevelToScale, [color="#99ccff"]FALSE[/color], nclass);

  WR_SetObjectActive(oSummon, [color="#99ccff"]TRUE[/color]);
  WR_SetFollowerState(oSummon, FOLLOWER_STATE_ACTIVE);

  [color="#99cc00"]//SetCanLevelUp(oSummon, FALSE);[/color]
  [color="#99cc00"]// SetLocalInt (oSummon, CREATURE_REWARD_FLAGS, 1);[/color]

  [color="#99ccff"]float[/color] fArmorBase = GetM2DAFloat(TABLE_SUMMONS, [color="#3366ff"]"ArmorBase"[/color], nSummon);
  [color="#99ccff"]float[/color] fArmorBonus = GetM2DAFloat(TABLE_SUMMONS, [color="#3366ff"]"ArmorBonus"[/color], nSummon);
  SetCreatureProperty(oSummon, PROPERTY_ATTRIBUTE_ARMOR, fArmorBase + (fArmorBonus * nLevelToScale));

  [color="#99ccff"]float[/color] fDexBonus = GetM2DAFloat(TABLE_SUMMONS, [color="#3366ff"]"DexBonus"[/color], nSummon) * nLevelToScale;
  UpdateCreatureProperty(oSummon, PROPERTY_ATTRIBUTE_DEXTERITY,fDexBonus, PROPERTY_VALUE_MODIFIER);

  [color="#99ccff"]float[/color] fAPBonus = [color="#cc99ff"]1.0f[/color] + GetM2DAFloat(TABLE_SUMMONS, [color="#3366ff"]"APBonus"[/color], nSummon) * nLevelToScale;
  UpdateCreatureProperty(oSummon, PROPERTY_ATTRIBUTE_AP, fAPBonus, PROPERTY_VALUE_MODIFIER);
  
  [color="#99ccff"]if[/color] (nAbility0)
    AddAbilityEx(oSummon, nAbility0, [color="#cc99ff"]0[/color]);
  
  [color="#99ccff"]if[/color] (nAbility1)
    AddAbilityEx(oSummon, nAbility1, [color="#cc99ff"]1[/color]);
    
  effect eSummon1 = Effect(EFFECT_TYPE_LOCK_CHARACTER);
  ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eSummon1, oSummon, [color="#cc99ff"]0.0[/color], oCaster, [color="#cc99ff"]0[/color]);

  effect eSummon2 = EffectSummon(oCaster, oSummon);
  Ability_ApplyUpkeepEffect(oCaster, nAbility, eSummon2);
  ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eSummon2, oSummon, [color="#cc99ff"]0.0f[/color], oCaster, nAbility);
}

I don't know why you removed the upkeep effect while it is used to link the summoned creature to the caster.

ABi_* file has also targettype = 1, autotarget = 1, usetype = 2.

The new summon line in summon.xls is :

5 Rat bomb_chu_rat_v1.utc bomb_chu_rat_v1.utc **** **** **** **** **** **** **** ****


Did you export your bomb_chu_rat_v1.utc with the right talents ?

Modifié par anakin5, 11 février 2010 - 04:10 .


#17
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
ok, 99% bug free, his abilities are clickable, but he doesnt have enough stamina to use them, what line do i need to add stamina to it? or is it in the utc file?

#18
anakin5

anakin5
  • Members
  • 258 messages
hum, not sure but I think it is calculed with its willpower stat. So I thnik you have to increase his willpower, as you did with the Dex stat.

#19
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
hmm, i tried putting in the same thing for willpower as dex, replacing _DEXTERITY with _WILLPOWER but that didnt work, it looks like this is a modifier though, where would i find the base will power stat? is that calculated in the Init?

#20
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
i have searched everywhere i could, can ANYONE help me with where stamina is determined? in a summon