Jump to content


Photo

Player only usable items


  • Please log in to reply
13 replies to this topic

#1 Oldwolf

Oldwolf
  • Member
  • 141 posts

Posted 15 February 2008 - 09:14 PM

Ok I can't seem to figure out how to make an item usable only by the PC. I don't want to limit it to a certain class/race due to the fact if I write it into a mod I would like for the player to be able to create what ever character they want and get the item assigned by their class. However I'd also like to make sure that it's only equipable/usable by the PC. Anyone know how to do this?

#2 Rabain

Rabain

    God

  • Member
  • 653 posts

Posted 15 February 2008 - 11:17 PM

You can only do this by script. Either give the item to player1 via script and make it unmovable (not necessary).

Also if the player moves the item to another character transfer it back to player1 via script.

There is no option in files to make player1 only items.
A knight without armour in a savage land...

#3 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 16 February 2008 - 12:33 AM

Just like Xan's Moonblade isn't quite Xan only despite the description of the item. Unfortunately, you can't mimic the Moonblade restrictions for a Player1 because Player1's stats, class, and race will differ from user to user.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#4 Kulyok

Kulyok
  • Modder
  • 2450 posts

Posted 16 February 2008 - 01:04 AM

There is one, a very tricky way to do it: you can create, say, one hundred of blades(or edit them via patching in .tp2, but I'm out of my depth here), one for each class, kit and important stats.

Then, when it's time to drop the item(give it to a villain, put it into a container or a store, give it to PC in dialogue, whatever), you check PC's class and stats, and give him an according item.

It is complex, and it's a lot of work, and it's probably isn't worth it. But it will more or less ensure nobody else will use the item.

#5 Oldwolf

Oldwolf
  • Member
  • 141 posts

Posted 16 February 2008 - 07:53 AM

Thanks all for your replies, I'm giving the item via script. The item is assigned by class when the player is created in Candlekeep so the thing to do is make the item unmoveable I guess. That sounds like the best way to do it :)

#6 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 16 February 2008 - 08:31 AM

Oldwolf, you may want to be very careful with thsi idea. It is a big statement to make regarding oplayer choice versus modder choice - and undroppable is undroppable. And not-pick-uppable. There might need to be some serious testing to insure that a. there are no circunmstances when an undroppable can be stripped, and b. there is an absolute *need* for the item to be only used by the PC.

If you really must, how about a spell which calls forth the item? The only person to have the spell/ability is Player1, and log everything off of that.

Or, set up a block in the PC's script leveraging

0x4061 HasItem(S:ResRef*,O:Object*)
Returns true only if the specified object has the specified item in its inventory.

or

0x407F HasItemEquiped(S:ResRef*,O:Object*) //check for spelling - this is from IESDP

like this:

IF
OR(5)
HasItemEquiped(MyItem,Player2)
HasItemEquiped(MyItem,Player3)
HasItemEquiped(MyItem,Player4)
HasItemEquiped(MyItem,Player5)
HasItemEquiped(MyItem,Player6)
THEN RESPONSE #100
SetGlobal("NotYourItem","GLOBAL",1)
ActionOverride(Player1,DisplayStringHead(Myself,%hey there - give me my item back, please.%)
END

IF
Global("NotYourItem","GLOBAL",1)
HasItemEquiped(MyItem,Player1)
THEN RESPONSE #100
SetGlobal("NotYourItem","GLOBAL",0)
ActionOverride(Player1,DisplayStringHead(Myself,%Thank you.%)
END

#7 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 16 February 2008 - 10:22 AM

There is another consideration: an undroppable item cannot be moved in the inventory.

Say you give Player1 the item via script. You're going to have to do it by GiveItemCreate("item",Player1,0,0,0). That will put the item in Player1's inventory, in the first available spot. If the item is undroppable, there it stays. If this is, say, a weapon, it won't work, because it can never be equipped.

As an example of this, consider Keto's bottle of wine.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#8 Oldwolf

Oldwolf
  • Member
  • 141 posts

Posted 17 February 2008 - 04:15 AM

Hmm good points ....... so ok undroppable it isn't lol. I don't like the idea of it not being moveable. On a single player game I doubt that someone would trade the items off to anyone in the party but in a multiplayer they might but I guess I'll leave that up to them. I'll create the items on player1 and let the player decide from there I suppose. I'll have to look at a way to inform the player that the item will "grow" with them as they progress in their profession. I don't want to do that in the item description so maybe I'll have an encounter with an "old aquantence" of the Players mother who mentions that little tidbit.

Oh and B yes the creation goes like that but I also used ActionOverride(Player1,FillSlot(SLOT_ARMOR)) commands to put the items where they were to be used but now thinking on it not being able to change the item, at least to put it from equiped into their pack is not so good :( so I'll get rid of the unmoveable flag :)

Edited by Oldwolf, 17 February 2008 - 04:20 AM.


#9 Rabain

Rabain

    God

  • Member
  • 653 posts

Posted 17 February 2008 - 06:20 AM

Also remember that FillSlot() is destructive...meaning that it destroys whatever is already in the slot you are Filling().

Players might not appreciate that.
A knight without armour in a savage land...

#10 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 17 February 2008 - 09:36 AM

Oh, yeah! If this item cost my PC a set of red dragon scale armor, it wouldn't be pretty. :devil:

Seriously, most players are willing to work with you. If they take the armor to a shopkeep for identification, say a special shopkeep who is used to seeing weird things, like Cromwell, and he says "Aye, it don't look like much now, but I'd hang onto it if I were ye. Armor like this has a way o' growin' on ye" the player will probably keep it.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#11 Kwiat_W

Kwiat_W
  • Modder
  • 290 posts

Posted 17 February 2008 - 04:49 PM

And what about a spell with effect 180 (Can't Use Item) casted on everyone except the PC???

icon11.gif W_GUI - a GUI replacement for Baldur's Gate 2/TUTU/BGT/CA
icon11.gif W_PackMule - Your own pack mule for Baldur's Gate 2/Tutu/BGT/CA, BGEE and BG2:EE

icon11.gif Psionics Unleashed - play as a Psion, mod for Baldur's Gate 2/Tutu/BGT/CA

 


#12 Rabain

Rabain

    God

  • Member
  • 653 posts

Posted 17 February 2008 - 05:32 PM

Has anyone tested that? I've a feeling it'd be like effect 181 (never seen to work).

Though it'd be pretty easy to test.

With that you would have to have a script that checks the party every so often using Player2-6 because party members change and casting on all known npc's would need to be updated everytime a new npc appeared on the scene.
A knight without armour in a savage land...

#13 Kwiat_W

Kwiat_W
  • Modder
  • 290 posts

Posted 18 February 2008 - 05:53 AM

Effect 180 works as it's supposed to.

icon11.gif W_GUI - a GUI replacement for Baldur's Gate 2/TUTU/BGT/CA
icon11.gif W_PackMule - Your own pack mule for Baldur's Gate 2/Tutu/BGT/CA, BGEE and BG2:EE

icon11.gif Psionics Unleashed - play as a Psion, mod for Baldur's Gate 2/Tutu/BGT/CA

 


#14 Oldwolf

Oldwolf
  • Member
  • 141 posts

Posted 18 February 2008 - 06:22 AM

The Distructive aspect of fill slot isn't an issue as the Items are ONLY given to the PC upon creation at Candlekeep where the PC has NO items to start with other than the STAF01 lol I'm pretty sure no one would cry over that. As for the translation to BG 2 under BGT the items are placed on the table like the other items for Bring more items component of BGT Tweeks. I've also found that when you create the items on a toon First then do the fill slot it doesn't destroy the items they currently have. I found this out by experimenting with the starting equipment of Jaheira and Khalid in the AR6801 script. I actually had to ActionOverride("Jaheira",DestroyItem("STAF01")) // Quarterstaff to get rid of her staff so I could replace it with a scimitar otherwise the Scimitar would get bounced to her shield slot and she wouldn't recieve her sheild at all :(