Aller au contenu

Photo

Weapon Charges


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

#1
DITB123

DITB123
  • Members
  • 9 messages
So, I made a weapon that has 5 charges, with 2 charges per use for a unique spell it casts, but unless i make it a plot it keeps disappearing when it hits 1 charge left. Also, it gets rechaged with 2 charges (1 more effective use) every time a certain enemy is killed. However, although the charge amount in the description changes the amount of uses will not => Maybe because it is a plot, or maybe because I used the item until it had 1 charge left (zero uses) then recharged it and it didn't work.
Please help me with this!



Here's the script for the unique power self only:


#include "x2_inc_switches"
void main()
{
object oPC = GetItemActivator();
int nEvent = GetUserDefinedItemEventNumber();
switch (nEvent)
   {
   case X2_ITEM_EVENT_ACTIVATE:
{
    location lCenter = GetLocation(oPC);
    object oDagger = GetItemActivated();
    effect eTimeStopVFX = EffectVisualEffect(VFX_FNF_TIME_STOP);
    effect eGlobe = EffectVisualEffect(VFX_DUR_GLOBE_INVULNERABILITY);
    effect eParalyze = EffectCutsceneParalyze();
    effect eImmobilize = EffectCutsceneImmobilize();
       eParalyze = SupernaturalEffect(eParalyze);
       eImmobilize = SupernaturalEffect(eImmobilize);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eTimeStopVFX, oPC);
    object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, 10.0f, lCenter, OBJECT_TYPE_CREATURE);
    while(GetIsObjectValid(oTarget))
     {
      if (oTarget == oPC)
        {
        // do nothing
        }
      else
        {
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eParalyze, oTarget, 12.0);
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eImmobilize, oTarget, 12.0);
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eGlobe, oTarget, 12.0);
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION), oTarget, 12.0);
        }
        oTarget = GetNextObjectInShape(SHAPE_SPHERE, 10.0f, lCenter, OBJECT_TYPE_CREATURE);
     }
}
                   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(GetModuleItemLost()), OBJECT_SELF); break;
   }
}


and here is the ondeath script of the dudes getting killed

void main()
{
object oPC = GetLastKiller();
 object oWeaponRight = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
 object oWeaponLeft = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
 int nDaggerChargeRight = GetItemCharges(oWeaponRight);
 int nDaggerChargeLeft  = GetItemCharges(oWeaponLeft);
if (GetTag(oWeaponRight) == "daggeroftime")
 {
  if (nDaggerChargeRight < 5)
   {
    SetItemCharges(oWeaponRight, nDaggerChargeRight+2);
   }
 }
else if (GetTag(oWeaponLeft) == "daggeroftime")
 {
  if (nDaggerChargeLeft < 5)
   {
    SetItemCharges(oWeaponLeft, nDaggerChargeLeft+2);
   }
 }
}Thanks again, DITB

[P.S.- For those of you who noticed it in the scripts, yes, this is the 'Dagger of Time' from the prince of persia games Posted Image]

#2
Shadooow

Shadooow
  • Members
  • 4 474 messages
Thats the way how its work. Possibilities are:
- set odd charges count and set each use to consume 2 charges
- increase charge if remaining charges are 1 and next time it happens set weapon plot and decrease charges to 0

#3
DITB123

DITB123
  • Members
  • 9 messages
Thanks for the pointers:
-That's what I did, the lowest charge amount it ever has is 1, since it starts at an odd amount (5) and uses an even amount (2).
-I'm not sure what you mean by the second point

#4
DITB123

DITB123
  • Members
  • 9 messages
Thanks for the pointers:
-That's what I did, the lowest charge amount it ever has is 1, since it starts at an odd amount (5) and uses an even amount (2).
-I'm not sure what you mean by te second point

#5
WhiZard

WhiZard
  • Members
  • 1 204 messages

DITB123 wrote...

So, I made a weapon that has 5 charges, with 2 charges per use for a unique spell it casts, but unless i make it a plot it keeps disappearing when it hits 1 charge left. Also, it gets rechaged with 2 charges (1 more effective use) every time a certain enemy is killed. However, although the charge amount in the description changes the amount of uses will not => Maybe because it is a plot, or maybe because I used the item until it had 1 charge left (zero uses) then recharged it and it didn't work.
Please help me with this!


You can add another item cast spell property with 0 charges per use (like cure minor wounds) and this would fix the item disappearing part.

The inability to use added charges can be solved by resting.