Aller au contenu

Photo

Trying to make a spell that will unequip and equip targets


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

#1
thendavesaid

thendavesaid
  • Members
  • 2 messages
I am trying to create a spell that will unequip a target when I cast on them, then equip them with what is in their inventory when I cast on them again. Not sure what I'm doing wrong.


#include "log_h"
#include "abi_templates"
#include "sys_traps_h"
#include "spell_constants_h"

const int NRING = 777777;
void _HandleImpact(struct EventSpellScriptImpactStruct stEvent)
{    
// -------------------------------------------------------------------------    
// VAR BLOCK    
// -------------------------------------------------------------------------    

    int    nScalingVector   = SCALING_VECTOR_DURATION;    
    int    nAttackingValue  = PROPERTY_ATTRIBUTE_SPELLPOWER;
    int    nResistance      = RESISTANCE_INVALID;
    float  fDuration        = 0.0f;
    float  fScaledValue     = 0.0f;
    int    nEffect          = 0;
    int    nHandler         = SPELL_HANDLER_CUSTOM;
    effect eDamage;    effect eEffect;
    effect[] eEffects;
    int bHostile = FALSE;
    object oClothing        = OBJECT_INVALID;
    object oStuff           = OBJECT_INVALID;
    object oBckpck          = OBJECT_INVALID;
    int nInvSlot;    int nGetStuffOptions;
        // make sure there is a location, just in case
    if (IsObjectValid(stEvent.oTarget) == TRUE)
    {
        stEvent.lTarget = GetLocation(stEvent.oTarget);
    }

    // -------------------------------------------------------------------------
    // Handle Spells
    // -------------------------------------------------------------------------
    switch (stEvent.nAbility)
    {                                                      


    case NRING:
        {
              oClothing = GetItemInEquipSlot(INVENTORY_SLOT_CHEST, stEvent.oTarget);
                        if (oClothing != OBJECT_INVALID)
            {
                UnequipItem(stEvent.oTarget, oClothing);
            }

                        else                                                     
           {
                        oBckpck = GetItemsInInventory(stEvent.oTarget, int nGetStuffOptions = 
GET_ITEMS_OPTION_BACKPACK, int nBaseItemType = 4, string sTagFilter = "");
                        EquipItem(stEvent.oTarget, oBckpck, nInvSlot = 4);
            }                            
                        eEffect = SetEffectEngineInteger(eEffect, EFFECT_INTEGER_VFX, 
                        Ability_GetImpactObjectVfxId(stEvent.nAbility));
                        ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eEffect, 
stEvent.oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility);

                        break;          
            }
    }


Error is in this line:
                oBckpck = GetItemsInInventory(stEvent.oTarget, int nGetStuffOptions = GET_ITEMS_OPTION_BACKPACK, int nBaseItemType = 4, string sTagFilter = "");
(52): Unknown state in compiler.

As far as I can tell I'm following the tutorials and the help definitions.

Also I just found in the script.ldf where it says that the UnequipItem command wasn't implemented in the game. Can anyone verify this?

Modifié par thendavesaid, 09 janvier 2011 - 06:18 .


#2
_L_o_B_o_

_L_o_B_o_
  • Members
  • 117 messages

thendavesaid wrote...
Error is in this line:
                oBckpck = GetItemsInInventory(stEvent.oTarget, int nGetStuffOptions = GET_ITEMS_OPTION_BACKPACK, int nBaseItemType = 4, string sTagFilter = "");
(52): Unknown state in compiler.


Some of those function parameters are used like if you were declaring the function. Try this instead:

GetItemsInInventory(stEvent.oTarget, GET_ITEMS_OPTION_BACKPACK, 4, "");

#3
thendavesaid

thendavesaid
  • Members
  • 2 messages
Thanks. That got it to compile, now I just need to find the function that will identify an item to equip to the slot.

#4
Proleric

Proleric
  • Members
  • 2 350 messages
I made this script to do exactly that (amongst other things).

If you want to re-equip the player exactly as they were, move their unequipped inventory to invisible container #1, then move their equipped inventory to container #2. Re-equip from #2 then recover the inventory from #1.