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
Need some brief help.
PurpelPumpkin Offline
Junior Member

Posts: 5
Threads: 1
Joined: Sep 2011
Reputation: 0
#4
RE: Need some brief help.

(09-03-2011, 04:20 PM)PurpelPumpkin Wrote:
(09-03-2011, 02:57 PM)rybray Wrote: http://wiki.frictionalgames.com/hpl2/amn..._functions

All script usually has

OnStart() for when you are loading the map
{
}

OnEnter() for when your character enters the map
{
}

OnLeave() for when you leave the map
{
}

Not all functions need go inside those brackets however. You can have a function in between them, but if the function does not reside in brackets you must put void before the function, like this

void SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

But a function like this will most likely be in OnStart, like this

OnStart()
{
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
}

Which coincidentally is the script function you would use to have something happen when you pick up an item. Look at the link above and find out what you put in the (string& asName, string& asCallback, bool abRemoveOnInteraction) section.

Be careful at the string& asCallback part, the name you put here must match the function that occurs when you pick the key up. like....

OnStart()
{
SetEntityPlayerInteractCallback("key", "spawnmonster", true);
}

void spawnmonster(string &in asEntity)
{
What you want to happen.
}

Make sure to take a look at the link at the top of the post, if you haven't already.
So everything I want to be loaded when I start has to be in "void OnStart"?

Or do I have to make different sections for all the commands?
That's what I'm trying to understand, say, if I have another thing programmed before, and there is a } after it, do I just remove that and add things underneath the previous scripted thing and add the } after the next command?


My script file looks like this currently:

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
}<--- Do I remove this and keep adding or do I keep adding directly after it? Or, am I completely off track?

09-03-2011, 11:32 PM
Find


Messages In This Thread
Need some brief help. - by PurpelPumpkin - 09-03-2011, 09:34 AM
RE: Need some brief help. - by rybray - 09-03-2011, 02:57 PM
RE: Need some brief help. - by PurpelPumpkin - 09-03-2011, 04:20 PM
RE: Need some brief help. - by PurpelPumpkin - 09-03-2011, 11:32 PM
RE: Need some brief help. - by Selyp - 09-04-2011, 12:38 AM
RE: Need some brief help. - by PurpelPumpkin - 09-04-2011, 10:06 AM
RE: Need some brief help. - by PurpelPumpkin - 09-04-2011, 12:50 PM



Users browsing this thread: 1 Guest(s)