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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with placing item script
Neurological Offline
Member

Posts: 71
Threads: 11
Joined: Sep 2010
Reputation: 1
#1
Problem with placing item script

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

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

SetEntityActive("neurocheese_poisonstatic_1", false);

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

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.

Neurological - Music Entertainment
http://www.neuro-lab.net
10-04-2010, 01:02 AM
Find
DamnNoHtml Offline
Senior Member

Posts: 469
Threads: 34
Joined: Sep 2010
Reputation: 16
#2
RE: Problem with placing item script

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

Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
10-04-2010, 01:09 AM
Find
Neurological Offline
Member

Posts: 71
Threads: 11
Joined: Sep 2010
Reputation: 1
#3
RE: Problem with placing item script

Yeah, but I want to make the area interactive.

Neurological - Music Entertainment
http://www.neuro-lab.net
10-04-2010, 01:12 AM
Find
Luis Offline
Frictional Games

Posts: 280
Threads: 19
Joined: Jun 2006
Reputation: 9
#4
RE: Problem with placing item script

Is the area active as well?

EOF
10-04-2010, 07:46 AM
Find
Neurological Offline
Member

Posts: 71
Threads: 11
Joined: Sep 2010
Reputation: 1
#5
RE: Problem with placing item script

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

Yes.

Neurological - Music Entertainment
http://www.neuro-lab.net
10-04-2010, 09:23 AM
Find
Neurological Offline
Member

Posts: 71
Threads: 11
Joined: Sep 2010
Reputation: 1
#6
RE: Problem with placing item script

Bump, still having that problem.

Neurological - Music Entertainment
http://www.neuro-lab.net
10-05-2010, 05:25 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#7
RE: Problem with placing item script

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

10-05-2010, 06:16 PM
Find
Jordo76 Offline
Member

Posts: 57
Threads: 7
Joined: Sep 2010
Reputation: 0
#8
RE: Problem with placing item script

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 ?
10-05-2010, 09:43 PM
Website Find
Entih Offline
Junior Member

Posts: 47
Threads: 4
Joined: Sep 2010
Reputation: 0
#9
RE: Problem with placing item script

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.
10-05-2010, 10:29 PM
Find
Neurological Offline
Member

Posts: 71
Threads: 11
Joined: Sep 2010
Reputation: 1
#10
RE: Problem with placing item script

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

Neurological - Music Entertainment
http://www.neuro-lab.net
10-05-2010, 11:29 PM
Find




Users browsing this thread: 1 Guest(s)