Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Crowbar script
Bozcovich Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jan 2012
Reputation: 0
#1
Crowbar script

Hey, I'm trying to make a crowbar/destroying door script, but i keep getting error,


Whats wrong with this code? Big Grin




void OnStart()

{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
}
{
AddUseItemCallback("1", "crowbar_1", "Mansion_1", UseCrowbarOnDoor, true);
}
void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ghostgrunt", true);
ShowEnemyPlayerPosition("ghostgrunt");
AddTimer("", 1, "TimerGruntEnd");
StartPlayerLookAt("AreaLookAt", 30, 50, "");
AddTimer("", 1, "TimerStopPlayerLook");
}


Void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
RemoveItem(asItem);
}
void TimerStopPlayerLook (string &in asTimer)
{
SetEntityActive("ghostgrunt", false);
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
}






This is my code without the crowbar script and it works fine:



void OnStart()

{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ghostgrunt", true);
ShowEnemyPlayerPosition("ghostgrunt");
AddTimer("", 1, "TimerGruntEnd");
StartPlayerLookAt("AreaLookAt", 30, 50, "");
AddTimer("", 1, "TimerStopPlayerLook");
}

void TimerStopPlayerLook (string &in asTimer)
{
SetEntityActive("ghostgrunt", false);
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
}


Big Grin
(This post was last modified: 01-17-2012, 06:40 PM by Bozcovich.)
01-17-2012, 01:37 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
RE: Crowbar script

You have two void OnStarts? Anyway, use this:


Quote:void OnStart()

{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddUseItemCallback("1", "crowbar_1", "Mansion_1", UseCrowbarOnDoor, true);
}


void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ghostgrunt", true);
ShowEnemyPlayerPosition("ghostgrunt");
AddTimer("", 1, "TimerGruntEnd");
StartPlayerLookAt("AreaLookAt", 30, 50, "");
AddTimer("", 1, "TimerStopPlayerLook");
}


void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
RemoveItem(asItem);
}

void TimerStopPlayerLook (string &in asTimer)
{
SetEntityActive("ghostgrunt", false);
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
}

void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ghostgrunt", true);
ShowEnemyPlayerPosition("ghostgrunt");
AddTimer("", 1, "TimerGruntEnd");
StartPlayerLookAt("AreaLookAt", 30, 50, "");
AddTimer("", 1, "TimerStopPlayerLook");
}

void TimerStopPlayerLook (string &in asTimer)
{
SetEntityActive("ghostgrunt", false);
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
}
You are putting the callbacks in the wrong places. They go in void OnStart. And don't make another void OnStart for a different even. Look at the way I set it up and go from there.

01-17-2012, 02:24 AM
Find
Shadowfied Offline
Senior Member

Posts: 261
Threads: 34
Joined: Jul 2010
Reputation: 5
#3
RE: Crowbar script

All callbacks must be within the squiggly brackets of the onstart void.

void OnStart()
{
They go here
here
here
}

etc.

(01-17-2012, 02:24 AM)flamez3 Wrote: You have two void OnStarts? Anyway, use this:


Quote:void OnStart()

{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddUseItemCallback("1", "crowbar_1", "Mansion_1", UseCrowbarOnDoor, true);
}


void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ghostgrunt", true);
ShowEnemyPlayerPosition("ghostgrunt");
AddTimer("", 1, "TimerGruntEnd");
StartPlayerLookAt("AreaLookAt", 30, 50, "");
AddTimer("", 1, "TimerStopPlayerLook");
}


void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
RemoveItem(asItem);
}

void TimerStopPlayerLook (string &in asTimer)
{
SetEntityActive("ghostgrunt", false);
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
}

void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ghostgrunt", true);
ShowEnemyPlayerPosition("ghostgrunt");
AddTimer("", 1, "TimerGruntEnd");
StartPlayerLookAt("AreaLookAt", 30, 50, "");
AddTimer("", 1, "TimerStopPlayerLook");
}

void TimerStopPlayerLook (string &in asTimer)
{
SetEntityActive("ghostgrunt", false);
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
}
You are putting the callbacks in the wrong places. They go in void OnStart. And don't make another void OnStart for a different even. Look at the way I set it up and go from there.
He does not have two OnStart's, if you read, he said that the other part was the script without the crowbar.


Current - Castle Darkuan
Other - F*cked Map
(This post was last modified: 01-17-2012, 09:36 AM by Shadowfied.)
01-17-2012, 09:35 AM
Find
Bozcovich Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jan 2012
Reputation: 0
#4
RE: Crowbar script

Thanks for the help, didnt know the Callbacks should be there Big Grin
01-17-2012, 03:55 PM
Find
Bozcovich Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jan 2012
Reputation: 0
#5
RE: Crowbar script

Gah, i get errors with this code, anyone knows why? The problem is with the Crowbar/breaking the door script.



void OnStart()

{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddUseItemCallback("1", "crowbar_1", "mansion_1", "UseCrowbarOnDoor" , true);
AddEntityCollideCallback("", "crowbar_joint_1", "ScriptArea_2", "BlowTheShit" , true);
}

Void BlowTheShit(string &in asEntity)
{
SetPropHealth("mansion_1", 0);
}
void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ghostgrunt", true);
ShowEnemyPlayerPosition("ghostgrunt");
AddTimer("", 1, "TimerGruntEnd");
StartPlayerLookAt("AreaLookAt", 30, 50, "");
AddTimer("", 1, "TimerStopPlayerLook");
}


void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
RemoveItem(asItem);
}

void TimerStopPlayerLook (string &in asTimer)
{
SetEntityActive("ghostgrunt", false);
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
}
01-17-2012, 05:19 PM
Find
Shadowfied Offline
Senior Member

Posts: 261
Threads: 34
Joined: Jul 2010
Reputation: 5
#6
RE: Crowbar script

Can you tell me what error you get?

Current - Castle Darkuan
Other - F*cked Map
01-17-2012, 05:27 PM
Find
Bozcovich Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jan 2012
Reputation: 0
#7
RE: Crowbar script

Main(9,1):ERR: Identifier 'Void' is not a data type
Main/6,1):ERR: No matching Signatures to 'AddEntityCollideCallback(string@&,string@&,string@&,string@&, const cool)'
Main(10,1): ERR : Not all paths return a value
01-17-2012, 05:31 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#8
RE: Crowbar script

Main(9,1) problem: You have written void with a big V on void blowtheshit

Main(6,1) problem: ("", "crowbar_joint_1", "ScriptArea_2", "BlowTheShit" , true); is written wrong it should be:

AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_2", "BlowTheShit" , true, 1); (I think)


(This post was last modified: 01-17-2012, 06:00 PM by SilentStriker.)
01-17-2012, 05:58 PM
Find
Bozcovich Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jan 2012
Reputation: 0
#9
RE: Crowbar script



Thanks! Big Grin It doesnt show an error message now but i nothing happens with the door when i bend the crowbar :S
(This post was last modified: 01-17-2012, 06:15 PM by Bozcovich.)
01-17-2012, 06:13 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#10
RE: Crowbar script

Your syntax is wrong.

Replace (string &in asEntity)

With

(string &in asParent, string &in asChild, int alState)

01-17-2012, 06:16 PM
Find




Users browsing this thread: 1 Guest(s)