Jump to content

Spawn an item at a certain location?


Salk

Recommended Posts

Hello!

I was wondering if there is a way for me to spawn an item on the ground at certain coordinates.

CreateItem() seems to require a creature as parameter. I guess I could spawn a creature with the item in the inventory and then destroy it?

Sounds macabre and quite unintuitive though... 😄

Edited by Salk
Link to comment

I think it's the only way to get an item on the ground during the game. The cre could also drop the item with DropItem(S:Object*,P:Location*) and then despawn. 😉

Danger is that if the player doesn't pick it up, the item will be gone after being away from the area for a certain amount of time.

The item could also be edited into the are file upon installation. I don't think that activate/deactivate really works for containers, though. I think they highlight although the player cannot interact with them or something - I have no experience with it, though.

 

Link to comment

Thanks for your help, jastey.

If the item is a plot item it should not ever disappear from the map though, right?

Do you happen to know how to enable the plot item flag via WeiDU?

But if I could edit the item into the area file then that'd be great. But I'd need to create a container for it, if I am not mistaken?

 

Edited by Salk
Link to comment
38 minutes ago, Salk said:

Do you happen to know how to enable the plot item flag via WeiDU?

Assuming you want the item in question to be movable, displayable in shop, magical and NON 2-handed, I think this could work:

COPY_EXISTING ~ITEM.itm~ ~override~
 WRITE_SHORT 0x18 109
BUT_ONLY

I'm assuming it's an existing item because you want to modify it via WEIDU and not merely by dropping it into override after editing it in DLTCEP (which would be much simpler).

If not, you'll have to use COPY instead and point to the directory's location.

 

Quote

But if I could edit the item into the area file then that'd be great. But I'd need to create a container for it, if I am not mistaken?

You could use an already existing container and add the item to it (you can find an example in my mod). For creating new containers, try looking one of Lava's mods, I believe he usually does this.

Edited by Daulmakan
Link to comment

There's also example code in Aurora's Shoes and Boots for the Larswood area to turn the stone in the middle of the circle to a container. Sure, that is tied to the goblin encounter's result in the same area but it's a start.

Edited by Graion Dilach
Link to comment

Well, I installed BG:EE to check how they did things there with the Colquetle's Family Amulet and apparently they spawned three dead corpses representing, Mr Colquetle's son, his wife and their child. And they added a container on top of Mr Colquetle's son's body.

I think a much more elegant solution would be to make Mr Colquetle's son's body the actual container; we have several examples of something similar being down by Bioware. But unfortunately I have not the skills to implement via WeiDU so if anybody can help me out with this, I'd really appreciate it.

Link to comment
3 minutes ago, Salk said:

a much more elegant solution would be to make Mr Colquetle's son's body the actual container; we have several examples of something similar being down by Bioware.

Can you elaborate, or give an example from the game? I don't fully get what exactly you mean.

Link to comment

@Daulmakan,

thanks for the advice. If I cannot find a way to go for the best solution (see above), then I guess I could follow your advice but the item is not magical. The current flags are: droppable (2), displayable (3) and not copyable (5).

I want to make it a plot item so that it wouldn't disappear if spawned but at the same time, for narrative reasons, it cannot be made unsellable. So perhaps there is no possibility this way. 

Link to comment

Hello jastey!

Just now, jastey said:

Can you elaborate, or give an example from the game? I don't fully get what exactly you mean.

Yes, of course.

I mean that players can use TAB to highlight map areas that are interactable, including containers. There are many such examples in the game. It could be a particular area from a bookshelf, for example. By clicking just there the inventory for that particular area would be displayed and the player would find a book there.

Or it could be a hole in a tree in the forest. You click on it and you find a hidden ring of wizardry... 🙂

Link to comment
Just now, Salk said:

I want to make it a plot item so that it wouldn't disappear if spawned but at the same time, for narrative reasons, it cannot be made unsellable. So perhaps there is no possibility this way.

Hmm, if the item is in a "container" that is a pile it could be sellable (i.e. not ticked as critical) and would remain.

If you want a critical (i.e. not disappearing) item just on the floor, you could do something like put a "box" there the PC has to "open". This would make two items, the box being replaced by the actual item which could be sellable/non-critical. it's a bit of work though, I think I'd prefer adding a pile-cpntainer in that case (if it makes sense that the item on the floor is there from the start).

Non-critical item also means an NPC can vanish with it in inventory, but I guess you are aware of that.

Link to comment
1 minute ago, Salk said:

I mean that players can use TAB to highlight map areas that are interactable, including containers. There are many such examples in the game. It could be a particular area from a bookshelf, for example. By clicking just there the inventory for that particular area would be displayed and the player would find a book there.

Or it could be a hole in a tree in the forest. You click on it and you find a hidden ring of wizardry...

How is what BeamDog did for the ring different to this? I don't get what you mean with "added a container on top" vs. "make the body the container". What is the differences technical wise and for the player ingame?

Link to comment

Well, I didn't check this in-game, jastey,

I simply opened the BG:EE .ARE file in Near Infinity (AR4300). The three bodies are listed as "Actors" and have no inventory. The item (Amulet) instead is in a container classified as "Pile". One other class for container is "Body" . 

And that was exactly what I was hoping for. To make one of the three body the container for the amulet.

From what I can see inside NI, I don't think that is what Beamdog did. Or am I wrong?

Link to comment

Ah, you mean change the container type from Pile(4) to Body(10). Ingame, this should change the picture displayed when opening the "container" on the inventory sceen.

I guess it could be done by editing the are file and writing the correct offset, but I am not firm with these kind of Weidu ninja-ings.

If you want to insert a "body" container for a mod, it should be possible to define the type as Body from the start.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...