Frictional Games Forum (read-only)
[SCRIPT] AddUseItemCallback on entities that are not doors/chests - 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: [SCRIPT] AddUseItemCallback on entities that are not doors/chests (/thread-20857.html)



AddUseItemCallback on entities that are not doors/chests - ClayPigeon - 03-22-2013

Hey. I was wondering, how could I use AddUseItemCallback on entities that are NOT doors, chests, level doors and so on? E.G: Using a key on a table.


RE: AddUseItemCallback on entities that are not doors/chests - Wapez - 03-22-2013

Same way.

PHP Code:
AddUseItemCallback("""key_1""table_1""UsedKeyOnTable"true); 



RE: AddUseItemCallback on entities that are not doors/chests - ClayPigeon - 03-22-2013

(03-22-2013, 10:18 PM)Wapez Wrote: Same way.

PHP Code:
AddUseItemCallback("""key_1""table_1""UsedKeyOnTable"true); 

I wish angelscript thought the same way but frankly, it doesn't :/
When I try doing this I end up getting the "No object to use item on!" message.


RE: AddUseItemCallback on entities that are not doors/chests - Wapez - 03-22-2013

Then I advice you add a scriptarea around the object you want the player to use the item on, in this case the table. Then you can use the key on the scriptarea, but it feels like the table.

PHP Code:
AddUseItemCallback("""key_1""scriptarea_1""UsedKeyOnTable"true); 



RE: AddUseItemCallback on entities that are not doors/chests - ClayPigeon - 03-22-2013

(03-22-2013, 10:33 PM)Wapez Wrote: Then I advice you add a scriptarea around the object you want the player to use the item on, in this case the table. Then you can use the key on the scriptarea, but it feels like the table.

PHP Code:
AddUseItemCallback("""key_1""scriptarea_1""UsedKeyOnTable"true); 

Actually I tried doing this before the actual table idea but it didn't work as well. Any other ideas?


RE: AddUseItemCallback on entities that are not doors/chests - Wapez - 03-22-2013

I don't see why it shouldn't work?


RE: AddUseItemCallback on entities that are not doors/chests - ClayPigeon - 03-22-2013

(03-22-2013, 10:39 PM)Wapez Wrote: I don't see why it shouldn't work?

Me neither but it just won't...


RE: AddUseItemCallback on entities that are not doors/chests - NaxEla - 03-22-2013

(03-22-2013, 10:36 PM)ClayPigeon Wrote:
(03-22-2013, 10:33 PM)Wapez Wrote: Then I advice you add a scriptarea around the object you want the player to use the item on, in this case the table. Then you can use the key on the scriptarea, but it feels like the table.

PHP Code:
AddUseItemCallback("""key_1""scriptarea_1""UsedKeyOnTable"true); 

Actually I tried doing this before the actual table idea but it didn't work as well. Any other ideas?

In the properties for the area, there's a box that you need to tick so that it lets you use items on the area. I can't remember what it's called though, sorry.


RE: AddUseItemCallback on entities that are not doors/chests - Wapez - 03-22-2013

Oh yes, I forgot to tell you. In the area tab there is an option called "ItemInteraction". You have to check that.


RE: AddUseItemCallback on entities that are not doors/chests - ClayPigeon - 03-22-2013

(03-22-2013, 10:41 PM)NaxEla Wrote:
(03-22-2013, 10:36 PM)ClayPigeon Wrote:
(03-22-2013, 10:33 PM)Wapez Wrote: Then I advice you add a scriptarea around the object you want the player to use the item on, in this case the table. Then you can use the key on the scriptarea, but it feels like the table.

PHP Code:
AddUseItemCallback("""key_1""scriptarea_1""UsedKeyOnTable"true); 

Actually I tried doing this before the actual table idea but it didn't work as well. Any other ideas?

In the properties for the area, there's a box that you need to tick so that it lets you use items on the area. I can't remember what it's called though, sorry.

Oh!
It works now, thank you so much Smile