Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help How to achieve this scenario?
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#11
RE: How to achieve this scenario?

(02-01-2013, 04:09 AM)serbusfish Wrote: Thanks for being patient with me, but something is still wrong because I pasted that exact code and the game throws up an error message saying 'ERR - expected '('.

It must have something to do with the line

"void BreakPotPlant(string &in asParent, string &in asChild, int alState)"

because the map loads when this is deleted. Am I supposed to replace the text in this line?

If it helps here is the entire content of my .hps file so far:

//===========================================
     // This runs when the map first starts
     void OnStart()
{

        if(ScriptDebugOn())

        
    {
              
       GiveItemFromFile("tinderbox", "tinderbox.ent);
              AddEntityCollideCallback("Player", "ScriptArea_2", "BreakPotPlant", true, 1);
                
     }         
  
}        
      
                     void BreakPotPlant(string &in asParent, string &in asChild, int alState)
                         {
                             SetPropHealth("pot_plant_small02_1", 0);
                         }

     //===========================================
     // This runs when the player enters the map
     void OnEnter()
   {
  
   //----AUDIO----//
    PlayMusic("10_amb", true, 5, 1, 0, true);
}
     //===========================================
     // This runs when the player leaves the map
     void OnLeave()
     {
     }

There, fixed it.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
02-01-2013, 10:28 AM
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#12
RE: How to achieve this scenario?

With your version it gives me the error 'Unexpected end of file', any ideas? Even to this n00b your code looks right.

EDIT: Fixed it! The tinderbox line was missing a ".

Im getting closer, now I need to try and make the camera look Smile

(This post was last modified: 02-01-2013, 05:17 PM by serbusfish.)
02-01-2013, 05:04 PM
Find
Kreekakon Offline
Pick a god and pray!

Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation: 124
#13
RE: How to achieve this scenario?

(02-01-2013, 05:04 PM)serbusfish Wrote: With your version it gives me the error 'Unexpected end of file', any ideas? Even to this n00b your code looks right.

That probably means that one of the brackets in the code is out of place. Go check to see if all of them all have proper corresponding ones.

Notepad++ thankfully makes this extremely easy.

[Image: Tv0YgQb.gif]
Image by BandyGrass
(This post was last modified: 02-01-2013, 05:18 PM by Kreekakon.)
02-01-2013, 05:17 PM
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#14
RE: How to achieve this scenario?

Well so far so good, I managed to make it so the pot breaks, the player looks, a monster growls, and a few secs later a door shuts. (I changed the monster walk to a growl as you couldnt hear the footsteps over the background music).

Now, sorry to be a pain again but rather than make another thread I was wondering if one of you kind gents could help me make a lever open a locked door? Does it have anything to do with this command?:

void SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);

I am getting more used to the scripting enviroment, but im not sure in this particular instance how you link the lever to the door I want opened?

02-03-2013, 03:58 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#15
RE: How to achieve this scenario?

Oh, just:

void OnStart()
{
SetEntityConnectionStateChangeCallback("Lever", "Call");
}

void Call (string &in asEntity, int alState)
{
SetSwingDoorLocked("Door", false, true);
}

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
02-03-2013, 11:54 AM
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#16
RE: How to achieve this scenario?

(02-03-2013, 11:54 AM)The chaser Wrote: Oh, just:

void OnStart()
{
SetEntityConnectionStateChangeCallback("Lever", "Call");
}

void Call (string &in asEntity, int alState)
{
SetSwingDoorLocked("Door", false, true);
}

Thank you i'll give it a try Big Grin

02-05-2013, 03:29 AM
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#17
RE: How to achieve this scenario?

Update, I must be doing something wrong because the game wont load, here is what ive got:

void OnStart()
{


        if(ScriptDebugOn())
        SetEntityConnectionStateChangeCallback("lever_small01_1", "Call");
     }  
        void Call(string &in asEntity, int alState)
            
            {
            SetSwingDoorLocked("castle_arched01_6", false, true);
            }

What did I do?

02-08-2013, 02:33 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#18
RE: How to achieve this scenario?

What exactly is it you want with this line: "if(ScriptDebugOn())"?
It isn't used in any way, and it is probably the one that crashed the game.

Trying is the first step to success.
02-08-2013, 06:45 AM
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#19
RE: How to achieve this scenario?

(02-08-2013, 06:45 AM)BeeKayK Wrote: What exactly is it you want with this line: "if(ScriptDebugOn())"?
It isn't used in any way, and it is probably the one that crashed the game.

I dont know it was included in the tutorial script. I'll remove it and see what happens, but apart from that does my script look ok?

02-08-2013, 01:48 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#20
RE: How to achieve this scenario?

Yea it doesn't look like there should be any problems if you delete the line i specified.

Trying is the first step to success.
02-08-2013, 03:37 PM
Find




Users browsing this thread: 4 Guest(s)