Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using items between levels?
Streetboat Offline
Posting Freak

Posts: 1,099
Threads: 40
Joined: Mar 2011
Reputation: 56
#1
Using items between levels?

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?

[Image: signature-2.png]
07-05-2011, 06:27 PM
Find
DamnNoHtml Offline
Senior Member

Posts: 469
Threads: 34
Joined: Sep 2010
Reputation: 16
#2
RE: Using items between levels?

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.

Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
07-05-2011, 10:47 PM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#3
RE: Using items between levels?

I have the same problem D:
Mine involves keys and doors.
07-06-2011, 04:41 AM
Find
H. Filipe Offline
Junior Member

Posts: 22
Threads: 6
Joined: Jun 2011
Reputation: 0
#4
RE: Using items between levels?

try to put AddUseItemCallback in both levels

E-mail: postal2DeusEx@hotmail.com
Xbox/Live Account: HUGO BOLT 0GTA0

Working on a Custom Story :)
07-06-2011, 12:11 PM
Find
DamnNoHtml Offline
Senior Member

Posts: 469
Threads: 34
Joined: Sep 2010
Reputation: 16
#5
RE: Using items between levels?

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.

Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
07-06-2011, 06:13 PM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#6
RE: Using items between levels?

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.
07-06-2011, 09:14 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#7
RE: Using items between levels?

(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().

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

It might work, it might not.

(This post was last modified: 07-06-2011, 10:31 PM by Kyle.)
07-06-2011, 10:30 PM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#8
RE: Using items between levels?

(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().

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
07-08-2011, 11:05 PM
Find
Streetboat Offline
Posting Freak

Posts: 1,099
Threads: 40
Joined: Mar 2011
Reputation: 56
#9
RE: Using items between levels?

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.

[Image: signature-2.png]
07-08-2011, 11:26 PM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#10
RE: Using items between levels?

This is the only thing stopping me from advancing in my story >:/
last resort would be to ask Frictional Games directly
07-08-2011, 11:42 PM
Find




Users browsing this thread: 1 Guest(s)