Frictional Games Forum (read-only)
[SCRIPT] Look at Script function - 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: [SCRIPT] Look at Script function (/thread-11265.html)



Look at Script function - Gamemakingdude - 11-09-2011

Hi, i am trying to make it when you look at an script area a message appears on the screen.



PHP Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
    
//Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
    
if(ScriptDebugOn())
    {
        
GiveItemFromFile("lantern""lantern.ent");
 
        for(
int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i"tinderbox.ent");
    }
    
AddEntityCollideCallback("Player","ScriptArea_1","RollCredits",false,1);
    
AddUseItemCallback("","wooden_bucket_filled_1","ScriptArea_1","PutOutFire"true);
}

void PutOutFire(string &in asItemstring &in asEntity) {
    
SetEntityActive("SignArea_1",false);
    
SetEntityActive("Key_Cabinet",true);
    
DestroyParticleSystem("ParticleSystem_1");
    
SetEntityActive("ScriptArea_1",false);
}

void Fire(string &in asEntityint alState) {
    if(
alState == 1) {
    
SetMessage("Observation""Fire"2.0f);
}
}

void InfectedAppear(string &in asEntity) {
    
SetSwingDoorLocked("cabinet_metal_1"truefalse);
    
SetSwingDoorClosed("cabinet_metal_1"truetrue);
    
AddTimer("0",1.5f,"InfectiveActive");
}

void InfectiveActive(string &in asTimer) {
    
SetEntityActive("character_infected_alpha_1",true);
}
    
////////////////////////////
// Run when entering map
void OnEnter()
{
 
}
 
////////////////////////////
// Run when leaving map
void OnLeave()
{
 


This is what i have. It doesnt show up and i know my lang file is correct. Any one know why?


RE: Look at Script function - Your Computer - 11-09-2011

SetEntityPlayerLookAtCallback


RE: Look at Script function - Gamemakingdude - 11-09-2011

Its doing it from the Level editor?


RE: Look at Script function - Your Computer - 11-09-2011

You should practice doing it through scripts, it would be more maintainable this way.

If you say that your lang file is correct, that you have a category named "Observation" and an entry named "Fire", then in your level editor are you sure you typed in "Fire" in the PlayerLookAtCallback field? Are any .map_cache files interfering?


RE: Look at Script function - palistov - 11-09-2011

Use sign areas. You'll need a lang file entry.

If you want it to disappear after being looked at once, add a lookat callback to the sign area. I believe they do work as script areas as well. You know the drill. If state == 1 set the area inactive or turn on a timer to set the area inactive. Be creative Tongue Enjoy!