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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Area's wont work
sHock Offline
Junior Member

Posts: 2
Threads: 1
Joined: Mar 2012
Reputation: 0
#1
Script Area's wont work

Ohai there, i dont think my "Script Areas" work.. Not sure if its a problem in the level editor, or in the code so ill post pic's of the editor and the code.
I tried to make a "Flying jesus" scare but when i walk into that area, nothing happends..

[Image: 38508]


[Image: 38512]

[Image: 38511]

[Image: 38513]



The code is a bit messy.. it is my first map.. hopefully you can make something out of it
/////////////////////Run when starting mapvoid OnStart(){ AddUseItemCallback("", "OutKey", "OutDoor", "UseKey1", true); AddUseItemCallback("", "Room1_key", "Room1_door", "UseKey2", true); AddEntityCollideCallback("Player", "Scriptarea_1", "Chairmode", true, 1);
AddEntityCollideCallback("Player", "FlyingJesus_1", "HolyJesus", true, 1); AddEntityCollideCallback("Jesus_1", "FlyingJesus_1", "Sound", true, 1); AddEntityCollideCallback("Player", "Scary_Area_4", "Scary_4", true, 1); SetPlayerLampOil(0);}
void d2(string &in asItem, string &in asEntity){ SetSwingDoorLocked("door2", false, true); PlaySoundAtEntity("", "unlock_door", "d2", 0, false); RemoveItem("OutKey");}void UseKey1(string &in asitem, string &in Door){ SetSwingDoorLocked("OutDoor", false, true); PlaySoundAtEntity("", "unlock_door", "door", 0, false); RemoveItem(asitem); SetMessage("M", "v1", 3); SetEntityActive("Mansion_Monster1", true); AddEnemyPatrolNode("Mansion_Monster1", "Mansion_monster_path_1", 0.1, ""); SetEntityActive("Mansion_Monster1_1", true); AddEnemyPatrolNode("Mansion_Monster1_1", "Mansion_monster_path_1", 0.1, ""); SetEntityActive("Mansion_Monster1_2", true); AddEnemyPatrolNode("Mansion_Monster1_2", "Mansion_monster_path_1", 0.1, ""); GiveSanityDamage(20, true); StartScreenShake(0.10f, 0.1f, 0.10f, 0.1f); PlaySoundAtEntity("", "react_scare.snt", "Player", 0.0, false);}void UseKey2(string &in asitem, string &in Door){ SetSwingDoorLocked("Room1_Door", false, true); PlaySoundAtEntity("", "unlock_door", "door", 0, false); RemoveItem(asitem);}
void Chairmode(string &in asItem, string &in asEntity) { SetLampLit("candlestick_wall_1", true, false); PlaySoundAtEntity("", "chair.ogg", "MrChair", 0, false); }
void HolyJesus(string &in asParent, string &in asChild, int alState){SetEntityActive("Jesus_1", true);AddPropForce("Jesus_1", 0, 30000, 0, "World");} void Sound(string &in asParent, string &in asChild, int alState){PlaySoundAtEntity("", "24_iron_maiden.snt", "FlyingJesus_1", 0, false);}
(This post was last modified: 03-22-2012, 06:40 PM by sHock.)
03-22-2012, 10:29 AM
Find
pandasFTW Offline
Member

Posts: 71
Threads: 21
Joined: Feb 2012
Reputation: 2
#2
RE: Script Area's wont work

well i cant see anything from the code, try and sort it out a bit Smile but it might be because you have ticked the " insanity vision " in the level editor, that means that you are only able to see it, when ur sanity is low enough... i dont know if its supposed to be that way or??? if that isnt the problem, then try and sort out the script ( the code ) and PM me, then i will see if i can do anything
(03-22-2012, 11:46 AM)pandasFTW Wrote: well i cant see anything from the code, try and sort it out a bit Smile but it might be because you have ticked the " insanity vision " in the level editor, that means that you are only able to see it, when ur sanity is low enough... i dont know if its supposed to be that way or??? if that isnt the problem, then try and sort out the script ( the code ) and PM me, then i will see if i can do anything
oh and i saw that the name of the script_area in the code was FlyingJesus_1, but in the level editor it is just FlyingJesus1 without underscore, those two need to match too! Smile
(This post was last modified: 03-22-2012, 11:48 AM by pandasFTW.)
03-22-2012, 11:46 AM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#3
RE: Script Area's wont work

Though the problem has been solved, it will be easier for everybody to read your script if you space it out like so

void OnStart()
{
// Line of code;
// Line of code;
}
void OtherFunction
{
// Line of code;
}

It will also make it easier for you to sift through it should there be a problem.

03-22-2012, 12:20 PM
Find
sHock Offline
Junior Member

Posts: 2
Threads: 1
Joined: Mar 2012
Reputation: 0
#4
RE: Script Area's wont work

That fixed indeed Smile) and Obliviator, i have the code like that in notepad++, not sure why it didnt copy it like that here..
03-22-2012, 06:42 PM
Find
JordanWeigle Offline
Junior Member

Posts: 9
Threads: 3
Joined: Feb 2012
Reputation: 0
#5
RE: Script Area's wont work

(03-22-2012, 06:42 PM)sHock Wrote: That fixed indeed Smile) and Obliviator, i have the code like that in notepad++, not sure why it didnt copy it like that here..
Yeah, apparently, the code isn't "automatically" like that. I posted code once and had to go back through it and add "[br]'s" due to my OCD. :[
03-22-2012, 07:47 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: Script Area's wont work

This is why the forum supports code boxes which retain line breaks. I would advise users to learn forum bb code rather than plainly posting their code.

Tutorials: From Noob to Pro
03-22-2012, 08:00 PM
Website Find




Users browsing this thread: 1 Guest(s)