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
function not working, is something wrong?
Tryed Offline
Junior Member

Posts: 10
Threads: 3
Joined: Feb 2011
Reputation: 0
#1
function not working, is something wrong?

I wanted to make an event when the player uses a glass jar on an Area, so he leaves the jar on the ground to fill it with dripping oil.

First of all, how can I do it so the player can use an item on an Area? It just doesn't highlight the item when I come close to the area with the item equipped.

Well I couldnt figure this out so I tried out using it on a hatch just to see if the rest worked. But the rest didn't work.

this is under void OnStart:

AddUseItemCallback("", "container1", "hatch_metal01_2", "JarUsed", false);

then

void JarUsed (string &in asItem, string &in asEntity)
{
     StartPlayerLookAt("Jar1", 3, 3, "");
     RemoveItem("container1");
    
     AddTimer("111", 2, "TimerLookAtEvents");
}

Firstsly, when I used the jar on the hatch, it simply disappeared and he wouldnt even look at the Jar1 Area. Then I played around with the code and it ended up like it is above, but now when I try to use the jar on the hatch, it won't even use it, it says "Cannot use the item this way" and nothing happens.

Its weird because I used the same drill when you use a key on a door, and it works. I learned it from the video tutorial on the wiki on how to use a key on a door.

Can someone help me out? I'm lost Sad[/code]
02-14-2011, 04:09 PM
Find
Mofo Offline
Member

Posts: 71
Threads: 4
Joined: Sep 2010
Reputation: 2
#2
RE: function not working, is something wrong?

Quote:AddUseItemCallback("", "container1", "hatch_metal01_2", "JarUsed", false);

Put this inside the onEnter instead of the onStart.
02-14-2011, 10:48 PM
Find
Tryed Offline
Junior Member

Posts: 10
Threads: 3
Joined: Feb 2011
Reputation: 0
#3
RE: function not working, is something wrong?

thanks Big Grin
any idea on how to make it so I can use the item on an Area instead of an entity?
02-15-2011, 01:36 AM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#4
RE: function not working, is something wrong?

Create a scriptarea in the map editor. In the settings of that area you can add item interaction.
Then add that scriptarea in your AddUseItemCallback.

[Image: mZiYnxe.png]


02-16-2011, 04:38 AM
Find
Tryed Offline
Junior Member

Posts: 10
Threads: 3
Joined: Feb 2011
Reputation: 0
#5
RE: function not working, is something wrong?

Thanks, that worked. Also, another problem came up. Its the same problem I had when using the jar on the hatch, but now putting the function in OnEnter wont work either.

void LeverUsed (string &in asItem, string &in asEntity)
{
     SetPropObjectStuckState("lever_small01_1", 0);
     CreateParticleSystemAtEntity("oilused", "sh", "area_leveroil", false);
     PlaySoundAtEntity("", "16_grease_lever", "area_leveroil", 0, false);
}

void OnEnter()
     {
AddUseItemCallback("", "oiljar", "lever_small01_1", "LeverUsed", false);
}
The only thing that works in this function is the sound. Whats going on here???
(This post was last modified: 02-16-2011, 05:14 PM by Tryed.)
02-16-2011, 05:13 PM
Find
Selyp Offline
Member

Posts: 210
Threads: 19
Joined: Feb 2011
Reputation: 7
#6
RE: function not working, is something wrong?

Not sure about the SetPropObjectStuckState, but for the Particle System you have to specify the name of the particle system file you want to create

example :
CreateParticleSystemAtEntity ("oilused", "ps_steam.ps" "area_leveroil", false);

Oilused is the name of the particle system being created, ps_steam.ps is the name of the file for the particle system (whatever file you want to use) and area_leveroil is the name of the entity at which you are creating it.
02-17-2011, 01:14 AM
Find
Tryed Offline
Junior Member

Posts: 10
Threads: 3
Joined: Feb 2011
Reputation: 0
#7
RE: function not working, is something wrong?

I realised I was typing a wrong .ps file name. Oh well.

Anyway, I want the lever to be unstuck after I use the oil and it's not working
02-17-2011, 03:56 PM
Find




Users browsing this thread: 1 Guest(s)