Battlefield3142
Junior Member
Posts: 13
Threads: 3
Joined: May 2012
Reputation:
0
|
Why wouldn't this script work?
(in OnStart)
AddEntityCollideCallback("Player", "popout1", "SetEntityActive", false, 0); (When player crosses a script box called popout1, an entity is set active.
then
void SetEntityActive(string& jesus, bool abActive);
{
if(HasItem("scarykey_1") == false) return;
SetEntityActive("jesus");
}
if a player has an item called scarykey_1, this wont happen and it will return to unactive
make entity (a rag doll called jesus) active.
for some reason I receive an error when launching the map.
not sure why.
|
|
05-29-2012, 07:18 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Why wouldn't this script work?
You can't overload a function with the same return type and parameters. Also, function headers don't end with a semi-colon.
(This post was last modified: 05-29-2012, 07:54 PM by Your Computer.)
|
|
05-29-2012, 07:53 PM |
|
Battlefield3142
Junior Member
Posts: 13
Threads: 3
Joined: May 2012
Reputation:
0
|
RE: Why wouldn't this script work?
There we go! Thanks! Stupid typing mistakes...
wait.. still something came up.. sorry
is this what you were saying?
AddEntityCollideCallback("Player", "popout1", "SetEntityActive", false, 0);
void SetEntityActive(string &in Player, string &in popout1, int alState)
{
if(HasItem("scarykey_1");
SetEntityActive("jesus");
}
|
|
05-29-2012, 08:04 PM |
|
Prelauncher
Senior Member
Posts: 451
Threads: 11
Joined: May 2011
Reputation:
13
|
RE: Why wouldn't this script work?
You know, you don't have to make a new thread for every question
Socialism (noun): A great way to run out of other people's money.
|
|
05-29-2012, 08:39 PM |
|
Battlefield3142
Junior Member
Posts: 13
Threads: 3
Joined: May 2012
Reputation:
0
|
RE: Why wouldn't this script work?
Oh, sorry. I didnt mean to upset anyone. Yeah. I wont do that unless I have to.
but still, yes I have read the tutorial, I am still not to sure what the problem is. I know, I probably seem like the biggest retard on the forum, but when I don't know I'm not sure where else to turn besides here or the script functions page. But even then, sometimes I don't get exactly want to put in the
parameters.
|
|
05-29-2012, 08:44 PM |
|
Prelauncher
Senior Member
Posts: 451
Threads: 11
Joined: May 2011
Reputation:
13
|
RE: Why wouldn't this script work?
Don't worry man, we've seen the retards on the forum and you're not one of them you're just new to this stuff, and belive me, everybody had trouble getting the scripts to work in the beginning.
(string &in asParent, string &in asChild, int alState)
Socialism (noun): A great way to run out of other people's money.
(This post was last modified: 05-29-2012, 09:22 PM by Prelauncher.)
|
|
05-29-2012, 09:11 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Why wouldn't this script work?
SetEntityActive(string) does not exist. You're missing the second argument next to "jesus".
|
|
05-29-2012, 09:19 PM |
|
Battlefield3142
Junior Member
Posts: 13
Threads: 3
Joined: May 2012
Reputation:
0
|
RE: Why wouldn't this script work?
ok, so i put that for the void part, but in the {} I have
{
if(HasItem("scarykey_1");
SetEntityActive("jesus");
}
so that if player has a key, then the weird figure will appear (named jesus) I don't see any other way to say that in the callback besides that. Unless theres some weird formula of words lol. I cant find them on the SF page.
Again, thanks for still helping!
|
|
05-29-2012, 09:26 PM |
|
Prelauncher
Senior Member
Posts: 451
Threads: 11
Joined: May 2011
Reputation:
13
|
RE: Why wouldn't this script work?
SetEntityActive("jesus", true);
Socialism (noun): A great way to run out of other people's money.
|
|
05-29-2012, 09:27 PM |
|
Battlefield3142
Junior Member
Posts: 13
Threads: 3
Joined: May 2012
Reputation:
0
|
RE: Why wouldn't this script work?
ok so, my script now looks like this
AddEntityCollideCallback("Player", "popout2", "SetEntityActive", false, 0); //(this is my second collide callback if that means something. But "SetEntityActive" is only used once.)
void SetEntityActive(string &in asParent, string &in asChild, int alState)
{
if(HasItem("scarykey_1") == false) return;
SetEntityActive("jesus", true);
}
I've looked over this like 9 times now, both on the script functions page and feedback from you guys. And Computer, what do you mean SetEntityAcitve has no (string) it does in the functions page.
(05-30-2012, 04:24 AM)Battlefield3142 Wrote: ok so, my script now looks like this
AddEntityCollideCallback("Player", "popout2", "SetEntityActive", false, 0); //(this is my second collide callback if that means something. But "SetEntityActive" is only used once.)
void SetEntityActive(string &in asParent, string &in asChild, int alState)
{
if(HasItem("scarykey_1") == false) return;
SetEntityActive("jesus", true);
}
I've looked over this like 9 times now, both on the script functions page and feedback from you guys. And Computer, what do you mean SetEntityAcitve has no (string) it does in the functions page. I made a new script box btw called popout2, thats why thats different.
|
|
05-30-2012, 04:24 AM |
|
|