Troubles with monster - thaniels - 06-07-2013
Hello dear forum,
I am having some trouble making my monster listen to me.
The situation I am dealing with is that I have a monster that is behind a door, what i want to achieve is to make the monster inactive (but visible) until the player hits a particular script area, the thing that is happening right now is that the monster is active regardless of me adding a script making him inactive at the start of the level, and activating him when the player has set a few steps inside the hallway where the monster is hiding in the mist. I have a timer of 15 seconds before the monster should actually become active and attack the player
Can anyone have a look at my script and see if they can find the reason I could be having this trouble with my monster?
Also, if i have this in my script:
if(ScriptDebugOn()) {
}
where do i put my code, i have been looking all over the internet but i can't seem to an find and answer which actually answers my question, where does my code go? between the {}? I have no idea
Code: [code] void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "DoorClose", true, 1);
AddEntityCollideCallback("Player", "Sir?", "Hello", true, 1);
AddEntityCollideCallback("Myboi", "MonsterPlzStahp2", "Stahp", true, 1);
AddEntityCollideCallback("Player", "DisableMonster", "QuietYou", true, 1);
}
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}
void QuietYou(string& asName, bool abDisabled)
{
SetEnemyDisableTriggers("Myboi", false);
}
void DoorDelay(string& asName, float afTime, string& asFunction)
{
AddTimer("WaitForIt", 4, "DoorClose");
}
void DoorClose(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_4", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void Hello(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("NothingScaryYet", "enemy_hallucination_disappear.snt", "Player", 0, false);
AddTimer("Conversation", 15, "Attack");
}
void Attack(string& asName, bool abDisabled)
{
SetEnemyDisableTriggers("Myboi", true);
AddEnemyPatrolNode("Myboi", "MoveHerePlease1", 0, "");
}
void Stahp(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Myboi", false);
}
[/code]
RE: Troubles with monster - VeNoMzTeamHysterical - 06-07-2013
(06-07-2013, 04:51 PM)thaniels Wrote: Hello dear forum,
I am having some trouble making my monster listen to me.
The situation I am dealing with is that I have a monster that is behind a door, what i want to achieve is to make the monster inactive (but visible) until the player hits a particular script area, the thing that is happening right now is that the monster is active regardless of me adding a script making him inactive at the start of the level, and activating him when the player has set a few steps inside the hallway where the monster is hiding in the mist. I have a timer of 15 seconds before the monster should actually become active and attack the player
Can anyone have a look at my script and see if they can find the reason I could be having this trouble with my monster?
Also, if i have this in my script:
if(ScriptDebugOn()) {
}
where do i put my code, i have been looking all over the internet but i can't seem to an find and answer which actually answers my question, where does my code go? between the {}? I have no idea
Code: [code] void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "DoorClose", true, 1);
AddEntityCollideCallback("Player", "Sir?", "Hello", true, 1);
AddEntityCollideCallback("Myboi", "MonsterPlzStahp2", "Stahp", true, 1);
AddEntityCollideCallback("Player", "DisableMonster", "QuietYou", true, 1);
}
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}
void QuietYou(string& asName, bool abDisabled)
{
SetEnemyDisableTriggers("Myboi", false);
}
void DoorDelay(string& asName, float afTime, string& asFunction)
{
AddTimer("WaitForIt", 4, "DoorClose");
}
void DoorClose(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_4", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void Hello(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("NothingScaryYet", "enemy_hallucination_disappear.snt", "Player", 0, false);
AddTimer("Conversation", 15, "Attack");
}
void Attack(string& asName, bool abDisabled)
{
SetEnemyDisableTriggers("Myboi", true);
AddEnemyPatrolNode("Myboi", "MoveHerePlease1", 0, "");
}
void Stahp(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Myboi", false);
}
[/code] Is the monster not attacking or what?
What is the problem with the monster?
And Scriptdebug is not easy i can tell you i got it in my script looks like this.
Code: void OnStart(){
SetLocalVarInt("CellarDoorOpen", 0);
SetLocalVarInt("FirstTimeCellar", 1);
}
void EnterCellar(string &in asEntity) // Teleport Player Into The Cellar.
{
if(GetLocalVarInt("CellarDoorOpen") != 1)
{
SetMessage("Messages", "DoorLocked", 0);
return;
}
TeleportPlayer("InsideCellar");
if(GetLocalVarInt("FirstTimeCellar") == 1)
{
SetMessage("Messages", "EnteringTheCellar", 0);
SetLocalVarInt("FirstTimeCellar", 0);
}
}
Also if you want the monster to attack you, it should be this Func.
ShowEnemyPlayerPosition("MonsterName");
When you add this script the monster is instant seeing the player and chase him.
If you got any question i like to hear them.
RE: Troubles with monster - CarnivorousJelly - 06-07-2013
Actually, try this script:
PHP Code: SetEnemyDisableTriggers(string& asName, bool abX);
string& asName = enemy's name (eg brute_01)
bool abX = true will prevent the enemy from attacking the player, but it will not be set to inactive (non-existent and invisible) false will make it behave like a normal enemy.
While the ShowEnemyPlayerPosition function isn't entirely incorrect. It will do exactly what it says and, well, show the enemy where the player is no matter what. This means that, no matter how skilled you are at avoiding the gaze of the enemy and no matter how many doors you put between yourself and the enemy, it will know exactly where you are.
Also, I noticed you're using a .txt file. Save it as a .hps or it won't actually let you apply it to the map (at least, not in my past experience)
RE: Troubles with monster - thaniels - 06-07-2013
(06-07-2013, 06:46 PM)VeNoMzTeamHysterical Wrote: (06-07-2013, 04:51 PM)thaniels Wrote: Hello dear forum,
I am having some trouble making my monster listen to me.
The situation I am dealing with is that I have a monster that is behind a door, what i want to achieve is to make the monster inactive (but visible) until the player hits a particular script area, the thing that is happening right now is that the monster is active regardless of me adding a script making him inactive at the start of the level, and activating him when the player has set a few steps inside the hallway where the monster is hiding in the mist. I have a timer of 15 seconds before the monster should actually become active and attack the player
Can anyone have a look at my script and see if they can find the reason I could be having this trouble with my monster?
Also, if i have this in my script:
if(ScriptDebugOn()) {
}
where do i put my code, i have been looking all over the internet but i can't seem to an find and answer which actually answers my question, where does my code go? between the {}? I have no idea
Code: [code] void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "DoorClose", true, 1);
AddEntityCollideCallback("Player", "Sir?", "Hello", true, 1);
AddEntityCollideCallback("Myboi", "MonsterPlzStahp2", "Stahp", true, 1);
AddEntityCollideCallback("Player", "DisableMonster", "QuietYou", true, 1);
}
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}
void QuietYou(string& asName, bool abDisabled)
{
SetEnemyDisableTriggers("Myboi", false);
}
void DoorDelay(string& asName, float afTime, string& asFunction)
{
AddTimer("WaitForIt", 4, "DoorClose");
}
void DoorClose(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_4", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void Hello(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("NothingScaryYet", "enemy_hallucination_disappear.snt", "Player", 0, false);
AddTimer("Conversation", 15, "Attack");
}
void Attack(string& asName, bool abDisabled)
{
SetEnemyDisableTriggers("Myboi", true);
AddEnemyPatrolNode("Myboi", "MoveHerePlease1", 0, "");
}
void Stahp(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Myboi", false);
}
[/code] Is the monster not attacking or what?
What is the problem with the monster?
And Scriptdebug is not easy i can tell you i got it in my script looks like this.
Code: void OnStart(){
SetLocalVarInt("CellarDoorOpen", 0);
SetLocalVarInt("FirstTimeCellar", 1);
}
void EnterCellar(string &in asEntity) // Teleport Player Into The Cellar.
{
if(GetLocalVarInt("CellarDoorOpen") != 1)
{
SetMessage("Messages", "DoorLocked", 0);
return;
}
TeleportPlayer("InsideCellar");
if(GetLocalVarInt("FirstTimeCellar") == 1)
{
SetMessage("Messages", "EnteringTheCellar", 0);
SetLocalVarInt("FirstTimeCellar", 0);
}
}
Also if you want the monster to attack you, it should be this Func.
ShowEnemyPlayerPosition("MonsterName");
When you add this script the monster is instant seeing the player and chase him.
If you got any question i like to hear them.
the problem with the monster is, that is should only be activated after the player has walked into a certain trigger area, the problem now is, it is already active and is directly going towards the player once the door is opened. I want the monster to remain inactive for a small period of time before it becomes active and heads towards the player
(06-07-2013, 07:21 PM)Kiandra Wrote: Actually, try this script:
PHP Code: SetEnemyDisableTriggers(string& asName, bool abX);
string& asName = enemy's name (eg brute_01)
bool abX = true will prevent the enemy from attacking the player, but it will not be set to inactive (non-existent and invisible) false will make it behave like a normal enemy.
While the ShowEnemyPlayerPosition function isn't entirely incorrect. It will do exactly what it says and, well, show the enemy where the player is no matter what. This means that, no matter how skilled you are at avoiding the gaze of the enemy and no matter how many doors you put between yourself and the enemy, it will know exactly where you are.
Also, I noticed you're using a .txt file. Save it as a .hps or it won't actually let you apply it to the map (at least, not in my past experience)
Kiandra, i don't know if you red my code, but i am already using the SetEnemyDisableTrigger code, that is what i am trying to get working and what does not do what i want.
RE: Troubles with monster - Your Computer - 06-07-2013
QuietYou has the wrong callback syntax.
RE: Troubles with monster - thaniels - 06-07-2013
(06-07-2013, 08:23 PM)Your Computer Wrote: QuietYou has the wrong callback syntax.
please explain the callback please because im not completely sure what you mean, also could you help me with my timer it seems like every time i walk into my tigger area triggering the activity of my monster he just reacts instantly and comes at my directly instead of waiting the 15 seconds i have indicated with the timer
RE: Troubles with monster - Your Computer - 06-07-2013
Entity collide callbacks are supposed to have the syntax string, string, int. However, you have string, bool for QuietYou. Timer callbacks are supposed to have the syntax string. However, Attack has string, bool and DoorClose has string, string, int.
RE: Troubles with monster - thaniels - 06-09-2013
Ok I have changed the syntax but the monster still doesn't wait 14 seconds before it starts moving to my location, it still happens instantly, can anyone help me?
RE: Troubles with monster - Adrianis - 06-09-2013
I think you have you're true/false for SetEnemyDisableTriggers the wrong way round.
Disable Triggers - true
It is true that the triggers are disabled, so the enemy doesn't react to the player
Disable Triggers - false
It is false that the triggers are disabled, so it will chase the player
Try it the other way around
Code: void QuietYou(string& asName, bool abDisabled)
{
SetEnemyDisableTriggers("Myboi", true);
}
void Attack(string& asName, bool abDisabled)
{
SetEnemyDisableTriggers("Myboi", false);
AddEnemyPatrolNode("Myboi", "MoveHerePlease1", 0, "");
}
(06-07-2013, 04:51 PM)thaniels Wrote: Also, if i have this in my script:
if(ScriptDebugOn()) {
}
where do i put my code
Yeh it goes between the { }
Code: if (ScriptDebugOn()) {
// code here
}
Exactly the same as code within a function, the way you show that a block of code belongs in a certain group is with { and }
Here's an example, first as you might see it, and in the second example I've marked it up with comments to show what I mean
Code: void Function(stuff)
{
CODE HERE
if (x == y)
{
CODE HERE
}
}
void Function(stuff)
{ // this starts the code block for Function
CODE HERE
if (x == y)
{ // this starts the code block for the 'if'
CODE HERE
}// this ends the code block for the 'if'
} // this ends the code block for Function
It's also worth remembering that it doesn't matter where you put the { and }, so long as they are there
All of these examples are valid
Code: if (x == y)
{
// code
}
if (x == y) {
// code
}
if (x == y) { // code }
RE: Troubles with monster - thaniels - 06-10-2013
Actually, No. I do want the entity to not notice the player when the player enters the QuietYou volumes and become active when i enter the attack volume, i want the entity to only after a sound file has been played to become active and go towards the player
|