Frictional Games Forum (read-only)
I need help with 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: I need help with script! (/thread-17029.html)



I need help with script! - Scupp - 07-16-2012

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


RE: I need help with script! - Traggey - 07-16-2012

Moved to development support.


RE: I need help with script! - Your Computer - 07-16-2012

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?


RE: I need help with script! - Scupp - 07-16-2012

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