JCarter426 Posted May 3, 2008 Share Posted May 3, 2008 I'm working on an update to a mod I released a while back, and I need some help with making the scripts, as my knowledge of scripting couldn't fill a thimble. I need a conditional script that checks the player's inventory to make sure they have certain items. Now, the individual items I know how to check for (using c_have_item as a source), but I don't know how to make it so that the script will return false only if the player has all of the items. And is there any way to make a script that will return true if the player has a certain item in their inventory, but false if that item is equipped? Any help would be most appreciated, and you'd receive full credit of course. Link to comment Share on other sites More sharing options...
DarthJebus05 Posted May 3, 2008 Share Posted May 3, 2008 Not sure if this will help: http://www.lucasforums.com/showthread.php?t=183514&highlight=checking+inventory Link to comment Share on other sites More sharing options...
JCarter426 Posted May 3, 2008 Author Share Posted May 3, 2008 Ok, I think I got everything for the first one, but for the second... I want to take an item from the player, but it shouldn't take an item that is equipped. EDIT: Nope, still problems with the first one. Link to comment Share on other sites More sharing options...
stoffe Posted May 3, 2008 Share Posted May 3, 2008 And is there any way to make a script that will return true if the player has a certain item in their inventory, but false if that item is equipped? Something like this would probably work: int ST_HasUnequipped(string sTag, object oTarget=OBJECT_INVALID); int StartingConditional() { return ST_HasUnequipped("[color=Yellow]SomeItemTag[/color]"); } int ST_HasUnequipped(string sTag, object oTarget=OBJECT_INVALID) { [color=PaleGreen]// ST: No object specified to check: default to main character.[/color] if (!GetIsObjectValid(oTarget)) oTarget = GetFirstPC(); object oItem = GetItemPossessedBy(oTarget, sTag); [color=PaleGreen]// ST: Does not have item at all, condition not fulfilled.[/color] if (!GetIsObjectValid(oItem)) return FALSE; [color=PaleGreen]// ST: Check if the item is equipped[/color] int iSlot; for (iSlot = INVENTORY_SLOT_HEAD; iSlot <= INVENTORY_SLOT_LEFTWEAPON2; iSlot++) { [color=PaleGreen]// ST: Item is equipped, condition not fulfilled.[/color] if (GetItemInSlot(iSlot, oTarget) == oItem) return FALSE; } [color=PaleGreen]// ST: Item was not equipped, condition fulfilled.[/color] return TRUE; } Replace SomeItemTag with the tag of the item to check for. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.