Using an NPC as your inventory

Started by 1337_123f13x35, Sat 18/02/2006 14:56:54

Previous topic - Next topic

1337_123f13x35

How Do I make it so a NPC IS your inventory... Like when you click on it it brings up your inventory and it is the only way to access it For example the luggage in discworld... I want to make the NPC BE the inventory for my character... and no other way to access it... The NPC follows you around all the time....

Basically like discworld.

Ashen

Well, buloght made a module and demo game something like this for a coding competion.

Alternatively, if you don't want anything quite that fancy (it's a dual inventory thing), just script it so interacting with the character turns the Inventory on, and nothing else does - it's not actually that hard.
You'll need to remove code from the Inventory button on the ICONBAR GUI (if you're using it) - and possibly the button itself (btnIconInv) - and from on_key_press in the global script - to disable the Tab key (keycode 9). Looking at them should also tell you what you'll need to add to the character's interaction to turn the Inventory on.
I know what you're thinking ... Don't think that.

1337_123f13x35

Ok I disabled the Iconbar GUI and the like and Now I just need to find out how to script clicking on the NPC makes the Inventory Window coming up...

Well I have an idea that it might be some function used with this:   show_inventory_window();

But what function would that be?

Ashen

BFAQ Entry: Placing your code: The basics.

Basically, it depends on how exactly you want to open the inventory. If any click on the NPC will do it, it goes in the character's 'Any click on character' interaction. If you want it to be a specific cursor mode, it goes in that mode's interaction (e.g. 'Interact with character', 'Look at character').

It might be worth your time tracking down a few basic tutorials (like the one in the manual, or this one on scripting from the Tutorials page), and taking a look through some old posts here on the forums before you go any further - save you asking a question that's already been answered.
I know what you're thinking ... Don't think that.

1337_123f13x35

Hmm I put into show_inventory_window(); into interact with NPC and the game saves and loads up but the Inventory window won't pop up

Ashen

No error messages, though? That's reassuring...

Nothing happens when? Are you using the right mode? (Note: clicking with the 'Walk to' cursor won't work, even if it's in 'Any click'.) Is the NPC set to 'Clickable'? (It should be by default, but worth checking.) Post your code for the character interaction, including the top comment line (in green).
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk