Frictional Games Forum (read-only)

Full Version: Look at Script function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
SetEntityPlayerLookAtCallback
Its doing it from the Level editor?
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?
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!