RE: Anyone need help? - RawkBandMan - 05-21-2011
I have yet another question. Not much of a scripting question, because the scripting part of it I know.
How can I make it so it uses Justine's player files and not Daniel's? I mean the .ogg files that are "player_female_jump1" and that goes to 5. Please help. Thanks in advance.
RE: Anyone need help? - Exostalker - 05-21-2011
This just gives me unexpected end of file error, could someone check what is wrong?
I checked it a few times and still can't figure out what's wrong...
Code: ////////////////////////////
// Run first time starting map
void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");
for(int i=0;i< 10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////-----HALLUCINATION-----//////
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
/////-----REAL GRUNT DEACTIVATES-----/////
AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate", "CollideAreaGruntDeactivate", true, 1);
/////-----CLOSES THE DOORS-----/////
AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate2", "DoorSwing", true, 1);
/////-----KEY OPENS CORIDOR DOORS AFTER GRUNT LOCKS THEM-----/////
AddUseItemCallback("", "key_tomb_rusty_1", "mansion_4", "KeyOnDoor", true);
/////-----REAL GRUNT-----//////
AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc2" , true , 1);
/////-----HALLUCINATION 2 IN SECRET CORIDOR-----//////
AddEntityCollideCallback("Player" , "ScriptArea_3" , "MonsterFunc3" , true , 1);
/////-----SHELF MOVES ONLY IF YOU DROP BOOKS----/////
SetLocalVarInt("Check", 0);
SetEntityConnectionStateChangeCallback("secret_lever", "LevChangeFunc");
for (int i = 1; i > 0 && i <= 3; i++)
{
AddEntityCollideCallback("book_shelf_"+i, "ScriptArea_5", "Func"+i, true, -1);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
/////-----SHELF MOVES ONLY IF YOU DROP BOOKS----/////
void LevChangeFunc(string &in asEntity, int alState)
{
if (GetLeverState("secret_lever") == 1)
{
if (GetLocalVarInt("Check") == 3)
{
SetLeverStuckState("secret_lever", 1, true);
ConnectEntities("shelf_connection", "secret_lever", "secret_shelf", false, 1, "CreateDust");
return;
{
else if (GetLocalVarInt("Check") != 3)
{
AddMessage("", "", 0); // Message you want to display when lever is pulled and the books are still on the shelf.
return;
}
}
}
void Func1(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("Check", 1);
}
void Func2(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("Check", 1);
}
void Func3(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("Check", 1);
}
/////-----HALLUCINATION-----//////
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt_1" , true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
}
/////-----REAL GRUNT-----//////
void MonsterFunc2(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt_2" , true);
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_6", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_7", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_8", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_9", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_10", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_11", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_12", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_13", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_14", 0.0f, "");
}
/////-----REAL GRUNT DEACTIVATES-----//////
void CollideAreaGruntDeactivate(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", false);
PlaySoundAtEntity("doorgruntleave","10_open_door.snt", "mansion_3", 0.5, false);
}
/////-----CLOSES THE DOORS-----/////
void DoorSwing(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_4", true, true);
SetSwingDoorLocked("mansion_4", true, true);
}
/////------LEVER MOVES SECRET SHELF-----//////
void CreateDust(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
//for(int i=1;i<10;i++) AddPropForce("jara_"+i, 1.0f, 1.0f, 1.0f, "world");
//for(int i=1;i<4;i++) AddPropForce("jbok_"+i, 1.0f, 1.0f, 1.0f, "world");
if(GetLocalVarInt("DoSecretDoorEffects") == 1) return;
CreateParticleSystemAtEntity("PSDoorDust", "ps_dust_falling_door.ps", "secret_door", false);
AddTimer("sucess_music", 2, "TimerMusic");
AddTimer("Hint", 0.5f, "TimerHint");
StartScreenShake(0.01f, 0.5f, 2.0f,2.0f);
SetLocalVarInt("DoSecretDoorEffects", 1);
FadeRadialBlurTo(1, 0.1f);
PlayMusic("14_elevator_clank.ogg", false, 0.9f, 0, 1, false);
}
void TimerMusic(string &in asTimer)
{
PlayMusic("01_puzzle_passage.ogg", false, 0.6f, 0.2f, 10, false);
FadeRadialBlurTo(0.0, 3.2f);
}
/////-----KEY OPENS CORIDOR DOORS AFTER GRUNT LOCKS THEM----/////
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_4", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_4", 0.0f, true);
RemoveItem("key_tomb_rusty_1");
}
/////-----ONCE THE KEY IS PICKED UP, DOORS ARE UNLOCKED-----//////
void PickedUpKey(string &in asEntity, string &in asType) //Has to be the same name as the callback function.
{
SetSwingDoorLocked("mansion_3", false, true);
CheckPoint("check01","PlayerStartArea_3", "CheckPoint01", "Hints", "DeathGrunt_10_Daniels_Room_01");
}
//////------FIRST CHECKPOINT-----//////
void CheckPoint01(string &in asName, int alCount)
{
ResetProp("cabinet_simple_1");
ResetProp("mansion_3");
ResetProp("mansion_4");
SetSwingDoorLocked("mansion_3", false, true);
AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc2" , true , 1);
AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate2", "DoorSwing", true, 1);
}
/////-----HALLUCINATION 2 IN SECRET CORIDOR-----//////
void MonsterFunc3(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt_3" , true);
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_100", 0, "");
}
////////////////////////////
// Run when entering map
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
RE: Anyone need help? - Modular100 - 05-22-2011
Code: void OnStart()
{
AddEntityCollideCallback("Player", "EnemyActivate1", "Enemy1Collide", true, 1);
}
void Enemy1Collide(string &in asParent, string &in asChild, int alState);
{
ShowEnemyPlayerPosition(string& asEnemy1);
SetSwingDoorClosed("mansion_1", true, true);
}
I've been using this code to activate an enemy and close a door when the player enters an area, but the map won't load when I try to enter it.
But I get this error:
Code: Main (9,1) : ERR : Unexpected token '{'
Since I'm a complete noob at scripting, I'm not able to check my own code for mistakes, so I'll just miss the obvious. Some help would be very appreciated!
RE: Anyone need help? - Kyle - 05-22-2011
@Modular100,
It should be this:
void Enemy1Collide(string &in asParent, string &in asChild, int alState)
There is supposed to be no ; at the end of it.
@Exostalker,
Here it your script. You accidently forgot 2 "}"s.
Code: void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");
for(int i=0;i< 10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate", "CollideAreaGruntDeactivate", true, 1);
AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate2", "DoorSwing", true, 1);
AddUseItemCallback("", "key_tomb_rusty_1", "mansion_4", "KeyOnDoor", true);
AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc2" , true , 1);
AddEntityCollideCallback("Player" , "ScriptArea_3" , "MonsterFunc3" , true , 1);
SetLocalVarInt("Check", 0);
SetEntityConnectionStateChangeCallback("secret_lever", "LevChangeFunc");
for (int i = 1; i > 0 && i <= 3; i++)
{
AddEntityCollideCallback("book_shelf_"+i, "ScriptArea_5", "Func"+i, true, -1);
}
}
void LevChangeFunc(string &in asEntity, int alState)
{
if (GetLeverState("secret_lever") == 1)
{
if (GetLocalVarInt("Check") == 3)
{
SetLeverStuckState("secret_lever", 1, true);
ConnectEntities("shelf_connection", "secret_lever", "secret_shelf", false, 1, "CreateDust");
return;
}
else if (GetLocalVarInt("Check") != 3)
{
AddMessage("", "", 0);
return;
}
}
}
void Func1(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("Check", 1);
}
void Func2(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("Check", 1);
}
void Func3(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("Check", 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt_1" , true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
}
void MonsterFunc2(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt_2" , true);
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_6", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_7", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_8", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_9", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_10", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_11", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_12", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_13", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_14", 0.0f, "");
}
void CollideAreaGruntDeactivate(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", false);
PlaySoundAtEntity("doorgruntleave","10_open_door.snt", "mansion_3", 0.5, false);
}
void DoorSwing(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_4", true, true);
SetSwingDoorLocked("mansion_4", true, true);
}
void CreateDust(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
if(GetLocalVarInt("DoSecretDoorEffects") == 1)
{
CreateParticleSystemAtEntity("PSDoorDust", "ps_dust_falling_door.ps", "secret_door", false);
AddTimer("sucess_music", 2, "TimerMusic");
AddTimer("Hint", 0.5f, "TimerHint");
StartScreenShake(0.01f, 0.5f, 2.0f,2.0f);
SetLocalVarInt("DoSecretDoorEffects", 1);
FadeRadialBlurTo(1, 0.1f);
PlayMusic("14_elevator_clank.ogg", false, 0.9f, 0, 1, false);
return;
}
}
void TimerMusic(string &in asTimer)
{
PlayMusic("01_puzzle_passage.ogg", false, 0.6f, 0.2f, 10, false);
FadeRadialBlurTo(0.0, 3.2f);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_4", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_4", 0.0f, true);
RemoveItem("key_tomb_rusty_1");
}
void PickedUpKey(string &in asEntity, string &in asType)
{
SetSwingDoorLocked("mansion_3", false, true);
CheckPoint("check01","PlayerStartArea_3", "CheckPoint01", "Hints", "DeathGrunt_10_Daniels_Room_01");
}
void CheckPoint01(string &in asName, int alCount)
{
ResetProp("cabinet_simple_1");
ResetProp("mansion_3");
ResetProp("mansion_4");
SetSwingDoorLocked("mansion_3", false, true);
AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc2" , true , 1);
AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate2", "DoorSwing", true, 1);
}
void MonsterFunc3(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt_3" , true);
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_100", 0, "");
}
void OnEnter()
{
}
void OnLeave()
{
}
(05-21-2011, 03:36 PM)XxRoCkBaNdMaNxX Wrote: I have yet another question. Not much of a scripting question, because the scripting part of it I know.
How can I make it so it uses Justine's player files and not Daniel's? I mean the .ogg files that are "player_female_jump1" and that goes to 5. Please help. Thanks in advance.
If you go to "config" under the Amnesia file, there are "game.cfg" and "ptest_game.cfg".
If you want to, copy the Jump, Crouch, and Stand sounds from below into your "game.cfg" under the specified subtitle from below.
You can change it much more easier when you are making a full conversion, but if you want to change it permanently, open the "game.cfg" and open "ptest_game.cfg". In the "ptest_game.cfg", scroll down until you find the subtitle "<Player_Movement_Normal", there are these lines:
JumpSound = "player_female_jump"
CrouchSound = "player_crouch"
StandSound = "player_stand"
Copy them and then paste under the subtitle in your "game.cfg" file under the same subtitle. If you want to, you can change all the other movement speeds and whatnot.
Sorry if I sort of repeated myself. :p
P.S. You can remove these 3 lines from your "game.cfg" if you want to switch back to Daniel.
RE: Anyone need help? - Modular100 - 05-22-2011
Quote:@Modular100,
It should be this:
void Enemy1Collide(string &in asParent, string &in asChild, int alState)
There is supposed to be no ; at the end of it.
Thanks alot! You're a lifesaver!
RE: Anyone need help? - Kyle - 05-22-2011
(05-22-2011, 05:38 PM)Modular100 Wrote: Quote:@Modular100,
It should be this:
void Enemy1Collide(string &in asParent, string &in asChild, int alState)
There is supposed to be no ; at the end of it.
Thanks alot! You're a lifesaver!
You're welcome! And I'm only 13 years old. :p
RE: Anyone need help? - xtron - 05-22-2011
Kyle. How do i make a script so that when i take a key a monster spawns? AND! how do i make a script so that when i open a door it explodes and/or a entity comes with speed out of the room.
RE: Anyone need help? - Kyle - 05-22-2011
(05-22-2011, 06:00 PM)xtron Wrote: Kyle. How do i make a script so that when i take a key a monster spawns? AND! how do i make a script so that when i open a door it explodes and/or a entity comes with speed out of the room.
I'm not sure what you mean with the second question, but the first one, you can try this:
Code: void OnStart()
{
SetEntityPlayerInteractCallback("KeyName", "Func01", true);
}
void Func01(string &in asEntity)
{
SetEntityActive("MonsterName", true);
}
RE: Anyone need help? - xtron - 05-22-2011
(05-22-2011, 06:41 PM)Kyle Wrote: (05-22-2011, 06:00 PM)xtron Wrote: Kyle. How do i make a script so that when i take a key a monster spawns? AND! how do i make a script so that when i open a door it explodes and/or a entity comes with speed out of the room.
I'm not sure what you mean with the second question, but the first one, you can try this:
Code: void OnStart()
{
SetEntityPlayerInteractCallback("KeyName", "Func01", true);
}
void Func01(string &in asEntity)
{
SetEntityActive("MonsterName", true);
}
Could you try add it for me since I don't understand. Is It possible to have a "SetEntity" at at "void onstart" ?. Cuz i added some keys etc and they're only "Add" and not "SetEntity".
RE: Anyone need help? - Kyle - 05-22-2011
What is the name of the key that you want to be interacted with which then causes the monster to spawn?
What is the name of the monster that will spawn?
|