Frictional Games Forum (read-only)
Using items between levels? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Using items between levels? (/thread-8973.html)

Pages: 1 2


Using items between levels? - Streetboat - 07-05-2011

I was trying to make an item be usable in a different level than it's picked up in, but the AddUseItemCallback function doesn't seem to work. I put the code in the OnStart section, and the item just says 'Item can't be used here' when I use it. Is there something I have to do with global variables?


RE: Using items between levels? - DamnNoHtml - 07-05-2011

Items are able to be used throughout levels...not sure what you're doing wrong. Make sure the names match up exactly.

Are you doing the callback in the level where the item is USED or PICKED UP.


RE: Using items between levels? - Zypherzemus - 07-06-2011

I have the same problem D:
Mine involves keys and doors.


RE: Using items between levels? - H. Filipe - 07-06-2011

try to put AddUseItemCallback in both levels


RE: Using items between levels? - DamnNoHtml - 07-06-2011

You only need the callback on the room with which the item is to be used. The game checks if the item's String (name) matches the callback parameters.

I didn't do anything special in my last story, and had a key in a completely separate area that opened a door elsewhere.


RE: Using items between levels? - MrBigzy - 07-06-2011

If you have multiple places where an item MIGHT be used, you can make a script called global.hps and put the callback in there. You can also make one called inventory.hps for combining items and such in multiple levels. Look up Frictional's scripts with the same name for examples; the function names are slightly different for those hps files.


RE: Using items between levels? - Kyle - 07-06-2011

(07-06-2011, 09:14 PM)MrBigzy Wrote: If you have multiple places where an item MIGHT be used, you can make a script called global.hps and put the callback in there. You can also make one called inventory.hps for combining items and such in multiple levels. Look up Frictional's scripts with the same name for examples; the function names are slightly different for those hps files.

I remember that I tried that once and it just never would work. :/

I have a suggestion, how about in the second level from where you use the item add this in your void OnStart().

Code:
void OnStart()
{
     if (HasItem("ItemName") == true)
     {
          RemoveItem("ItemName");
          GiveItem("ItemName");
     }
}

It might work, it might not.


RE: Using items between levels? - Zypherzemus - 07-08-2011

(07-06-2011, 10:30 PM)Kyle Wrote:
(07-06-2011, 09:14 PM)MrBigzy Wrote: If you have multiple places where an item MIGHT be used, you can make a script called global.hps and put the callback in there. You can also make one called inventory.hps for combining items and such in multiple levels. Look up Frictional's scripts with the same name for examples; the function names are slightly different for those hps files.

I remember that I tried that once and it just never would work. :/

I have a suggestion, how about in the second level from where you use the item add this in your void OnStart().

Code:
void OnStart()
{
     if (HasItem("ItemName") == true)
     {
          RemoveItem("ItemName");
          GiveItem("ItemName");
     }
}

It might work, it might not.

Ok, so the command works, but when I try to use the key on the level door, it says "Item cannot be used this way!" D:
all of the signatures match and everything is correct in the .lang file, but it still doesn't work


RE: Using items between levels? - Streetboat - 07-08-2011

That's my problem as well. It's frustrating, because it's such a 'simple' problem, and I can't even tell if I'm doing something wrong. I know for a fact Frictional had items that were used in separate levels from which they were obtained, but... I can't figure out how to make that happen.


RE: Using items between levels? - Zypherzemus - 07-08-2011

This is the only thing stopping me from advancing in my story >:/
last resort would be to ask Frictional Games directly