Silveredge9 Posted February 5, 2008 Share Posted February 5, 2008 I've been trying to create a conditional script that would perform an action when the right type of item has been added by the player to the inventory of the item the script is attached to. Like in one of the Korriban Tombs where you have to put a grenade into the Pillar. Through my own research I've come up with the script below. It doesn't compile, but I feel it's at least close to what I'm wanting to acheive. void main(){ int iBaseItem = "BASE_ITEM_FRAGMENTATION_GRENADES"; object oTran=GetObjectByTag("msp_tran1"); object oGrenade = GetFirstItemInInventory(oTran); if (GetBaseItemType(oGrenade) == iBaseItem); { } } Thanks in advance for any help. Link to comment Share on other sites More sharing options...
Darkkender Posted February 5, 2008 Share Posted February 5, 2008 The process used in the Korriban temple checks for a specific item by either TAG or Template. Most likely by template. Link to comment Share on other sites More sharing options...
stoffe Posted February 6, 2008 Share Posted February 6, 2008 I've been trying to create a conditional script that would perform an action when the right type of item has been added by the player to the inventory of the item the script is attached to. Like in one of the Korriban Tombs where you have to put a grenade into the Pillar. Through my own research I've come up with the script below. It doesn't compile, but I feel it's at least close to what I'm wanting to acheive. There are a few problems with your script. You try to assign a string constant to an integer variable, you only check the first item (which is usually enough but to be safe it's best to check all of them until a match is found), and you terminate the if statement check before the following block is executed. Try this variant of your script: void main(){ if (GetLocalBoolean(OBJECT_SELF, 40)) return; object oTran=GetObjectByTag("msp_tran1"); object oGrenade = GetFirstItemInInventory(oTran); while (GetIsObjectValid(oGrenade)) { if (GetBaseItemType(oGrenade) == BASE_ITEM_FRAGMENTATION_GRENADES) { [color=PaleGreen]// ST: GRENADE! Do what is supposed to be done here.[/color] SetLocalBoolean(OBJECT_SELF, 40, TRUE); break; } oGrenade = GetNextItemInInventory(oTran); } } Link to comment Share on other sites More sharing options...
Silveredge9 Posted February 9, 2008 Author Share Posted February 9, 2008 Thanks, that pretty much worked. And I was aware there was many many problems with my initial script, but I was right that it was something close to what I needed. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.