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
I Just Don't Understand
Tottel Offline
Senior Member

Posts: 307
Threads: 9
Joined: Nov 2010
Reputation: 0
#4
RE: I Just Don't Understand

It can be very overwhelming if you have no experience with things like this. Trial and error is probably the best way to learn. Smile

Although, we can still help you though. In short, this is what you do:

1. You place an area-script in your map. This doesn't do anything yet, because there's no script linked to it. Give this entity a clear name, since you will use it to make it do something in the script.

2. You should have a script file linked with your map (same folder as your map, MapName.hps, with default stuff in it. See wiki).

3. In AtStart(), place
void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

in between those curly parenthesis. This will make your script aware there's an area that will be triggered once you move into it.
Now, note that what you see above is a general method. To make it work for you, you need to FILL IN what you have. It's good to know what it all means:
asParentName, here you fill in WHAT will trigger the area, in the form of a STRING (because of the 's' in front of ParentName). so, for example: "Player" (for a string, you always put "").
asChildName, is the name of your area in the level editor; again as a STRING, so "".
Now, the next one is very important as well, it is the name of the function that will be called when you trigger the area (you could see it as: Where do I jump to in the script; what scripts do I run when the player enters the area). Name this something logically and related to what happens, you don't HAVE to do this, but it helps if you're getting more and more lines to quickly find it back and know what it is.
And so on..

4. Make a new function with the name of asFunction, which you filled in in AddEntityCollideCallback();

For example:

void CollideTriggerSound(string &in asParent, string &in asChild, int alState)
{
    ...
}


In my case, the function is named "CollideTriggerSound", since it will trigger a sound once the player collides with the area. Note that the name could have been picked even better: where is it triggered, ..?

In this case, you leave: string &in asParent, string &in asChild, int alState
Those are called parameters, and they get a value assigned when you call the function. Which you do when you trigger the area, and it gets the values that you've put in AddEntityCollideCallback().

5. Put in this function what you want to happen when you trigger the area.

6. All done. Smile
(This post was last modified: 01-16-2011, 12:29 PM by Tottel.)
01-16-2011, 12:29 PM
Find


Messages In This Thread
I Just Don't Understand - by Crunchygoblin - 01-15-2011, 11:30 PM
RE: I Just Don't Understand - by Tanshaydar - 01-16-2011, 03:34 AM
RE: I Just Don't Understand - by Crunchygoblin - 01-16-2011, 12:11 PM
RE: I Just Don't Understand - by Tottel - 01-16-2011, 12:29 PM
RE: I Just Don't Understand - by Makiavel - 01-16-2011, 09:33 PM
RE: I Just Don't Understand - by Crunchygoblin - 01-17-2011, 09:19 AM
RE: I Just Don't Understand - by Andross - 01-17-2011, 10:20 AM
RE: I Just Don't Understand - by Crunchygoblin - 01-17-2011, 09:38 PM
RE: I Just Don't Understand - by Tottel - 01-17-2011, 09:50 PM
RE: I Just Don't Understand - by Andross - 01-18-2011, 11:21 PM
RE: I Just Don't Understand - by Equil - 01-19-2011, 07:09 AM



Users browsing this thread: 1 Guest(s)