baracuda6977 Posted January 31, 2010 Share Posted January 31, 2010 i have been working on a project for the past week and have succeded in making a stun grenade with a custom icon, sells from a built in merchant and stuns w/o damaging there is but one problem, it will only stun my teammatesi think the error is related to the GetObjectsInShape function i have in the following void called by my main : void _ApplyImpactDamageAndEffects(struct EventSpellScriptImpactStruct stEvent){ // only work for sphere spells int nAoEType = GetM2DAInt(TABLE_ABILITIES_SPELLS, "aoe_type", stEvent.nAbility); if (nAoEType == 1) { // location impact vfx if (stEvent.oTarget != OBJECT_INVALID) { stEvent.lTarget = GetLocation(stEvent.oTarget); } Ability_ApplyLocationImpactVFX(stEvent.nAbility, stEvent.lTarget); //float fRadius = GetM2DAFloat(TABLE_ABILITIES_SPELLS, "aoe_param1", stEvent.nAbility); // get objects in area of effect object[] oTargets = GetObjectsInShape(OBJECT_TYPE_CREATURE, SHAPE_SPHERE, stEvent.lTarget, 2.5f); // spell-specific special events //switch (stEvent.nAbility) //{ //} // cycle through objects int nCount = 0; int nMax = GetArraySize(oTargets); effect eEffect = EffectStun(); for (nCount = 0; nCount <= nMax; nCount++) { // per-spell effects //_ApplySpellEffects(stEvent, oTargets[nCount]); ApplyEffectOnObject(EFFECT_DURATION_TYPE_TEMPORARY, eEffect, oTargets[nCount], 5.0f, stEvent.oCaster, stEvent.nAbility); break; } }} i copied mostly from the built in scripts for grenades but still have this problem, any ideas what i did wrong? Link to comment Share on other sites More sharing options...
angryman24 Posted January 31, 2010 Share Posted January 31, 2010 The posted code looks *mostly* correct, however you may be applying effects twice. In your code you call _ApplySpellEffects followed by ApplyEffectOnObject. The definition of _ApplySpellEffects is not posted here. Typically, Bioware uses _ApplySpellEffects to do the effect application, so if you copy/pasted it's possible you're applying the effect twice. I don't know if that would cause the behavior you described. You could try moving the ApplyEffectonObject bit inside of _ApplySpellEffects and see what happens. Make sure you're not excluding hostile targets inside of _ApplySpellEffects. Link to comment Share on other sites More sharing options...
baracuda6977 Posted January 31, 2010 Author Share Posted January 31, 2010 hmm, here is a guess, would referencing this script in the GDA file AND the item file cause the error? also, i turned _ApplySpellEffects into a comment for looks when i just manually entered in the stun effect in place of the extra void i dont think i excluded hostiles, got mob to line up such that i naded 5 enemies and no allies and stunned a werewolf so the error is somewhere with getobjects in shape or the for statement edithow did i miss this, there is a break in the for statement anyways, got it working, thanks for the feedback Link to comment Share on other sites More sharing options...
angryman24 Posted January 31, 2010 Share Posted January 31, 2010 good catch. i missed it too. Link to comment Share on other sites More sharing options...
baracuda6977 Posted February 6, 2010 Author Share Posted February 6, 2010 I'm recycling this thread, can someone help me with how to make an item summon a creature as a summon? editbetter question, how do you use ITEM_ABILITY_UNIQUE_SINGLE_USE? im looking at the script but cannot figure out what it is sending the module script to catch edit2:got the summon to work, sort of, can someone help me understand why it is setting my creature to have shield bash and shield defense instead of the stealths i set it to have in its toolset file? this is my code that is used when i use the item : 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(OBJECT_SELF) * 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_NORMAL); 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; as you can see its mostly copypasta Link to comment Share on other sites More sharing options...
Recommended Posts