im trying to add an item to my inventory using the following script, but it fails to compile - E: 14:42:58 - spawn.nss - spawn.nss(2): Unknown state in compiler. ANy help would be apreciated.
#include "utility_h"
void main()
{
UT_AddItemToInventory("magerobe", 1, OBJECT_INVALID, "magerobe", FALSE, TRUE);
)
-- relevent code from utility_h --
object UT_AddItemToInventory(resource rItem, int nNumToAdd = 1, object oInvOwner = OBJECT_INVALID, string sTag = "", int bSuppressNote = FALSE, int bDroppable = TRUE)
{
if ( oInvOwner == OBJECT_INVALID )
oInvOwner = GetPartyLeader();
Log_Trace( LOG_CHANNEL_SYSTEMS, "utility_h:UT_AddItemToInventory",
"Total to Add: [" + ResourceToTag(rItem) + " x " + ToString(nNumToAdd) + "]", oInvOwner );
return CreateItemOnObject(rItem,oInvOwner,nNumToAdd,sTag,bSuppressNote,bDroppable);
}
script t add item
Débuté par
Guest_etfeet_*
, nov. 07 2009 11:40
#1
Guest_etfeet_*
Posté 07 novembre 2009 - 11:40
Guest_etfeet_*
#2
Posté 08 novembre 2009 - 01:09
So, the first parameter for UT_AddItemToInventory is "resource", not "string". You define resource variables like so (just a small example for an item):
- resource rMyResource = R"my_resource.uti";
So, for your custom item, you want to specify it as R"magerobe.uti".
Remember, for resources, you always need the extension. So, .uti for items, .utc for creatures, .cut for cutscenes, etc. Let me know if you need to know anything else.
- resource rMyResource = R"my_resource.uti";
So, for your custom item, you want to specify it as R"magerobe.uti".
Remember, for resources, you always need the extension. So, .uti for items, .utc for creatures, .cut for cutscenes, etc. Let me know if you need to know anything else.
Modifié par Challseus, 08 novembre 2009 - 01:09 .
#3
Posté 08 novembre 2009 - 01:44
there's already an additem script in the debug folder of the core resources.





Retour en haut







