View Full Version : Can I make a placeable into an item?


Dragonfly
Sun, 24th Jul '05, 7:23am
I would like to use a CEP placeable of a pie as an item in my game that you can pick up. Is there a way that I can do this. If I make a custom "item" the little graphic that appears for it is a boring treasure bag but if I could use the graphic from the placeable it would be much better. Can anyone help me with this please?

[ July 26, 2005, 15:08: Message edited by: Taluntain ]

Alavin
Sun, 24th Jul '05, 10:58am
Bioware did it in HotU with their Alchemists' Fire barrels, so it's certainly possible. Give this a go:

object oitem = GetModuleItemLost();
object oPie = GetObjectByTag("Pie");
if (oItem = oPie)
{
CreateObject(OBJECT_TYPE_PLACEABLE, "pieplaceablestrref", GetLocation(oPie));
DestroyObject(oPie);
}

C&P that to the bottom of the OnUnAcquireItem script in Module Properties, and replace the Pie in GetObjectByTag("Pie") with the tag of the pie inventory item, and pieplaceablestrref with the strref of the pie placeable. Should work, although I haven't tested it or anything.

EDIT: Oops, that's for dropping the item to get a pie placeable. For a placeable to item, just do:

CreateItemOnObject("pieitemstrref", GetNearestCreature(PLAYER_CHAR_IS_PC, TRUE));
DestroyObject(GetObjectByTag("Pie"));

in the placeable's OnUsed script. Make sure the placeable's set to Useable first. ;) pieitemstrref refers to the item's strref, and Pie is the placeable's tag. I hope I understood this time... it's too early for me.

Dragonfly
Mon, 25th Jul '05, 5:22am
Thanks Alavin. I tried the script and made sure my placeable was checked usable but it did not work for me when I compiled. This is what I typed into the "on used" area.

void main()

object oitem = GetModuleItemLost();
object oPie = GetObjectByTag(ZEP_PIE002);
if (oItem = oPie)
{
CreateItemOnObject("pieitemstrref", GetNearestCreature(PLAYER_CHAR_IS_PC, TRUE));
DestroyObject(GetObjectByTag("ZEP_PIE002"));


}


When I tried to save and compile I got this error message:
PM:Error. 'makepietoitem' did not compile. makepietoitem.nss(3) : ERROR: UNKNOWN STATE IN COMPILER

So what did I do wrong?

Rotku
Mon, 25th Jul '05, 6:58am
void main()
{
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
CreateItemOnObject("pieitemstrref", oPC);
object oTarget;
oTarget = OBJECT_SELF;
DestroyObject(oTarget, 0.0);
}

That should work. If I understand right you shouldn't need the If command.

Dragonfly
Tue, 26th Jul '05, 5:16am
The script compiled successfully. When I sent my PC to pick it up it disappeared nicely. The only problem was that it didn't appear in the inventory. I also realized that it will not replace the custom plot item that I already created so I don't think I'll be able to make this work. I appreciate the script though, and might be able to use it for a different purpose.

I'm not sure how, but I think I would actually have to replace the 3D graphic of a bag on my "apple pie" item to the graphic that is used by the placeable item of a pie.

Rotku
Tue, 26th Jul '05, 11:07am
Hmm... prehaps I'm understanding you wrong then. I was just looking at your script, as the other stuff in the first post went right over my head.
What that script should do is, when the placeable is used: Creates an item with the resref "pieitemstrref" Destroies the placeable that the script was on.If you wanted something different, prehaps you could try explaining it again. Might get through my thick skull this time round ;)

[ July 26, 2005, 11:48: Message edited by: Rotku ]

Dragonfly
Wed, 27th Jul '05, 6:52am
You don't have a thick skull, I have a thick tongue.

I have a custom item that I have created in the game. It is a pie. This pie has to be retrieved and delivered to aquire some gold and xp. I was able to find a small graphic of a pie to use as the image that appears in the inventory screen. It is the 3D image to the left on the item editor screen that I wish to change.

If I place the item on my map screen it will appear as a loot bag. I have found a graphic of a pie in the "placeables" that would look much better then the loot bag. Your script worked nicely to "pick up" the pie and make it disappear but I realized that instead of altering the placeable maybe there was a way I could alter the custom made item so that it could have the 3D graphic of the pie placeable. The tag I used in the script is the exact tag that the creator of that custom placeable gave it. It is from the CEP.

I hope I was a little bit more clear about my intentions. Sorry for the confusion.

Rotku
Mon, 1st Aug '05, 5:08am
Ah! Well, I'm afraid I have no idea how that would be done. I'm guessing you'll need a 3D editor and to create a Hak - but don't quote me on that.

Dragonfly
Mon, 1st Aug '05, 8:51am
Well thanks for getting back to me. I think I can stop worrying about it now and just get over it. I'll just hide the pie in a chest or something. I did like the script you gave me though. Its always good to be able to make things disappear when you touch them. Wish that would work with my bills.