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
Script Help Look at Script function
Gamemakingdude Offline
Senior Member

Posts: 470
Threads: 82
Joined: Nov 2010
Reputation: 9
#1
Look at Script function

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



PHP Code: (Select All)
////////////////////////////
// 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?

Rep if like me or im helpful or you love my stories!
Stephanos house
11-09-2011, 09:56 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Look at Script function

SetEntityPlayerLookAtCallback

Tutorials: From Noob to Pro
11-09-2011, 01:28 PM
Website Find
Gamemakingdude Offline
Senior Member

Posts: 470
Threads: 82
Joined: Nov 2010
Reputation: 9
#3
RE: Look at Script function

Its doing it from the Level editor?

Rep if like me or im helpful or you love my stories!
Stephanos house
11-09-2011, 01:30 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Look at Script function

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?

Tutorials: From Noob to Pro
11-09-2011, 01:43 PM
Website Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#5
RE: Look at Script function

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!

11-09-2011, 07:29 PM
Find




Users browsing this thread: 1 Guest(s)