Frictional Games Forum (read-only)
Problem with placing item script - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Problem with placing item script (/thread-4909.html)

Pages: 1 2


Problem with placing item script - Neurological - 10-04-2010

I'm trying to do a script for make a static item appear on the map using another one from the inventory. But it refuses to work, so i'm clearly doing something wrong.

Here is what I have OnStart

Code:
AddUseItemCallback("", "neurocheese_poison_1", "AreaPlaceCheese", "ItemCheeseOnPlate", true);      

SetEntityActive("neurocheese_poisonstatic_1", false);

And thats the script that should run after I put the item:

Code:
void ItemCheeseOnPlate(string &in asItem, string &in asEntity)
{
    SetEntityActive("neurocheese_poisonstatic_1", true);
    
    RemoveItem(asItem);
    
    SetLocalVarInt("neurocheese_poisonstatic_1", 1);
}

So first I've putted the neurocheese_poisonstatic_1 on the map, thats what it should appear after putting the item from the inventory on the area. The problem is that I can't interact with the area I created, even if I check the InteractWithItem box.


RE: Problem with placing item script - DamnNoHtml - 10-04-2010

I'm pretty sure static objects are meant to be unable to interact with.


RE: Problem with placing item script - Neurological - 10-04-2010

Yeah, but I want to make the area interactive.


RE: Problem with placing item script - Luis - 10-04-2010

Is the area active as well?


RE: Problem with placing item script - Neurological - 10-04-2010

(10-04-2010, 07:46 AM)Luis Wrote: Is the area active as well?

Yes.


RE: Problem with placing item script - Neurological - 10-05-2010

Bump, still having that problem.


RE: Problem with placing item script - Pandemoneus - 10-05-2010

Maybe you'll need
Code:
* Callback syntax: MyFunc(string &in entity)
*/
void  SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);



RE: Problem with placing item script - Jordo76 - 10-05-2010

Then if you can't make the area interactive,do a script area who's interactive to replace the interactive area you want to create on your static object ?


RE: Problem with placing item script - Entih - 10-05-2010

Alright, so you want to use an item on the area, correct? What does it say when you try to use the item on the area?

If I am correct, it says "No object to use item on" or "Cannot use item this way". This can be one of two things. Either one, you did not check the item interactive flag on the area's entity settings, but it sounds like you did that. It can also be that there was an issue setting up the item and its use callback. Make sure that the item name matches that used in the callback (this is the actual name used in the editor, not the SubItemTypeName used for language file entries) without typos or differences.

In my tests, if the item name for the use callback doesn't match, the item will behave as if the area is not interactive for it. If you already checked all of this, I'm not sure what to suggest without seeing the map and script for myself.


RE: Problem with placing item script - Neurological - 10-05-2010

(10-05-2010, 10:29 PM)Entih Wrote: Alright, so you want to use an item on the area, correct? What does it say when you try to use the item on the area?

If I am correct, it says "No object to use item on" or "Cannot use item this way". This can be one of two things. Either one, you did not check the item interactive flag on the area's entity settings, but it sounds like you did that. It can also be that there was an issue setting up the item and its use callback. Make sure that the item name matches that used in the callback (this is the actual name used in the editor, not the SubItemTypeName used for language file entries) without typos or differences.

In my tests, if the item name for the use callback doesn't match, the item will behave as if the area is not interactive for it. If you already checked all of this, I'm not sure what to suggest without seeing the map and script for myself.

I did all that stuff, the area is a Script area with the interactive flag checked. The problem with the item is that doesn't even highlight when hover the area, this happen with any item.

A summary of what I did.

I've 2 entities:

1 - neurocheese_poison_1 (this is the actual item that is in the invetory)
2 - neurocheese_poisonstatic_1 (this is the one that have to appear on the map, is setted up as Object/Static Object on the entity properties)

So I placed on the map the neurocheese_poisonstatic_1 with the Active box checked. As you see in the script the entity is deactivated OnStart.

Then I create a Script area called AreaPlaceCheese with the Interactive flag checked.

When I go ingame I can't interact with the area with any item, the icon won't glow or anything. Surely I'm missing something, I'm nw to this kind of scripting as I come from Doom 3 modding and is a lot different.