Search doesn't seem to be working right now, so I am sorry if this topic is discussed to death.
I am trying to write a script that adds an item using parameter.
But I can't figure out how to change the parameter string into a Resource to be used with UT_AddItemToInventory.
Does anyone know how to do that?
How do you convert from String to Resource?
Débuté par
JamesX
, nov. 20 2009 04:56
#1
Posté 20 novembre 2009 - 04:56
#2
Posté 20 novembre 2009 - 05:42
From my understanding, resources are manually created assets and by their nature static. Because you are unable to create resources dynamically afaik, there is not much point in referring to them that way during the game.
That being said, the treasure.xls file can be used to map resources to identifiers. Using GetM2DAResource() you can retrieve these resources in your scripts:
resource res = GetM2DAResource(TABLE_TREASURES, "COLUMN", ROW_ID);
For example use GetM2DAResource(TABLE_TREASURES, "Weapon", 5); to retrieve the resource located in the 5th row of the Weapon column inside the treasure.xls file. All you need is creating your own M2DA version of this xls file and fill it with items you wish to access.
That being said, the treasure.xls file can be used to map resources to identifiers. Using GetM2DAResource() you can retrieve these resources in your scripts:
resource res = GetM2DAResource(TABLE_TREASURES, "COLUMN", ROW_ID);
For example use GetM2DAResource(TABLE_TREASURES, "Weapon", 5); to retrieve the resource located in the 5th row of the Weapon column inside the treasure.xls file. All you need is creating your own M2DA version of this xls file and fill it with items you wish to access.
#3
Posté 20 novembre 2009 - 07:18
IIRC there is a StringToResource() function built in.
Edit: Nope sorry, I double checked and its ResourceToString... You might want to look at the SetLocalResource() function, it might be what you need depending on your script.
Edit: Nope sorry, I double checked and its ResourceToString... You might want to look at the SetLocalResource() function, it might be what you need depending on your script.
Modifié par Nodrak, 20 novembre 2009 - 07:25 .
#4
Posté 20 novembre 2009 - 07:33
Change your script to accept a resource as the parameter.





Retour en haut






