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
A few script questions..
SiderealStop Offline
Junior Member

Posts: 32
Threads: 3
Joined: Jun 2012
Reputation: 0
#1
A few script questions..

Still working on figuring out:

This is something that seems like it'd be more complicated...I just don't know how I'd pull it off. My friend and I were thinking of how to start the story. We didn't want to just have our character wake up and be like 'wtf, where am?' and be on with it. We thought about this: He wakes up because he hears crashing or something, something comes into his room, a grunt. The player's vision is not so great, maybe the flashback-type of vision? The player is forced to sit up and look at the creature. It attacks and kills the player. (all happens in a few seconds.) When the player respawns, it'll seem like they'd just been knocked out, but now they're in a different map almost identical to the first, only everything is messy and stuff is knocked over, there's a bit of blood and stuff. Player is rolled up into a sitting position and then you gain control of the player.

Been given tutorials and am working on figuring it all out, but any extra tips/help would be amazing! Thanks~
(This post was last modified: 06-22-2012, 01:25 PM by SiderealStop.)
06-21-2012, 04:50 PM
Find
Nice Offline
Posting Freak

Posts: 3,812
Threads: 37
Joined: Jan 2012
Reputation: 153
#2
RE: A few script questions..

music script is this

void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);


Sorry but we cannot change your avatar as the new avatar you specified is too big. The maximum dimensions are 80x80 (width x height)
06-21-2012, 05:14 PM
Find
SiderealStop Offline
Junior Member

Posts: 32
Threads: 3
Joined: Jun 2012
Reputation: 0
#3
RE: A few script questions..

Thanks for the help! I'm not sure how to put that in and where to put the name of the music file though... Sorry xD Still a bit new to this!

I only have this in the script so far:

void OnStart()
{
}

So where would I put that?
06-21-2012, 05:25 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#4
RE: A few script questions..

void OnStart()
{
}
void OnEnter()
{
PlayMusic("yourmusicnamehere.ogg", true, 2, 0, 10, true);
}
the first true is for looping, e.g. if the sound should loop. It should be true if you want some sort of ambient music, false if you want to use it once.
the 2 is the volume. try different out.

For question 2, is that just a "room" or a whole map where that circle is?
For question 3, you should first look at Your Computer's wake up tutorial(http://www.frictionalgames.com/forum/thread-10798.html), then look at the Engine scripts page([url]http://wiki.frictionalgames.com/hpl2/amn..._functions[/url]) and see how you could do it.
(This post was last modified: 06-21-2012, 05:35 PM by Cruzore.)
06-21-2012, 05:30 PM
Find
SiderealStop Offline
Junior Member

Posts: 32
Threads: 3
Joined: Jun 2012
Reputation: 0
#5
RE: A few script questions..

Thanks so much! The music works! =D



Question 2- Here's what it looks like: http://i1022.photobucket.com/albums/af35...ryRoom.png



Question 3 - Ah thanks! =D I'll update first post if I can figure it
out. I've followed a few tutorials and such and was able to figure out a
few things with this scripting before so I should be able to get it. ^^
06-21-2012, 06:33 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#6
RE: A few script questions..

for question 2, put all the stuff in OnEnter() and delete the "callbackfunctionarea in level editor".
for the patrolling, someone already made a post I believe, use the search option.
06-21-2012, 06:38 PM
Find
SiderealStop Offline
Junior Member

Posts: 32
Threads: 3
Joined: Jun 2012
Reputation: 0
#7
RE: A few script questions..

Ah I had, I must have missed it. Oops ^^

I've looked at quite a few things on patrolling and couldn't find anything that worked. =3 That or I'm a complete idiot and am completely getting the script wrong ;A;

So I tried that and I think I remember doing this before...tried it again anyway, this is how my script now looks. I think I'm doing something wrong:

void onstart()
{
    AddEntityCollideCallback("Player", "PlayerCollide", "servant_grunt_1", true, 1);
}
    OnEnter()
    void MachineryGruntPatrol(string &in asParent , string &in asChild , int alState)
{
    SetEntityActive("servant_grunt_1", true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 1, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}

Then I run the game and load my map, walk down the first hallway and through the level door that brings me to the room with the grunt. The game crashes on the loading screen with this message:

FATAL ERROR: Could not load script file 'my directory/filename.hps'!
ExecuteString (1,1): ERR :no matching signatures to 'OnLeave()'
main (5,9) : ERR :Expected identifier
06-21-2012, 06:52 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#8
RE: A few script questions..

first line, it's OnStart()
not onstart()
also, put a void before OnEnter()
06-21-2012, 06:55 PM
Find
SiderealStop Offline
Junior Member

Posts: 32
Threads: 3
Joined: Jun 2012
Reputation: 0
#9
RE: A few script questions..

I realized I missed the void actually, and I thought OnStart/OnEnter/OnLeave weren't case sensitive?

Anyway this is what it now looks like, and it's still crashing - with the same error message - upon hitting the loading screen:

void OnStart()
{
    AddEntityCollideCallback("Player", "PlayerCollide", "servant_grunt_1", true, 1);
}
void OnEnter()
    void MachineryGruntPatrol(string &in asParent , string &in asChild , int alState)
{
    SetEntityActive("servant_grunt_1", true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 1, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}
06-21-2012, 07:03 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#10
RE: A few script questions..

delete this line:
void MachineryGruntPatrol(string &in asParent , string &in asChild , int alState)
06-21-2012, 07:07 PM
Find




Users browsing this thread: 1 Guest(s)