naseem142
Member
Posts: 153
Threads: 19
Joined: Oct 2012
Reputation:
0
|
Grunt disappearing
How can i make the grunt "disappear" if he didn't find the player after 15 seconds?
Thank you.
|
|
10-09-2012, 03:26 PM |
|
Robby
Posting Freak
Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation:
47
|
RE: Grunt disappearing
You use a timer that triggers after 15 seconds, and then you use the "SetEntityActive" function.
Details:
AddTimer("", 15.0f, "GruntDisable");
void GruntDisable(string &in asTimer)
{
SetEntityActive("Grunt_Name", false);
}
Add the timer function to the event script that triggers the monster's spawn.
Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
|
|
10-09-2012, 03:30 PM |
|
Lizard
Member
Posts: 174
Threads: 23
Joined: Jul 2012
Reputation:
5
|
RE: Grunt disappearing
(10-09-2012, 03:26 PM)naseem142 Wrote: How can i make the grunt "disappear" if he didn't find the player after 15 seconds?
Thank you. you could add a timer, with makes him disappear
example
Void OnStart()
{
AddTimer("timers name", "number of second", "function to call when the time has passed");
}
void function(string &in asTimer)
{
SetEntityActive("name of monster", false); (false for making him dissapear)
}
CURRENT PROJECT:
A Fathers Secret == Just started
|
|
10-09-2012, 03:34 PM |
|
naseem142
Member
Posts: 153
Threads: 19
Joined: Oct 2012
Reputation:
0
|
RE: Grunt disappearing
(10-09-2012, 03:34 PM)ZereboO Wrote: (10-09-2012, 03:26 PM)naseem142 Wrote: How can i make the grunt "disappear" if he didn't find the player after 15 seconds?
Thank you. you could add a timer, with makes him disappear
example
Void OnStart()
{
AddTimer("timers name", "number of second", "function to call when the time has passed");
}
void function(string &in asTimer)
{
SetEntityActive("name of monster", false); (false for making him dissapear)
} I'm not sure where do i put them in the lines , i started creating my map yesterday.
I tried to put it where i think it belongs but i got an error. :/
|
|
10-09-2012, 03:59 PM |
|
Robby
Posting Freak
Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation:
47
|
RE: Grunt disappearing
What's the error?. Otherwise "we" can't help.
Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
(This post was last modified: 10-09-2012, 04:06 PM by Robby.)
|
|
10-09-2012, 04:06 PM |
|
naseem142
Member
Posts: 153
Threads: 19
Joined: Oct 2012
Reputation:
0
|
RE: Grunt disappearing
(10-09-2012, 04:06 PM)Nemet Robert Wrote: What's the error?. Otherwise "we" can't help. I'm getting different errors whenever i try to put them. I'm a noob :c
void OnStart()
{
AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
SetEntityCallbackFunc("key_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}
void DoorLockedPlayer(string &in entity)
{
if(GetSwingDoorLocked("gruntdoorss") == true)
{
SetMessage("Messages", "gruntdoor", 0);
}
}
//////////////////////////////////////////////////////////////////
void OnEnter()
{
AddUseItemCallback("", "trap", "locked_door1", "Trapitup", true);
SetEntityCallbackFunc("trap", "OnPickup1");
}
void Trapitup(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("trap");
}
void OnPickup1(string &in asEntity, string &in type)
{
SetEntityActive("1", true);
ShowEnemyPlayerPosition("1");
SetEntityActive("2", true);
ShowEnemyPlayerPosition("2");
SetEntityActive("3", true);
ShowEnemyPlayerPosition("3");
SetEntityActive("4", true);
ShowEnemyPlayerPosition("4");
SetEntityActive("5", true);
ShowEnemyPlayerPosition("5");
}
////////////////////////////////////////////////////////////////////////////////////
void Explode(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("vase_1", 0);
SetPropHealth("vase_2", 0);
}
//////////////////////////////////////////////////////////////////////////////////////
|
|
10-09-2012, 04:07 PM |
|
Robby
Posting Freak
Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation:
47
|
RE: Grunt disappearing
void OnStart()
{
AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
SetEntityCallbackFunc("key_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("servant_grunt_1", true);
AddTimer("", 15.0f, "GruntDisable");
ShowEnemyPlayerPosition("servant_grunt_1");
}
void GruntDisable(string &in asTimer)
{
SetEntityActive("servant_grunt_1", false);
}
void DoorLockedPlayer(string &in entity)
{
if(GetSwingDoorLocked("gruntdoorss") == true)
{
SetMessage("Messages", "gruntdoor", 0);
}
}
//////////////////////////////////////////////////////////////////
void OnEnter()
{
AddUseItemCallback("", "trap", "locked_door1", "Trapitup", true);
SetEntityCallbackFunc("trap", "OnPickup1");
}
void Trapitup(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("trap");
}
void OnPickup1(string &in asEntity, string &in type)
{
SetEntityActive("1", true);
ShowEnemyPlayerPosition("1");
SetEntityActive("2", true);
ShowEnemyPlayerPosition("2");
SetEntityActive("3", true);
ShowEnemyPlayerPosition("3");
SetEntityActive("4", true);
ShowEnemyPlayerPosition("4");
SetEntityActive("5", true);
ShowEnemyPlayerPosition("5");
}
////////////////////////////////////////////////////////////////////////////////////
void Explode(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("vase_1", 0);
SetPropHealth("vase_2", 0);
}
//////////////////////////////////////////////////////////////////////////////////////
Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
(This post was last modified: 10-09-2012, 04:14 PM by Robby.)
|
|
10-09-2012, 04:10 PM |
|
naseem142
Member
Posts: 153
Threads: 19
Joined: Oct 2012
Reputation:
0
|
RE: Grunt disappearing
(10-09-2012, 04:10 PM)Nemet Robert Wrote: void OnStart()
{
AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
SetEntityCallbackFunc("key_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("servant_grunt_1", true);
AddTimer("", 15.0f, "GruntDisable");
ShowEnemyPlayerPosition("servant_grunt_1");
}
void GruntDisable(string &in asTimer)
{
SetEntityActive("servant_grunt_1", false);
}
void DoorLockedPlayer(string &in entity)
{
if(GetSwingDoorLocked("gruntdoorss") == true)
{
SetMessage("Messages", "gruntdoor", 0);
}
}
//////////////////////////////////////////////////////////////////
void OnEnter()
{
AddUseItemCallback("", "trap", "locked_door1", "Trapitup", true);
SetEntityCallbackFunc("trap", "OnPickup1");
}
void Trapitup(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("trap");
}
void OnPickup1(string &in asEntity, string &in type)
{
SetEntityActive("1", true);
ShowEnemyPlayerPosition("1");
SetEntityActive("2", true);
ShowEnemyPlayerPosition("2");
SetEntityActive("3", true);
ShowEnemyPlayerPosition("3");
SetEntityActive("4", true);
ShowEnemyPlayerPosition("4");
SetEntityActive("5", true);
ShowEnemyPlayerPosition("5");
}
////////////////////////////////////////////////////////////////////////////////////
void Explode(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("vase_1", 0);
SetPropHealth("vase_2", 0);
}
////////////////////////////////////////////////////////////////////////////////////// thank you
|
|
10-09-2012, 04:18 PM |
|
|