Aller au contenu

Photo

RemoveItemProperty + visual effect


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

#1
Thamiar

Thamiar
  • Members
  • 7 messages

Hello,

I have got a strange problem: I would like to remove a visual effect from weapon, but it simply does not work. If I use spells like Flame weapon or Darkfire, the Visual Effect is removed by the script. But if i want to remove it from a weapon which has got effect from the beginning (like Angurvadal (Flame Tongue)) it is not working :(
What is more, when i run the script while having Angurvadal in my PC hand, I do not see "Debug 3"

What is wrong? Angurvadal fire effect is not a visual effect or what?

void main()
{
object oPC = GetPCSpeaker();
object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
if (!GetIsObjectValid(oItem)) return;

   


itemproperty ipLoop=GetFirstItemProperty(oItem);
     FloatingTextStringOnCreature("Debug 1", oPC);
//Loop for as long as the ipLoop variable is valid
while (GetIsItemPropertyValid(ipLoop))
   {             FloatingTextStringOnCreature("Debug 2", oPC);
   //If ipLoop is a true seeing property, remove it
   if (GetItemPropertyType(ipLoop)==ITEM_PROPERTY_VISUALEFFECT)
     { RemoveItemProperty(oItem, ipLoop);
                   FloatingTextStringOnCreature("Debug 3", oPC);   
     }
   //Next itemproperty on the list...
   ipLoop=GetNextItemProperty(oItem);
   }
}


#2
Guest_JujuSamedi_*

Guest_JujuSamedi_*
  • Guests
Indent code and modularize your code pls. Either than that I have never done any script in NWN. Do they use C++ or is it a proprietary variation? I might just get my hands dirty.

#3
Thamiar

Thamiar
  • Members
  • 7 messages
void main()
{
object oPC = GetPCSpeaker();
object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
              if (!GetIsObjectValid(oItem)) return;

itemproperty ipLoop=GetFirstItemProperty(oItem); 
FloatingTextStringOnCreature("Debug 1", oPC);

while (GetIsItemPropertyValid(ipLoop))
      { FloatingTextStringOnCreature("Debug 2", oPC);
            if (GetItemPropertyType(ipLoop)==ITEM_PROPERTY_VISUALEFFECT)
                { RemoveItemProperty(oItem, ipLoop);
                  FloatingTextStringOnCreature("Debug 3", oPC);   
                }
            ipLoop=GetNextItemProperty(oItem);
      }
}


#4
The Amethyst Dragon

The Amethyst Dragon
  • Members
  • 1 882 messages

You may have to actually add a weapon visual to get rid of the flames.

 

I believe that the regular weapon VFXs are tied (via a 2da) to the bonus damage property.  So, if your weapon has a damage bonus of a certain type of at least a certain amount (say 1d6 or higher), the weapon will have the VFX, unless you specifically add a different VFX by means of another...

 

ItemPropertyVisualEffect(ITEM_VISUAL_*);

 

If you are using one or more haks for your module, you can edit iprp_visualfx.2da to add a new "none" VFX:

 

    Label        Name
0    Acid        16877231
1    Cold        16877257
2    Electrical  16877248
3    Fire        16877256
4    Sonic        16877255
5    Holy        16877237
6    Evil        16877239
7    NoneNull    16877238

 

* Ignore my .tlk file references for the names...those are from my own version of the file that I happened to have open.  For the one for "none", I'm sure there's a dialog.tlk line with that word.

 

Now, for the script, instead of using the ITEM_VISUAL_* constant (which matches up with the 2da line numbers), you can just use "7".

 

The standard VFX will still show up in the toolset, but in-game it'll be overridden by the "new" VFX...which doesn't exist (and never will unless you are running the game with NWNCX and have the new visuals added in).



#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

... Do they use C++ or is it a proprietary variation? ...


proprietary, It is compiled to a .NCS(Neververwinter Compiled Script) format. The .NCS code is ran by a virtual machine built into the game. It uses the same syntax as C++ but is a highly cut down version.

To get your feet wet check out the NWN Lexicon.

#6
Proleric

Proleric
  • Members
  • 2 361 messages
I wonder whether the OP issue is related to the "baking" of vfx on placeables? The issue there is that some vfx become impossible to remove once players have left the area (unless they are removed on exit and reapplied on enter). Just coincidence, perhaps?

At any rate, good to know about the workaround.

#7
Proleric

Proleric
  • Members
  • 2 361 messages
By chance, I stumbled across the following advice in the Lexicon: "(instead) of applying an effect, ... cast a spell on the object using invisible object casters", which seems to square with the OP's finding.

So, it would be interesting to see what happens if you remove the effect from Angurvadal's template in the toolset, but apply it in-game with an invisible caster.

I've made a note to try this out with placeables at the next opportunity.

#8
Thamiar

Thamiar
  • Members
  • 7 messages

The Amethyst Dragon Thank you very much! That was exactly what I was looking for! Thank you very much! :)