Jump to content

Custom Quick Item - destroyed after 1 use - how to fix?


nikivich

Recommended Posts

OK, Here's the thing:

 

- Created ABI_teleport.gda, copied over "ITEM_UNIQUE_POWER_UNLIMITED_USE" and changed name etc.

- Changed script from "item_unique_power" to "item_inno_teleport"

- Created item resource, base type "other - quick item", ability "ITEM_TELEPORT"

- exported

- run game

- use item --> works like a charm

 

BUT: After the first use, my item's gone!

Before I actually used the UNIQUE_POWER thing, but that script just fires the event into your module script and I wanted to remove that coupling.

However, the item was not being destroyed when I used that ability type.

 

After searching the wiki I found that: (http://social.bioware.com/wiki/datoolset/index.php/Item)

 

Activated Items

Each item can have a single default action. This is entered by picking an ability of type "Item Ability" from the abilities table which defines its icon, script, description and targetting behaviour. Items that can be used go into a special equip slot. All other item types (weapons, armor, et cetera) cannot have a custom item use. The number of uses for this ability will be decided by the script which will destroy the item when appropriate.

there are no uses per day type items. All items only have "number of uses".

 

Obviously I am NOT destroying my item in script...

Below my script for reference:

 

/*
* inno_item_teleport - ITEM_TELEPORT ability script. See ABI_base_teleport 2DA.
*
*/
#include "abi_templates"
#include "inno_teleport_h"

void _HandleImpact(struct EventSpellScriptImpactStruct stEvent, object oItem)
{
Teleport(oItem);
}

void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);

switch(nEventType)
{
	case EVENT_TYPE_SPELLSCRIPT_PENDING:
	{
		Ability_SetSpellscriptPendingEventResult(COMMAND_RESULT_SUCCESS);
		break;
	}

	case EVENT_TYPE_SPELLSCRIPT_CAST:
	{
		struct EventSpellScriptCastStruct stEvent = Events_GetEventSpellScriptCastParameters(ev);
		SetAbilityResult(stEvent.oCaster, stEvent.nResistanceCheckResult);
		break;
	}

	case EVENT_TYPE_SPELLSCRIPT_IMPACT:
	{
		// Get a structure with the event parameters
		struct EventSpellScriptImpactStruct stEvent = Events_GetEventSpellScriptImpactParameters(ev);
		Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, GetCurrentScriptName() + ".EVENT_TYPE_SPELLSCRIPT_IMPACT",Log_GetAbilityNameById(stEvent.nAbility));
		//get object
		object oItem = GetEventObject(ev, 2);

		// Handle impact
		_HandleImpact(stEvent, oItem);
		break;
	}
}
}

 

 

Any clues anyone?

Link to comment
Share on other sites

No idea, but you could probably just add another version of the item to inventory after being used until you can figure it out.

 

If there are any unlimited use items in the game, you might be able to see what you are missing by looking at how they are constructed/scripted. If there aren't any, then that aspect may have never worked properly, and all items are made to be single use.

Link to comment
Share on other sites

The only item i can think of that is ingame and behaves like you want is the litany. There is a code that sets the litany as plot item when you pick it up, and de-sets & removes it once it's no longer needed; perhaps this is what's making it infinite use?.

I also cannot find anything that would indicate that ITEM_UNIQUE_POWER_UNLIMITED_USE and ITEM_UNIQUE_POWER_SINGLE_USE behave differently in any way other than showing a different tooltip/text.

Link to comment
Share on other sites

The only item i can think of that is ingame and behaves like you want is the litany. There is a code that sets the litany as plot item when you pick it up, and de-sets & removes it once it's no longer needed; perhaps this is what's making it infinite use?.

I also cannot find anything that would indicate that ITEM_UNIQUE_POWER_UNLIMITED_USE and ITEM_UNIQUE_POWER_SINGLE_USE behave differently in any way other than showing a different tooltip/text.

 

Well I did look at all those items. But as soon as I set the plot flag. I can not use my item anymore at all :( It is all very frustrating that all those seamingly easy things are so undocumented and acting werird.

I have tried setting plot flag, using the SetItemIndestrubtible() function etc.

 

The ONLY way I get it to work is using ITEM_UNIQUE_POWER_UNLIMITED_USE and like you said, there is no indication whatsoever that it should behave differently from another "custom" ability. (the script just stupidly fires an event to the module, nothing more)

My guess is there still stuff under the hood acting on some combination of props but at I have been going through core scripts and 2DA files for hours without solving these "mysteries"....

 

Anyway, any other ideas you might have are welcome cause I really don't know where to look anymore...

Link to comment
Share on other sites

Well, the script does report to module core you said? perhaps there's something there catching the event?

 

Well nevermind, it's impossible to do. Basically, somewhere there are hardcoded references to the ...UNLIMITED_USE, KOLGRIMS_HORN and a few other items that prevents those from being destroyed. Fecking Bioware, I have never seen base rules designed that crappy. What is hard about adding a "unlimiteduse" column to some 2DA instead of retardedly hardcoding item tags....

 

basically, I no wuse a hack to make it work, each time in my item ability script I do (SetItemStackSize(oItem, GetItemStackSize(oitem) + 1) to increase the stack which will be decreased after using the item.... really crappy and retarded but it works

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...