- 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.biowar.../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...
Other stuff I tried:
- setting item as plot item -> I can't use it anymore at all, I can't also not move it to the quickbar anymore.
- using the SetItemIndesctructible() function -> no change, item still removed after use
- actually using ITEM_UNIQUE_POWER_UNLIMITED_USE as ability and moving my script to the module script --> item works as expected and is not destroyed after use--> WTF? I search the core scripts and 2DA files for hours but there is NOTHING to indicate this ability is handled any differently! Some bioware guy--> please explain?
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?





Retour en haut






