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
I need help with script!
Scupp Offline
Junior Member

Posts: 14
Threads: 5
Joined: Jul 2012
Reputation: 0
#1
I need help with script!

How can I make script that does something when I have certain items on inventory and certain entities on the floor. In my case I have hammer and saw in my inventory and there's three planks on the floor. My goal is that I can make the items and planks disappear when I click broken ladders on the floor. I made script to that how I bring planks there:


void OnStart()
{
AddEntityCollideCallback("lauta", "lauta_area", "lauta", true, 1);
AddEntityCollideCallback("lauta2", "lauta_area", "lauta2", true, 1);
AddEntityCollideCallback("lauta3", "lauta_area", "lauta3", true, 1);
}
void lauta(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
PlayMusic("impact_wood_low2.ogg", false, 150.00, 0, 0, true);
SetEntityActive("lauta_1", true);
SetEntityActive("lauta", false);
SetEntityActive("lauta_2", true);
SetEntityActive("lauta2", false);
}
}
void lauta2(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
PlayMusic("impact_wood_heavy_low2.ogg", false, 150.00, 0, 0, true);
SetEntityActive("lauta_2", true);
SetEntityActive("lauta2", false);
}
}
void lauta3(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
PlayMusic("impact_wood_heavy_low2.ogg", false, 150.00, 0, 0, true);
SetEntityActive("lauta_3", true);
SetEntityActive("lauta3", false);
}
}

So my problem is now that how can I make any entity clickable so there would be that hand icon and how can I make it do something. I know this might be really hard to imagine without map file but could someone tell me what should I do? I have just learned basics of scripting and this might be kinda early to ask something like this but I could really learn a lot if someone helps me with this. Smile I attach a image here if that helps any...
07-16-2012, 05:51 PM
Find
Traggey Offline
is mildly amused

Posts: 3,257
Threads: 74
Joined: Feb 2012
Reputation: 185
#2
RE: I need help with script!

Moved to development support.
07-16-2012, 06:00 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#3
RE: I need help with script!

To make an entity "clickable" you can use SetEntityInteractionDisabled. Then SetEntityPlayerInteractCallback should work. However, why not make it so the hammer or saw can be used on the planks?

Tutorials: From Noob to Pro
07-16-2012, 08:22 PM
Website Find
Scupp Offline
Junior Member

Posts: 14
Threads: 5
Joined: Jul 2012
Reputation: 0
#4
RE: I need help with script!

(07-16-2012, 08:22 PM)Your Computer Wrote: To make an entity "clickable" you can use SetEntityInteractionDisabled. Then SetEntityPlayerInteractCallback should work. However, why not make it so the hammer or saw can be used on the planks?
I tried that SetEntityInteractionDisabled but somehow I can't make it "clickable"... Could it be that I'm too newbie for this kind of stuff still. By the way I have watched some of your youtube tutorials and I want to thank you about those! That's were I got all started. Smile I guess I should now watch that your scripting basics video carefully because I needed some more newbie info first lol. Just wondering if you aren't too busy could you help me with scripting maybe?
07-16-2012, 08:45 PM
Find




Users browsing this thread: 1 Guest(s)