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


Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Noob needs help
X4anco Offline
Member

Posts: 157
Threads: 66
Joined: Apr 2011
Reputation: 0
#1
Noob needs help

Hello, I need to know how to activate an monster when a player collides to on area. Or even better when a player picks something up

...
04-30-2011, 12:48 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#2
RE: Noob needs help

Collide with area:

OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Function01", true, 1);
}
void Function01(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
}

Pick up item:

OnStart()
{
SetPlayerInteractCallback("Item", "Function01", true);
}
void Function01(string &in asEntity)
{
SetEntityActive("Monster", true);
}

04-30-2011, 12:56 PM
Find
X4anco Offline
Member

Posts: 157
Threads: 66
Joined: Apr 2011
Reputation: 0
#3
RE: Noob needs help

Thank-you I'll try it out now
Could you please tell me how to make monster follow nodes?

...
(This post was last modified: 04-30-2011, 01:13 PM by X4anco.)
04-30-2011, 01:00 PM
Find
Karai16 Offline
Member

Posts: 164
Threads: 24
Joined: Apr 2011
Reputation: 0
#4
RE: Noob needs help

(04-30-2011, 12:56 PM)Kyle Wrote: Collide with area:

OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Function01", true, 1);
}
void Function01(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
}

Pick up item:

OnStart()
{
SetPlayerInteractCallback("Item", "Function01", true);
}
void Function01(string &in asEntity)
{
SetEntityActive("Monster", true);
}

I do have a question though. I tried using the code you're telling him to use, but it isn't working with me.

Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
05-01-2011, 01:42 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#5
RE: Noob needs help

(05-01-2011, 01:42 AM)Karai16 Wrote: I do have a question though. I tried using the code you're telling him to use, but it isn't working with me.

Did you plug it all in?

If you used the first script, does the script area match the one you are using for you custom story? Did you replace "Monster" with the name of the monster in you custom story? If yes to both, is the monster in your custom story set to unactive?

If you used the second script, does "Item" have the same name as the name of the item you are using in your custom story? Did you replace "Monster" with the name of the monster in you custom story? If yes to both, is the monster in your custom story set to unactive?

05-01-2011, 01:50 AM
Find
Karai16 Offline
Member

Posts: 164
Threads: 24
Joined: Apr 2011
Reputation: 0
#6
RE: Noob needs help

(05-01-2011, 01:50 AM)Kyle Wrote:
(05-01-2011, 01:42 AM)Karai16 Wrote: I do have a question though. I tried using the code you're telling him to use, but it isn't working with me.

Did you plug it all in?

If you used the first script, does the script area match the one you are using for you custom story? Did you replace "Monster" with the name of the monster in you custom story? If yes to both, is the monster in your custom story set to unactive?

If you used the second script, does "Item" have the same name as the name of the item you are using in your custom story? Did you replace "Monster" with the name of the monster in you custom story? If yes to both, is the monster in your custom story set to unactive?

yes I did... you see this is my code, if you see anything wrong with it please tell me:

void OnStart()
{
    AddUseItemCallback("", "RoomKey", "RoomDoor", "UsedKeyOnDoor", true);
    SetPlayerInteractCallback("RoomKey", "Activatebob", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("RoomDoor", false, true);
    PlaySoundAtEntity("", "unlock_door", "RoomDoor", 0, false);
    RemoveItem("RoomKey");
}

void Activatebob(string &in asEntity)
{
setEntityActive("Bob", true);
}
and yes, I'm sure I named my servant Bob. Also, to help, I'll give you the error it's giving me.
[Image: Error.png]

Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
05-01-2011, 12:09 PM
Find
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#7
RE: Noob needs help

Yep, i have same problem:


void OnStart()
{
SetPlayerLampOil(0);
//if(ScriptDebugOn())
//{
// GiveItemFromFile("lantern", "lantern.ent");
// for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
// SetPlayerLampOil(0);
//}
SetMessage("Journal", "start", 8.0f);;
SetEntityConnectionStateChangeCallback("lever_nice01_1", "StateChangeLever");
SetPlayerInteractCallback("Item", "Officekey", true);
AddUseItemCallback("", "crowbar_1", "prison_section_1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("Player", "Brute_1", "Brute1", true, 1);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
AddEntityCollideCallback("Player", "shake_1", "Earthquake", true, 1);
AddEntityCollideCallback("Player", "AreaKillLights", "KillLights", true, 1);
AddEntityCollideCallback("Player", "AreaKillLights2", "KillLights2", true, 1);
SetEntityPlayerInteractCallback("lantern_1", "Stuff", true);
}

void Officekey(string &in asEntity)
{
SetEntityActive("Brute2", true);
}

Says multiple errors!! Sad

“Life is a game, play it”
05-01-2011, 03:14 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#8
RE: Noob needs help

It might take a while, and I kind of messed up there. I can fix that. Here, try this:

void OnStart()
{
SetPlayerLampOil(0);
if (ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
SetPlayerLampOil(100);
}
SetMessage("Journal", "start", 8.0f);
SetEntityConnectionStateChangeCallback("lever_nice01_1", "StateChangeLever");
SetPlayerInteractCallback("Item", "Officekey", true);
AddUseItemCallback("", "crowbar_1", "prison_section_1", "UserCrowbarOnDoor", true);
SetPlayerInteractCallback("Item", "Officekey", true);
AddEntityCollideCallback("Player", "Brute_1", "Brute1", true, 1);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
AddEntityCollideCallback("Player", "shake_1", "Earthquake", true, 1);
AddEntityCollideCallback("Player", "AreaKillLights", "KillLights", true, 1);
AddEntityCollideCallback("Player", "AreaKillLights2", "KillLights2", true, 1);
SetEntityPlayerInteractCallback("lantern_1", "stuff", true);
}
void Officekey(string &in asEntity)
{
SetEntityActive("Brute2", true);
}

(This post was last modified: 05-01-2011, 03:28 PM by Kyle.)
05-01-2011, 03:16 PM
Find
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#9
RE: Noob needs help

(05-01-2011, 03:16 PM)Kyle Wrote: It might take a while, and I kind of messed up there. I can fix that. Here, try this:

[code]
void OnStart()
{
if (ScriptDebugOn())
{

}

What? I remove these two marks but it doesnt work!

“Life is a game, play it”
(This post was last modified: 05-01-2011, 03:25 PM by HumiliatioN.)
05-01-2011, 03:20 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#10
RE: Noob needs help

(05-01-2011, 03:20 PM)HumiliatioN Wrote:
(05-01-2011, 03:16 PM)Kyle Wrote: It might take a while, and I kind of messed up there. I can fix that. Here, try this:

[code]
void OnStart()
{
if (ScriptDebugOn())
{

}

What? I remove these two marks but it doesnt work!

Sorry, the thing was that I didn't mean to press the post button and so it posted that little amount.

05-01-2011, 03:29 PM
Find




Users browsing this thread: 1 Guest(s)