Saren
Member
Posts: 196
Threads: 20
Joined: Jan 2012
Reputation:
1
|
Wall script
Okay so I got this script about breaking a wall but the game dose'nt like it for some reason, can anyone spot a flaw?
AddUseItemCallback("Hammer & Chipper", "cell_breakable_wall_1", "BreakWall", true);
void BreakWall("Hammer & Chipper" , "cell_breakable_wall_1");
{
SetSwingDoorLocked("cell_breakable_wall_1", false, true);
PlaySoundAtEntity("", "unlock_door", "cell_breakable_wall_1", 0, false);
SetPropHealth("cell_breakable_wall_1", 0);
}
(This post was last modified: 03-08-2012, 06:50 PM by Saren.)
|
|
03-06-2012, 11:53 AM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Wall script
I would try using SetEntityActive instead of prophealth
|
|
03-06-2012, 12:02 PM |
|
Saren
Member
Posts: 196
Threads: 20
Joined: Jan 2012
Reputation:
1
|
RE: Wall script
(03-06-2012, 12:02 PM)flamez3 Wrote: I would try using SetEntityActive instead of prophealth So it would be: SetEntityActive("cell_breakable_wall_1", 0);
?
|
|
03-06-2012, 12:08 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Wall script
SetEntityActive("cell_breakable_wall_1", false);
|
|
03-06-2012, 12:22 PM |
|
Saren
Member
Posts: 196
Threads: 20
Joined: Jan 2012
Reputation:
1
|
RE: Wall script
(03-06-2012, 12:22 PM)flamez3 Wrote: SetEntityActive("cell_breakable_wall_1", false); Ah ok, fair enough, thx, I'll test it now
Edit: Nope, did'nt help at all: main (66,19) ERR: Expected identifier
main (69,1) ERR: Unexpected token {
(This post was last modified: 03-06-2012, 12:32 PM by Saren.)
|
|
03-06-2012, 12:26 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Wall script
Post your entire script.
|
|
03-06-2012, 01:04 PM |
|
Saren
Member
Posts: 196
Threads: 20
Joined: Jan 2012
Reputation:
1
|
RE: Wall script
(03-06-2012, 01:04 PM)flamez3 Wrote: Post your entire script. Alrighty
// Run when entering map
void OnStart()
{
AddUseItemCallback("", "Prisonkey", "prisondoor", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prisondoor", false, true);
PlaySoundAtEntity("", "unlock_door", "prisondoor", 0, false);
RemoveItem("Prisonkey");
}
//Prison brute
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute", true);
AddEnemyPatrolNode("servant_brute", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_16", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_19", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_20", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_21", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_22", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_23", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_24", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_25", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_26", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_27", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_28", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_29", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_30", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_31", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_32", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_33", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_34", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_35", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_36", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_37", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_38", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_39", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_40", 0, "");
}
void Despawnservant_brute(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_brute", false);
}
//Cell wall
AddUseItemCallback("Hammer & Chipper", "cell_breakable_wall_1", "BreakWall", true);
void BreakWall("Hammer & Chipper" , "cell_breakable_wall_1");
{
SetSwingDoorLocked("cell_breakable_wall_1", false, true);
PlaySoundAtEntity("", "unlock_door", "cell_breakable_wall_1", 0, false);
SetEntityActive("cell_breakable_wall_1", false);
}
void OnLeave()
{
}
|
|
03-06-2012, 01:55 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Wall script
Before you get snappy at me, make sure you have set everything up correctly. All callbacks must be defined, and not put outside either void OnStart, void OnEnter or void OnLeave. Use this:
// Run when entering map
void OnStart()
{
AddUseItemCallback("", "Prisonkey", "prisondoor", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("Hammer & Chipper", "cell_breakable_wall_1", "BreakWall", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prisondoor", false, true);
PlaySoundAtEntity("", "unlock_door", "prisondoor", 0, false);
RemoveItem("Prisonkey");
}
//Prison brute
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute", true);
AddEnemyPatrolNode("servant_brute", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_16", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_19", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_20", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_21", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_22", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_23", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_24", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_25", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_26", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_27", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_28", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_29", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_30", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_31", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_32", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_33", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_34", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_35", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_36", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_37", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_38", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_39", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_40", 0, "");
}
void Despawnservant_brute(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_brute", false);
}
void BreakWall("Hammer & Chipper" , "cell_breakable_wall_1");
{
SetSwingDoorLocked("cell_breakable_wall_1", false, true);
PlaySoundAtEntity("", "unlock_door", "cell_breakable_wall_1", 0, false);
SetEntityActive("cell_breakable_wall_1", false);
}
void OnLeave()
{
}
|
|
03-06-2012, 02:38 PM |
|
Saren
Member
Posts: 196
Threads: 20
Joined: Jan 2012
Reputation:
1
|
RE: Wall script
(03-06-2012, 02:38 PM)flamez3 Wrote: Before you get snappy at me, make sure you have set everything up correctly. All callbacks must be defined, and not put outside either void OnStart, void OnEnter or void OnLeave. Use this: Snappy? xD Who said anything about getting snappy.. lol, I think it's nice that you wonna help.
Still don't work.. :/
main (68,1)ERR Unxpected token {
It's the token under Breakwall
(This post was last modified: 03-06-2012, 02:54 PM by Saren.)
|
|
03-06-2012, 02:42 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Wall script
Use this:
// Run when entering map
void OnStart()
{
AddUseItemCallback("", "Prisonkey", "prisondoor", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("Hammer & Chipper", "cell_breakable_wall_1", "BreakWall", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prisondoor", false, true);
PlaySoundAtEntity("", "unlock_door", "prisondoor", 0, false);
RemoveItem("Prisonkey");
}
//Prison brute
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute", true);
AddEnemyPatrolNode("servant_brute", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_16", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_19", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_20", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_21", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_22", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_23", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_24", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_25", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_26", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_27", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_28", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_29", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_30", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_31", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_32", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_33", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_34", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_35", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_36", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_37", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_38", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_39", 0, "");
AddEnemyPatrolNode("servant_brute", "PathNodeArea_40", 0, "");
}
void Despawnservant_brute(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_brute", false);
}
void BreakWall("Hammer & Chipper" , "cell_breakable_wall_1")
{
SetSwingDoorLocked("cell_breakable_wall_1", false, true);
PlaySoundAtEntity("", "unlock_door", "cell_breakable_wall_1", 0, false);
SetEntityActive("cell_breakable_wall_1", false);
}
(This post was last modified: 03-06-2012, 03:02 PM by flamez3.)
|
|
03-06-2012, 03:01 PM |
|
|