Frictional Games Forum (read-only)
Why wouldn't this script work? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Why wouldn't this script work? (/thread-15705.html)

Pages: 1 2


Why wouldn't this script work? - Battlefield3142 - 05-29-2012

(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.


RE: Why wouldn't this script work? - Your Computer - 05-29-2012

You can't overload a function with the same return type and parameters. Also, function headers don't end with a semi-colon.


RE: Why wouldn't this script work? - Battlefield3142 - 05-29-2012

There we go! Thanks! Stupid typing mistakes...

Smile

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");
}


RE: Why wouldn't this script work? - Prelauncher - 05-29-2012

You know, you don't have to make a new thread for every question


RE: Why wouldn't this script work? - Battlefield3142 - 05-29-2012

Oh, sorry. I didnt mean to upset anyone. Sad 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.


RE: Why wouldn't this script work? - Prelauncher - 05-29-2012

Don't worry man, we've seen the retards on the forum and you're not one of them Wink 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)


RE: Why wouldn't this script work? - Your Computer - 05-29-2012

SetEntityActive(string) does not exist. You're missing the second argument next to "jesus".


RE: Why wouldn't this script work? - Battlefield3142 - 05-29-2012

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!


RE: Why wouldn't this script work? - Prelauncher - 05-29-2012

SetEntityActive("jesus", true);


RE: Why wouldn't this script work? - Battlefield3142 - 05-30-2012

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.