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.
I attach a image here if that helps any...