Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need some help with two problems.
Author Message
A Tricky Carnie Offline
Member

Posts: 72
Joined: Sep 2011
Reputation: 0
Post: #1
I need some help with two problems.

Okay, well my first problem is that I set my script for a level so when the player picks up a key, I want a brute to spawn, but it doesn't seem to work, so this is my script:
Quote:////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("key_4", "locked_door1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("key_4", "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_brute_1", true);
ShowEnemyPlayerPosition("servant_brute_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

And my other problem is that for whatever reason, monsters in my custom story slide, and I'd like to know to fix this.

Thanks in advance for any help.

09-30-2011 07:10 PM
Find all posts by this user Quote this message in a reply
Lambda Offline
Junior Member

Posts: 39
Joined: Mar 2011
Reputation: 0
Post: #2
RE: I need some help with two problems.

I think your error is with "SetEntityCallbackFunc("key_4", "OnPickup");", instead, try putting the monster-spawnscript inside AddUseItemCallback. It should look like this:
////////////////////////////// Run when entering map
void OnEnter()
{
AddUseItemCallback("key_4", "locked_door1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("key_1");SetEntityActive("servant_brute_1", true);
ShowEnemyPlayerPosition("servant_brute_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}



Or, if you want it when the key is picked up, I'd use SetEntityInteractCallback, and as internal name, the name of the key etc. etc.

And, as for that monsters can slide: Make sure you have pathnodes, or otherwise, I wouldn't know.

Hope that helps!

Khaaaan!
(This post was last modified: 09-30-2011 07:32 PM by Lambda.)
09-30-2011 07:29 PM
Find all posts by this user Quote this message in a reply
A Tricky Carnie Offline
Member

Posts: 72
Joined: Sep 2011
Reputation: 0
Post: #3
RE: I need some help with two problems.

(09-30-2011 07:29 PM)Lambda Wrote:  I think your error is with "SetEntityCallbackFunc("key_4", "OnPickup");", instead, try putting the monster-spawnscript inside AddUseItemCallback. It should look like this:
////////////////////////////// Run when entering map
void OnEnter()
{
AddUseItemCallback("key_4", "locked_door1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("key_1");SetEntityActive("servant_brute_1", true);
ShowEnemyPlayerPosition("servant_brute_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}



Or, if you want it when the key is picked up, I'd use SetEntityInteractCallback, and as internal name, the name of the key etc. etc.

And, as for that monsters can slide: Make sure you have pathnodes, or otherwise, I wouldn't know.

Hope that helps!
I did that, and I'm getting this error message:
Quote:ExecuteString (1,1) : ERR : No matching signatures to 'OnStart()' main (4,2) : ERR : No matching signatures to 'AddUseItemCallback(string@&, string@&, string@&, const bool)'

(This post was last modified: 10-01-2011 10:31 PM by A Tricky Carnie.)
10-01-2011 10:30 PM
Find all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 910
Joined: Sep 2010
Reputation: 7
Post: #4
RE: I need some help with two problems.

I see your simple problem, which has a simple answer. I'm suprised nobody replied on the answer yet. It appears that some people here on the forums may try to help when they still need to understand it all, if that would be the case.

The answer to your problem:

Change this: void OnEnter()

To this: void OnStart()

Simply saying, if there is no OnStart() function, then the level can't be run.

(This post was last modified: 10-01-2011 11:24 PM by Kyle.)
10-01-2011 11:15 PM
Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,475
Joined: Jul 2011
Reputation: 234
Post: #5
RE: I need some help with two problems.

(10-01-2011 11:15 PM)Kyle Wrote:  I see your simple problem, which has a simple answer. I'm suprised nobody replied on the answer yet. It appears that some people here on the forums may try to help when they still need to understand it all, if that would be the case.

You can have a script that doesn't have OnEnter() and OnStart() in it and it won't crash the game.

Tutorials: From Noob to Pro
10-01-2011 11:53 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 910
Joined: Sep 2010
Reputation: 7
Post: #6
RE: I need some help with two problems.

(10-01-2011 11:53 PM)Your Computer Wrote:  
(10-01-2011 11:15 PM)Kyle Wrote:  I see your simple problem, which has a simple answer. I'm suprised nobody replied on the answer yet. It appears that some people here on the forums may try to help when they still need to understand it all, if that would be the case.


You can have a script that doesn't have OnEnter() and OnStart() in it and it won't crash the game.


Yes, I know. I only tried to make it simple enough for no confusion or complications.

10-01-2011 11:57 PM
Find all posts by this user Quote this message in a reply
A Tricky Carnie Offline
Member

Posts: 72
Joined: Sep 2011
Reputation: 0
Post: #7
RE: I need some help with two problems.

(10-01-2011 11:15 PM)Kyle Wrote:  I see your simple problem, which has a simple answer. I'm suprised nobody replied on the answer yet. It appears that some people here on the forums may try to help when they still need to understand it all, if that would be the case.

The answer to your problem:

Change this: void OnEnter()

To this: void OnStart()

Simply saying, if there is no OnStart() function, then the level can't be run.
I changed it to void OnStart() but I'm still getting the "No matching signatures to 'OnStart()'" error.
This is what my script looks like right now:
Quote:////////////////////////////// Run when entering map
void OnStart()
{
AddUseItemCallback("key_4", "locked_door1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("key_1");SetEntityActive("servant_brute_1", true);
ShowEnemyPlayerPosition("servant_brute_1");
}


////////////////////////////
// Run when leaving map
void OnLeave()
{


}


And I'm still getting the " matching signatures to 'AddUseItemCallback(string@&, string@&, string@&, const bool)'" error, I figure i'm missing something, but I just don't know what.

10-02-2011 05:11 PM
Find all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 910
Joined: Sep 2010
Reputation: 7
Post: #8
RE: I need some help with two problems.

void OnStart()
{
     AddUseItemCallback("", "key_4", "locked_door1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
     SetSwingDoorLocked("locked_door1", false, true);
     PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
     RemoveItem("key_1");
     SetEntityActive("servant_brute_1", true);
     ShowEnemyPlayerPosition("servant_brute_1");
}

If you see that error, then the command function doesn't exist when the name or parameters have something abnormal.

(This post was last modified: 10-02-2011 05:25 PM by Kyle.)
10-02-2011 05:24 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)