SilentStriker
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
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
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 |
|
CorinthianMerchant
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
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
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 |
|
SilentStriker
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
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
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 |
|
CorinthianMerchant
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 |
|
SilentStriker
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
|
|
01-21-2012, 03:43 PM |
|
CorinthianMerchant
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
Excellent!
Still hasn't gotten over the loss of wubwub...
|
|
01-21-2012, 04:21 PM |
|
jillis
Junior Member
Posts: 4
Threads: 0
Joined: Jan 2012
Reputation:
0
|
RE: Scripts Recollection
Hey there I need some help! What I want: you pick up a key and something moves.
What I have:
void OnStart() { SetEntityPlayerInteractCallback("key1", "gotkey", true); }
void gotkey(string& asName, string& asCallback) { 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 |
|
flamez3
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)
|
|
01-23-2012, 10:14 AM |
|
jillis
Junior Member
Posts: 4
Threads: 0
Joined: Jan 2012
Reputation:
0
|
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) 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 |
|
flamez3
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 |
|
|