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


Thread Rating:
  • 16 Vote(s) - 4.44 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripts Recollection
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
RE: Scripts Recollection

This is a pretty effective script that makes you add/remove/lit alot of stuff without having alot of text Smile

For example if you have 6 torches and you want to turn off at the same time when walking in to an area you can use this Smile

void OnStart()
{
AddEntityCollideCallback("Player", "NAMEOFTHEAREA", "FUNCTIONNAME", true, 1);
}

void FUNCTIONNAME(string &in asParent, string &in asChild, int alState)
{
for(int x = 1; x <= 6; x++) SetLampLit("LightName_"+x, false, false);
}

01-21-2012, 10:03 AM
Find
CorinthianMerchant Offline
Posting Freak

Posts: 2,876
Threads: 84
Joined: Nov 2011
Reputation: 131
RE: Scripts Recollection

(01-21-2012, 10:03 AM)SilentStriker Wrote: This is a pretty effective script that makes you add/remove/lit alot of stuff without having alot of text Smile

For example if you have 6 torches and you want to turn off at the same time when walking in to an area you can use this Smile

void OnStart()
{
AddEntityCollideCallback("Player", "NAMEOFTHEAREA", "FUNCTIONNAME", true, 1);
}

void FUNCTIONNAME(string &in asParent, string &in asChild, int alState)
{
for(int x = 1; x <= 6; x++) SetLampLit("LightName_"+x, false, false);
}


Thanks a lot, but what do I put instead of "FUNCTIONNAME", and how do I make it with the key?


Still hasn't gotten over the loss of wubwub...
01-21-2012, 02:29 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
RE: Scripts Recollection

(01-21-2012, 02:29 PM)CorinthianMerchant Wrote:
(01-21-2012, 10:03 AM)SilentStriker Wrote: This is a pretty effective script that makes you add/remove/lit alot of stuff without having alot of text Smile

For example if you have 6 torches and you want to turn off at the same time when walking in to an area you can use this Smile

void OnStart()
{
AddEntityCollideCallback("Player", "NAMEOFTHEAREA", "FUNCTIONNAME", true, 1);
}

void FUNCTIONNAME(string &in asParent, string &in asChild, int alState)
{
for(int x = 1; x <= 6; x++) SetLampLit("LightName_"+x, false, false);
}


Thanks a lot, but what do I put instead of "FUNCTIONNAME", and how do I make it with the key?
The FUCTIONNAME is just the name you want to call so it could be anything as long as you write the same on the void FUCTIONNAME

What do you mean about the key?


01-21-2012, 03:20 PM
Find
CorinthianMerchant Offline
Posting Freak

Posts: 2,876
Threads: 84
Joined: Nov 2011
Reputation: 131
RE: Scripts Recollection


Quote:Lamps will extinguish when you pick up a key.

Still hasn't gotten over the loss of wubwub...
01-21-2012, 03:23 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
RE: Scripts Recollection

(01-21-2012, 03:23 PM)CorinthianMerchant Wrote:
Quote:Lamps will extinguish when you pick up a key.
then you use this:
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

instead of the AddEntityCollideCallback Smile


01-21-2012, 03:43 PM
Find
CorinthianMerchant Offline
Posting Freak

Posts: 2,876
Threads: 84
Joined: Nov 2011
Reputation: 131
RE: Scripts Recollection

(01-21-2012, 03:43 PM)SilentStriker Wrote:
(01-21-2012, 03:23 PM)CorinthianMerchant Wrote:
Quote:Lamps will extinguish when you pick up a key.
then you use this:
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

instead of the AddEntityCollideCallback Smile


Excellent!



Still hasn't gotten over the loss of wubwub...
01-21-2012, 04:21 PM
Find
jillis Offline
Junior Member

Posts: 4
Threads: 0
Joined: Jan 2012
Reputation: 0
Bug  RE: Scripts Recollection

Hey there I need some help! What I want: you pick up a key and something moves.
What I have:
PHP Code: (Select All)
void OnStart()
{
    
SetEntityPlayerInteractCallback("key1""gotkey"true);
}

void gotkey(stringasNamestringasCallback)
{
    
AddDebugMessage("Picked up key LLOOOOOL"false); /// instead of AddPropImpulse for now.


What I get: nothing!
I've tried everything but it doesn't work!! I am sure the key is called key1. where does the message pop up? im in dev mode and show debug messages is enabled.
01-23-2012, 08:36 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
RE: Scripts Recollection

Wrong syntax.

Use:

(string &in asEntity, int alState)


Instead of

(string& asName, string& asCallback) Big Grin

01-23-2012, 10:14 AM
Find
jillis Offline
Junior Member

Posts: 4
Threads: 0
Joined: Jan 2012
Reputation: 0
Question  RE: Scripts Recollection

(01-23-2012, 10:14 AM)flamez3 Wrote: Wrong syntax.

Use:

(string &in asEntity, int alState)


Instead of

(string& asName, string& asCallback) Big Grin
Sorry it doesn't work. I'm in a dev environment and show debug messages is on. I don't get any errors but I don't know where the msg is.

01-23-2012, 04:28 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
RE: Scripts Recollection

Oops, use (string &in asEntity) instead ^^

01-24-2012, 03:27 AM
Find




Users browsing this thread: 9 Guest(s)