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
Custom Stories I want to do but unable to
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#7
RE: Custom Stories I want to do but unable to

(02-05-2013, 04:11 PM)The Rock Worm Wrote: Now let's see if I understand this correctly. Let's say we have a script coding called "RandomNotes". I then make a the script area in the LevelEditor (represented by a red box) also called "RandomNotes". Would this mean the coding knows to start once you enter the script area of the same name?

Ohhh, thats what you meant by script box Tongue Ignore what I said then.

There are two ways of 'connecting' a script area to a piece of code.
Lets say you have a function called 'RandomNotes', and the script area called 'SA_RandomNotes' (the SA stands for 'script area', to make it obvious what it is)
For me, the simplest way to connect these two is like this...

void OnStart()
{
AddEntityCollideCallback("Player", "SA_RandomNotes", "RandomNotes", true, 0);
}

void RandomNotes(string &in strParent, string &in strChild, int inState)
{
// stuff happens when you go into script area
}

The line in OnStart, 'AddEntityCollideCallback', basically means that when the first item on the list ("Player") comes into contact with the second ("SA_RandomNotes"), it 'activates' (or, 'calls') the function named in the third ("RandomNotes").

The other way of doing it is within the level editor, if you select the script area and go to the 'Area' tab (think its called area, sorry at work at the moment so can't check!), you can add the collide callback by writing the function name that you want to activate into the appropriate box. This I don't personally like, as it makes things more complicated if you want to change the function names (you'll need to remember to change them in the level editor too, rather than just the hps)

02-05-2013, 04:46 PM
Find


Messages In This Thread
RE: Custom Stories I want to do but unable to - by Adrianis - 02-05-2013, 04:46 PM



Users browsing this thread: 1 Guest(s)