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 need help with creating more than 1 scripts for my custom story
ironman0001 Offline
Member

Posts: 53
Threads: 8
Joined: Sep 2012
Reputation: 0
#13
RE: I need help with creating more than 1 scripts for my custom story

(09-28-2012, 05:39 AM)Statyk Wrote: yes, notice how all the collide callbacks are given in the OnStart? This is where you set up scripts. Anything that is called from those scripts is placed outside. For example:
Spoiler below!

void OnStart()
{
AddUseItemCallback("", "key_1", "level_wood_1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "Scary_1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "Scary_2", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "Scary_3", true, 1);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
/functions
}

void Scary_1(string &in asParent, string &in asChild, int alState)
{
//functions
}

void Scary_2(string &in asParent, string &in asChild, int alState)
{
//functions
}

void Scary_3(string &in asParent, string &in asChild, int alState)
{
//functions
}



Notice how the callbacks are given when the player walks into a script area or uses a key on a door, and are preset in the OnStart? For example, in a sentence, it would read something like this:

"When the game starts ( void OnStart() ), add a collide callback (AddEntityCollideCallback) so when the player walks into ScriptArea_1 (AddEntityCollideCallback("Player", "ScriptArea_1", ...), it will run THIS function (..."Scary_1")."

Then true says the callback will be removed, so this function will not happen again after it happens once, and the 1 stands for being activated when the player walks into the area. -1 is leaving, and 0 is both. When the player walks into ScriptArea_1, void Scary_1 will activate and the functions inside Scary_1 will run.
Omg! I finally got it! :D So the commands on the void onstart are there to help you make more voids? Because i tried the "SetMessage("Messages", "Popup1", 0); " And i replaced the void OnEnter () with void Popup1 And it worked! Thanks for all the help! :D
09-28-2012, 05:50 AM
Find


Messages In This Thread
RE: I need help with creating more than 1 scripts for my custom story - by ironman0001 - 09-28-2012, 05:50 AM



Users browsing this thread: 4 Guest(s)