Aller au contenu

Photo

need help giving equipment usable abilities


  • Veuillez vous connecter pour répondre
8 réponses à ce sujet

#1
apookgnik123

apookgnik123
  • Members
  • 6 messages
I'm working on the BGR mod right now, and we are trying to figure out if it is possible to give weapons and armor the ability to be used like health potions and injury kits(but with different effects like spells) and still be able to use them as equipment. 

#2
Proleric

Proleric
  • Members
  • 2 361 messages
Yes, you can.

Give the item an Activated Ability of UNIQUE POWER UNLIMITED USE.

In your module script, add this event case:

[dascript]
case EVENT_TYPE_UNIQUE_POWER:
{
int nAbility = GetEventInteger(ev, 0);
object oItem = GetEventObject(ev, 0);
object oCaster = GetEventObject(ev, 1);
object oTarget = GetEventObject(ev, 2);
string sItem = GetTag(oItem);

if (sItem == "tag of my item")
{
/* Do magic stuff */
}
}
[/dascript]


In game, drag the item to a quickslot before equipping it, so that you can use its unique power at any time.

Party members cannot use the unique power if item restrictions apply to them. For example, weapons and armour normally have a minimum strength requirement, so the weaker party members won't be able to use their healing powers, either.

Plot items are not usable, so, if your item is essential to the plot, this tutorial may be useful.

Since we don't want to destroy the item on use, but unlimited use might be overpowered, it is possible to set the cooldown to a very long time when the item is used, for example

[dascript]
               SetCooldown(oCaster, nAbility, 1000000000., sItem);
[/dascript]

That particular example disables the power forever (for all practical purposes). The power can be enabled again by resetting the cooldown to (say) 1 second when a suitable event occurs (such as entering a new area).

Modifié par Proleric1, 17 janvier 2011 - 06:43 .


#3
apookgnik123

apookgnik123
  • Members
  • 6 messages
i've tried doing that but scripted a different way. I made a longsword with an activated ability to heal, but when the longsword has that ability i'm not able to equip it.

I did try that script, but i keep getting errors with these:     int nAbility = GetEventInteger(ev, 0);
                                                                                            object oItem = GetEventObject(ev, 0);
                                                                                            object oCaster = GetEventObject(ev, 1);
                                                                                            object oTarget = GetEventObject(ev, 2);
                                                                                            string sItem = GetTag(oItem)

                                                                            or this:     if (sItem == "tag of my item")


the error for both of those is:   Variable defined without type (while compiling b21_var_constants_h.nss)

#4
Proleric

Proleric
  • Members
  • 2 361 messages
The script is a snippet which is intended to be inserted as a case in a module event script similar to this example.

It will compile if you declare and initialise ev as shown in the example.

It's interesting that some Activated Abilities prevent the item from being equipped. So does the plot flag. Fortunately, in my tests the Unique Power approach has been reliable.

#5
mikemike37

mikemike37
  • Members
  • 669 messages
hey proleric - thanks for helping us out on this one - youre giving us hope hehe.

couple of questions though, since neither of us have got this to work:

firstly, this goes against the advice on the wiki that "Item abilities cannot be placed on equippable items." - if we can confirm this is untrue, then let's change that statement. but as i investigate i am beginning to think that this isnt giving it a "normal" ability, since it wont be coming from ABI_base (is that correct?)

UNIQUE POWER UNLIMITED USE
okay since i see this is a special event which exists, am i right in thinking this isnt an ability like the ones we might find in ABI_base? I dno't see it in my activated abilities dropdown in my module or single player... :( am i doing something stupid?

"It's interesting that some Activated Abilities prevent the item from being equipped"
any idea which and why? i guess you would have stated if youd known, but cant harm to ask. I expect we'll want to be making use of more than one unique power ability, since we will want to make use of targetting and such on these abilities if possible. in this case, we might come across the ones which don't work.


EDIT: wait, by 
Give the item an Activated Ability of UNIQUE POWER UNLIMITED USE.
you didnt mean
Give the item an Item Property of Flag: Unlimited Use
did you?

Modifié par mikemike37, 22 janvier 2011 - 02:39 .


#6
Proleric

Proleric
  • Members
  • 2 361 messages
When I examine an item in Object Inspector, ITEM_ABILITY_UNIQUE_POWER_UNLIMITED_USE is the fourth entry in the Activated Ability dropdown.

It's defined at line 200203 of ABI_base.

I tested the approach for a longsword and some armour.

It's just an empirical finding. I haven't really looked at other abilities, as this one does everything I need.

Let me know if you still can't get this to work.

#7
apookgnik123

apookgnik123
  • Members
  • 6 messages
it looks like we took ITEM_ABILITY_UNIQUE_POWER_UNLIMITED_USE out of our abi_base.

#8
mikemike37

mikemike37
  • Members
  • 669 messages
oh, darn lol. i must have missed it when i looked in single player. oops!



will look at this when i get a chance. thanks!

#9
mikemike37

mikemike37
  • Members
  • 669 messages
oh big sigh...



i wasnt actually doing anything wrong when i tried using other abilities before, i was just equipping it wrong. applying an ability in this way prevents drag-dropping into equipment. the player must double-click to equip. big doh!



i only realised this when i started from the top following your instructions really carefully and was like: this *HAS* to work now, ive done everything so carefully! it was only then that i tried double clicking! sigh.



interestingly, apookgnik123 was unable to drag to quickbar, which is a problem i havent come across yet (though im unable to drag-drop to quickbar from an equipment slot, only from inventory bag is ok). so I might stumble onto other problems soon too...



purely for academic purposes, i'll report back where i go with this. it is my hope that i will create new abilities (to allow targetting of enemies, AOEs and sustains) as well as handling these items to automatically add the ability and remove the ability from the quickslot for player convenience. maybe a 5 second "just-equipped" cooldown to prevent the player switching through ten different rings and using the ability from each within a couple of seconds.