03-06-2012, 02:46 PM
03-06-2012, 02:53 PM
Example:
Function when player touched the door
(mansion_2) :
void TouchDoor(string& asName)
{
if (GetSwingDoorLocked("mansion_2") == true) //checks if the door is locked
{
SetMessage("Messages", "DoorLocked", 0); // if locked --> message appears
}
else // if the door is not locked
SetMessage("Messages", "DoorOpen", 0);
}
The "If" always checks stuff
Function when player touched the door
(mansion_2) :
void TouchDoor(string& asName)
{
if (GetSwingDoorLocked("mansion_2") == true) //checks if the door is locked
{
SetMessage("Messages", "DoorLocked", 0); // if locked --> message appears
}
else // if the door is not locked
SetMessage("Messages", "DoorOpen", 0);
}
The "If" always checks stuff
03-06-2012, 02:54 PM
Ive been thinking what the if is too :/
03-06-2012, 04:14 PM
What if I want to make a monster.
Which followes path nodes but if the player looks at the monster for 3 second. The path nodes will be cleared and the monster followes the player
Which followes path nodes but if the player looks at the monster for 3 second. The path nodes will be cleared and the monster followes the player
03-06-2012, 06:27 PM
This is relevant to the first question asked and is mainly directed at Unearthlybrutal concerning "if" loops.
I have this set up:
if (SetEntityActive("m1") == true)
{
SetPlayerLookSpeed(0.5f);
SetPlayerRunSpeed(0.5f);
SetPlayerMoveSpeed(0.5f);}
else
SetPlayerLookSpeed(1f);
SetPlayerRunSpeed(1f);
SetPlayerMoveSpeed(1f);
}
Would this run correctly? The only reason I'm asking instead of testing is because I don't have access to Amnesia right now.
I have this set up:
if (SetEntityActive("m1") == true)
{
SetPlayerLookSpeed(0.5f);
SetPlayerRunSpeed(0.5f);
SetPlayerMoveSpeed(0.5f);}
else
SetPlayerLookSpeed(1f);
SetPlayerRunSpeed(1f);
SetPlayerMoveSpeed(1f);
}
Would this run correctly? The only reason I'm asking instead of testing is because I don't have access to Amnesia right now.
03-06-2012, 07:26 PM
(03-06-2012, 06:27 PM)Nevicar Wrote: [ -> ]This is relevant to the first question asked and is mainly directed at Unearthlybrutal concerning "if" loops.I'm not sure about that will the "SetEntityActive" work with the "If".
I have this set up:
if (SetEntityActive("m1") == true)
{
SetPlayerLookSpeed(0.5f);
SetPlayerRunSpeed(0.5f);
SetPlayerMoveSpeed(0.5f);}
else
SetPlayerLookSpeed(1f);
SetPlayerRunSpeed(1f);
SetPlayerMoveSpeed(1f);
}
Would this run correctly? The only reason I'm asking instead of testing is because I don't have access to Amnesia right now.
But if it will, this should work:
Spoiler below!
void function(syntax)
{
if (SetEntityActive("m1") == true)
{
SetPlayerLookSpeed(0.5f);
SetPlayerRunSpeed(0.5f);
SetPlayerMoveSpeed(0.5f);}
}
else
SetPlayerLookSpeed(1f);
SetPlayerRunSpeed(1f);
SetPlayerMoveSpeed(1f);
}
03-06-2012, 07:34 PM
Thanks a lot! Will be sure to try when I get home.
03-07-2012, 01:46 PM
When I want to Clear the Path nodes if the Player looks at the monster for 3 Seconds. Should the script look like this?
if (PlayerLookAt("m1") == true)
{
AddTimer("", 3, "MonsterClear");
}
void MonsterClear(string &in asTimer)
{
if (PlayerLookAt("m1") == true)
{
ClearEnemyPatrolNodes("m1");
}
if (PlayerLookAt("m1") == true)
{
AddTimer("", 3, "MonsterClear");
}
void MonsterClear(string &in asTimer)
{
if (PlayerLookAt("m1") == true)
{
ClearEnemyPatrolNodes("m1");
}
03-07-2012, 05:01 PM
(03-07-2012, 01:46 PM)Shives Wrote: [ -> ]When I want to Clear the Path nodes if the Player looks at the monster for 3 Seconds. Should the script look like this?No, go to the look function.
if (PlayerLookAt("m1") == true)
{
AddTimer("", 3, "MonsterClear");
}
void MonsterClear(string &in asTimer)
{
if (PlayerLookAt("m1") == true)
{
ClearEnemyPatrolNodes("m1");
}
03-07-2012, 05:22 PM
What I've to do with the look function?