Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add all simple scripts here!
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#7
RE: Add all simple scripts here!

(12-13-2010, 04:16 PM)Akumasama Wrote:
(12-13-2010, 04:02 PM)HumiliatioN Wrote: OnStart() What scripts belongs here?

OnEnter() here?

OnLeave() here?
OnStart(): The first time you enter an map
OnEnter(): Every time you enter an map
OnLeave(): Whenever you leave the map


(12-13-2010, 04:02 PM)HumiliatioN Wrote: Im confused because i tried OnStart my 3 scripts put but there are couple errors. end of file.. example:
You'll have to give us the errors and/or the script for this one...


(12-13-2010, 04:02 PM)HumiliatioN Wrote: And how i seperate all void codes..
Void basically means that you start a new function.
Like this:
void funcname(syntax){
     stuff you want to happen
}
void funcname2(syntax){
     stuff you want to happen
}


(12-13-2010, 04:02 PM)HumiliatioN Wrote: Okay this one is working script: Two doors with open keys.. I get it but.. where i put now Enemy trigger script area?

void OnStart()
{
AddUseItemCallback("", "key_1", "door_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "door_2", "KeyOnDoor2", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, false);
RemoveItem("key_1");
AddDebugMessage("KeyOnDoor", false);
}

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_2", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, true);
}




////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Well, the thing I do, is put every function that is NOT in any of the "on---" functions, at the bottom of the script.
This way, you won't have to search in between all of your trigger-functions.
void OnStart()
{
}

////////////////////////////
// Run when entering map

void OnEnter()
{
    AddUseItemCallback("", "key_1", "door_1", "KeyOnDoor", true);
    AddUseItemCallback("", "key_2", "door_2", "KeyOnDoor2", true)
}

////////////////////////////
// Run when leaving map

void OnLeave()
{
}

////////////////////////////
// Actual functions

void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("door_1", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, false);
    RemoveItem("key_1");
    AddDebugMessage("KeyOnDoor", false);
}    

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("door_2", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, true);
}

I put your key code in OnEnter, because you'd want to be able to open it every time you enter the level, and not just the first time.
Triggers that scare you the first time you enter a map for example, should be placed in OnStart, so it will not trigger again when entering the map for the second time.

Okay good now i understand something but i copied that last code what you write and not working Sad Why?

“Life is a game, play it”
12-13-2010, 04:28 PM
Find


Messages In This Thread
Add all simple scripts here! - by HumiliatioN - 12-12-2010, 09:21 PM
RE: Add all simple scripts here! - by Akumasama - 12-12-2010, 11:34 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-13-2010, 01:43 AM
RE: Add all simple scripts here! - by Akumasama - 12-13-2010, 03:43 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-13-2010, 04:02 PM
RE: Add all simple scripts here! - by Akumasama - 12-13-2010, 04:16 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-13-2010, 04:28 PM
RE: Add all simple scripts here! - by Akumasama - 12-13-2010, 04:54 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-13-2010, 05:00 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-13-2010, 05:27 PM
RE: Add all simple scripts here! - by Akumasama - 12-13-2010, 05:13 PM
RE: Add all simple scripts here! - by Akumasama - 12-13-2010, 05:34 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-13-2010, 05:45 PM
RE: Add all simple scripts here! - by Akumasama - 12-13-2010, 06:51 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-13-2010, 10:55 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-14-2010, 01:09 AM
RE: Add all simple scripts here! - by Akumasama - 12-14-2010, 11:18 AM
RE: Add all simple scripts here! - by HumiliatioN - 12-14-2010, 04:00 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-14-2010, 05:07 PM
RE: Add all simple scripts here! - by Akumasama - 12-14-2010, 05:30 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-14-2010, 05:52 PM
RE: Add all simple scripts here! - by Akumasama - 12-14-2010, 06:28 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-14-2010, 06:39 PM
RE: Add all simple scripts here! - by Akumasama - 12-14-2010, 06:53 PM
RE: Add all simple scripts here! - by HumiliatioN - 12-14-2010, 07:59 PM
RE: Add all simple scripts here! - by Frontcannon - 12-14-2010, 07:49 PM



Users browsing this thread: 2 Guest(s)