Aller au contenu

Photo

[SOLVED] Adding an unremoveable item, without message


2 réponses à ce sujet

#1
Kesaru

Kesaru
  • Members
  • 130 messages
For the mod I'm working on, I need to add an invisible shield to the player when Combat Magic is activated. I've got this working fine, but I still need to prevent the player from being able to unequip or drop the item, and stop the "items added" message from appearing.
This link seem to list the functions I need to add; bSuppressNote and bDroppable.
social.bioware.com/wiki/datoolset/index.php/UT_AddItemToInventory
The problem is I have no idea how to add those to it. I don't know how the finished product should look.
Here's the code I'm using right now:
EquipItem(stEvent.oCaster, UT_AddItemToInventory(R"aw_hand_arcanearts.uti", 1));

Modifié par Kesaru, 17 mars 2010 - 04:00 .


#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
object oItem = UT_AddItemToInventory(R"aw_hand_arcanearts.uti", 1, OBJECT_INVALID, "", TRUE, FALSE);
EquipItem(stEvent.oCaster, oItem);

It seems like what you're struggling with is optional parameters. Normally with a function call you must provide the exact parameters in the exact order. With optional parameters, you use fewer parameters when making the function call, and the default values will be used instead. However, the order must still be maintained, and you can only omit from the rightmost optional paramater working your way in. As above, I had to declare the oInvOwner and sItemTag parameters even though I wanted the default values, because I wanted to overwrite the bSurpressNote and bDroppable parameters which are further to the right.

The wikipedia article might be easier to understand than my ramblings: http://en.wikipedia....efault_argument

Modifié par DavidSims, 16 mars 2010 - 11:09 .


#3
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Looks like the droppable flag toggles whether or not the creature will drop the item when they die.



Try this instead:



object oItem = UT_AddItemToInventory(R"aw_hand_arcanearts.uti", 1, OBJECT_INVALID, "", TRUE, FALSE);

SetItemIndestructible(oItem, TRUE);

EquipItem(stEvent.oCaster, oItem);