Hartmann
Member
Posts: 52
Threads: 18
Joined: Jun 2012
Reputation:
0
|
Error. missing a ";" or ","
can you find the cause to this
void OnStart()
{
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "mansion_2", "KeyOnDoor_2", true);
AddUseItemCallback("", "key_3", "mansion_5", "KeyOnDoor_5", true);
SetEntityPlayerInteractCallback("key_3", "ActivateMonster", true);
MyFunc("key_3", "SetEntityCallbackFunc");
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, true);
RemoveItem("key_1");
}
void KeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0.0f, true);
RemoveItem("key_2");
}
void KeyOnDoor_5(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_5", true, true);
PlaySoundAtEntity("", "unlock_door", "mansion_5", 0.0f, true);
RemoveItem("key_3");
}
void SetEntityCallbackFunc(string& asName, string& asCallback);
{
AddPropImpulse("mansion_3", 0, 0, 10, "World");
AddTimer("StopLook", 3, "LookAtDoor");
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
StartPlayerLookAt("mansion35", 10, 10, "");
}
////////////////////////////
// Run when leaving map
void OnLeave()
}
void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 4, "Idle");
}
void LookAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}
|
|
06-23-2012, 03:08 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: Error. missing a ";" or ","
MyFunc("key_3", "SetEntityCallbackFunc");
?? What are you planning to do with that?
|
|
06-23-2012, 03:35 PM |
|
Hartmann
Member
Posts: 52
Threads: 18
Joined: Jun 2012
Reputation:
0
|
RE: Error. missing a ";" or ","
(06-23-2012, 03:35 PM)FastHunteR Wrote: MyFunc("key_3", "SetEntityCallbackFunc");
?? What are you planning to do with that? i will make it so yo pick up the key u will look at the door witch close
|
|
06-23-2012, 03:58 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: Error. missing a ";" or ","
wrong function then, you need a callback.
use this inside OnStart():
SetEntityCallbackFunc("key_3", "OnPickup");
Then instead of this:
void SetEntityCallbackFunc(string& asName, string& asCallback);
{
AddPropImpulse("mansion_3", 0, 0, 10, "World");
AddTimer("StopLook", 3, "LookAtDoor");
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
StartPlayerLookAt("mansion35", 10, 10, "");
}
use this:
void OnPickup(string &in asEntity, string &in type)
{
AddPropImpulse("mansion_3", 0, 0, 10, "World");
AddTimer("StopLook", 3, "LookAtDoor");
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
StartPlayerLookAt("mansion35", 10, 10, "");
}
by the way, you really want the player to look at "mansion35" or do you mean mansion_5 and you got a typo? Anyway, fix it if you got one.
Also, at every PlaySoundAtEntity function, use the extension .snt at the sound name. Example:
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
(This post was last modified: 06-23-2012, 04:19 PM by Cruzore.)
|
|
06-23-2012, 04:17 PM |
|
Hartmann
Member
Posts: 52
Threads: 18
Joined: Jun 2012
Reputation:
0
|
RE: Error. missing a ";" or ","
(06-23-2012, 04:17 PM)FastHunteR Wrote: wrong function then, you need a callback.
use this inside OnStart():
SetEntityCallbackFunc("key_3", "OnPickup");
Then instead of this:
void SetEntityCallbackFunc(string& asName, string& asCallback);
{
AddPropImpulse("mansion_3", 0, 0, 10, "World");
AddTimer("StopLook", 3, "LookAtDoor");
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
StartPlayerLookAt("mansion35", 10, 10, "");
}
use this:
void OnPickup(string &in asEntity, string &in type)
{
AddPropImpulse("mansion_3", 0, 0, 10, "World");
AddTimer("StopLook", 3, "LookAtDoor");
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
StartPlayerLookAt("mansion35", 10, 10, "");
}
by the way, you really want the player to look at "mansion35" or do you mean mansion_5 and you got a typo? Anyway, fix it if you got one.
Also, at every PlaySoundAtEntity function, use the extension .snt at the sound name. Example:
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
Ty for the tips but i still get the same error
(06-23-2012, 04:28 PM)Hartmann Wrote: (06-23-2012, 04:17 PM)FastHunteR Wrote: wrong function then, you need a callback.
use this inside OnStart():
SetEntityCallbackFunc("key_3", "OnPickup");
Then instead of this:
void SetEntityCallbackFunc(string& asName, string& asCallback);
{
AddPropImpulse("mansion_3", 0, 0, 10, "World");
AddTimer("StopLook", 3, "LookAtDoor");
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
StartPlayerLookAt("mansion35", 10, 10, "");
}
use this:
void OnPickup(string &in asEntity, string &in type)
{
AddPropImpulse("mansion_3", 0, 0, 10, "World");
AddTimer("StopLook", 3, "LookAtDoor");
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
StartPlayerLookAt("mansion35", 10, 10, "");
}
by the way, you really want the player to look at "mansion35" or do you mean mansion_5 and you got a typo? Anyway, fix it if you got one.
Also, at every PlaySoundAtEntity function, use the extension .snt at the sound name. Example:
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
Ty for the tips but i still get the same error ok i fixed the error but now the key wont unlock mansion_5.. shit just got serios
(This post was last modified: 06-23-2012, 04:33 PM by Hartmann.)
|
|
06-23-2012, 04:28 PM |
|
SilentStriker
Posting Freak
Posts: 950
Threads: 26
Joined: Jul 2011
Reputation:
43
|
RE: Error. missing a ";" or ","
May I ask what MyFunc is for?
The easiest way to make a KeyOnDoor script is by using the syntax's in the function instead of calling KeyOnDoor_1 KeyOnDoor_2 etc
use this script:
void OnStart() { AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true); AddUseItemCallback("", "key_2", "mansion_2", "KeyOnDoor", true); AddUseItemCallback("", "key_3", "mansion_5", "KeyOnDoor", true); SetEntityPlayerInteractCallback("key_3", "ActivateMonster", true); SetEntityPlayerInteractCallback("key_3", "DoorLook", true); }
void KeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked(asEntity, false, true); PlaySoundAtEntity("", "unlock_door", asEntity, 0.0f, true); RemoveItem(asItem); }
void DoorLook(string& asEntity); { AddPropImpulse("mansion_3", 0, 0, 10, "World"); AddTimer("StopLook", 3, "LookAtDoor"); PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true); StartPlayerLookAt("mansion35", 10, 10, ""); }
//////////////////////////// // Run when leaving map void OnLeave() {
}
void ActivateMonster(string &in item) { SetEntityActive("servant_grunt_1", true); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 4, "Idle"); }
void LookAtDoor(string &in asTimer) { StopPlayerLookAt(); }
(This post was last modified: 06-23-2012, 04:50 PM by SilentStriker.)
|
|
06-23-2012, 04:48 PM |
|
Hartmann
Member
Posts: 52
Threads: 18
Joined: Jun 2012
Reputation:
0
|
RE: Error. missing a ";" or ","
(06-23-2012, 04:48 PM)SilentStriker Wrote: May I ask what MyFunc is for?
The easiest way to make a KeyOnDoor script is by using the syntax's in the function instead of calling KeyOnDoor_1 KeyOnDoor_2 etc
use this script:
void OnStart() { AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true); AddUseItemCallback("", "key_2", "mansion_2", "KeyOnDoor", true); AddUseItemCallback("", "key_3", "mansion_5", "KeyOnDoor", true); SetEntityPlayerInteractCallback("key_3", "ActivateMonster", true); SetEntityPlayerInteractCallback("key_3", "DoorLook", true); }
void KeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked(asEntity, false, true); PlaySoundAtEntity("", "unlock_door", asEntity, 0.0f, true); RemoveItem(asItem); }
void DoorLook(string& asEntity); { AddPropImpulse("mansion_3", 0, 0, 10, "World"); AddTimer("StopLook", 3, "LookAtDoor"); PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true); StartPlayerLookAt("mansion35", 10, 10, ""); }
//////////////////////////// // Run when leaving map void OnLeave() {
}
void ActivateMonster(string &in item) { SetEntityActive("servant_grunt_1", true); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "Idle"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 4, "Idle"); }
void LookAtDoor(string &in asTimer) { StopPlayerLookAt(); }
Please red the thread
|
|
06-23-2012, 04:54 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: Error. missing a ";" or ","
Paste the whole script again?
|
|
06-23-2012, 05:02 PM |
|
Hartmann
Member
Posts: 52
Threads: 18
Joined: Jun 2012
Reputation:
0
|
RE: Error. missing a ";" or ","
(06-23-2012, 05:02 PM)FastHunteR Wrote: Paste the whole script again? All errors have bene fixed. But thanks for you intention to help a begginer
|
|
06-23-2012, 05:08 PM |
|
|