Aller au contenu

Photo

[SOLVED] Adding an unremoveable item, without message


4 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
Kesaru

Kesaru
  • Members
  • 130 messages
The code you gave stopped the messages which is great, but somehow it's still able to be dropped or unequipped.
And you were right about where the issue was, thanks for that :D I tried using those two functions the same way at one point in my attempts, but just like you guessed I hadn't specified the other sections.

Modifié par Kesaru, 17 mars 2010 - 12:31 .


#4
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);


#5
Kesaru

Kesaru
  • Members
  • 130 messages
That keeps it from being dropped, but it can still be unequipped :(
Apparently there's a set of equipment in the game called "Guard Uniform" which cannot be unequipped, and lists the effect  "Cannot be unequipped", along side the "Indestructible" effect.
I can't find the scripts relating to it (or even the armor itself somehow) in the toolset though.

---Edit---
I've found it! SetItemIrremovable stops the player from being able to unequip the item.
Thanks for the help :D

Modifié par Kesaru, 17 mars 2010 - 03:59 .