Frictional Games Forum (read-only)

Full Version: Noob needs help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
Collide with area:

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

Pick up item:

Code:
OnStart()
{
SetPlayerInteractCallback("Item", "Function01", true);
}
void Function01(string &in asEntity)
{
SetEntityActive("Monster", true);
}
Thank-you I'll try it out now
Could you please tell me how to make monster follow nodes?
(04-30-2011, 12:56 PM)Kyle Wrote: [ -> ]Collide with area:

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

Pick up item:

Code:
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.
(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)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:

Code:
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]
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
It might take a while, and I kind of messed up there. I can fix that. Here, try this:

Code:
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);
}
(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!
(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.
Pages: 1 2