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
Monster isn't quite activating.
DominusVita Offline
Member

Posts: 96
Threads: 4
Joined: Apr 2011
Reputation: 0
#1
Monster isn't quite activating.

Hey there. I'm trying to activate a grunt and it isn't quite happening. I checked the tutorials various times, and used the script provided. The monster is set to inactive, and the script looks like the following(The important sections are in bold):

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "FirstArea", "First", true, 1);
AddEntityCollideCallback("Player", "TeleStart", "FirstTele", true, 1);
AddEntityCollideCallback("Player", "Tele", "MonsterMash", true, 1);
AddEntityCollideCallback("Player", "WTF", "Second", true, 1);
}

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

{
SetMessage("TheBeginning", "Entry1", 20.0f);
}


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

{
SetMessage("TheBeginning", "Entry2", 20.0f);
}


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

{
SetEntityActive("BadMofo", true);
}



void FirstTele(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("Tele");
// Optional fading effects to make a better teleporting transition.
FadeOut(0);
FadeIn(20);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
//Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<2;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
}


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

}
04-21-2011, 04:31 PM
Find
Josh707 Offline
Junior Member

Posts: 27
Threads: 5
Joined: Apr 2011
Reputation: 0
#2
RE: Monster isn't quite activating.

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

{
SetEntityActive("BadMofo", true);
}


where it says string &in asParent, string &in asChild,

after you put asParent there is no space before the ,

i'm not sure if that's the problem because that's the only one I see... when I make them I don't put spaces

Try my custom story demo here!
Updated 23/04/11
(This post was last modified: 04-21-2011, 04:45 PM by Josh707.)
04-21-2011, 04:44 PM
Find
DominusVita Offline
Member

Posts: 96
Threads: 4
Joined: Apr 2011
Reputation: 0
#3
RE: Monster isn't quite activating.

My other syntax code seems to work fine with it - I tried changing it but no go Sad

It's fine, I'll figure it out at one point or another. Thought I'd poll the more experienced before trying again.
(This post was last modified: 04-21-2011, 04:49 PM by DominusVita.)
04-21-2011, 04:48 PM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#4
RE: Monster isn't quite activating.

Is the scriptarea named Tele and is the monster named BadMofo?
04-21-2011, 05:15 PM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#5
RE: Monster isn't quite activating.

(04-21-2011, 04:48 PM)DominusVita Wrote: My other syntax code seems to work fine with it - I tried changing it but no go Sad

It's fine, I'll figure it out at one point or another. Thought I'd poll the more experienced before trying again.

The trick is identifying exactly what the problem is. I suggest the following, so that you can trace the execution of your script:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddDebugMessage("Started",false);
AddEntityCollideCallback("Player", "FirstArea", "First", true, 1);
AddEntityCollideCallback("Player", "TeleStart", "FirstTele", true, 1);
AddEntityCollideCallback("Player", "Tele", "MonsterMash", true, 1);
AddEntityCollideCallback("Player", "WTF", "Second", true, 1);
}

void First(string &in asParent , string &in asChild , int alState)
{
AddDebugMessage("First Called: " +asParent + "," + asChild,false);
SetMessage("TheBeginning", "Entry1", 20.0f);
}


void Second(string &in asParent , string &in asChild , int alState)
{
AddDebugMessage("Second Called: " +asParent + "," + asChild,false);
SetMessage("TheBeginning", "Entry2", 20.0f);
}


void MonsterMash(string &in asParent , string &in asChild , int alState)
{
AddDebugMessage("MonsterMash Called: " +asParent + "," + asChild,false);
SetEntityActive("BadMofo", true);
}


void FirstTele(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("FirstTele Called: " +asParent + "," + asChild,false);
TeleportPlayer("Tele");
// Optional fading effects to make a better teleporting transition.
FadeOut(0);
FadeIn(20);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
//Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<2;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
}


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

}

If it turns out "MonsterMash Called" never shows up, then you know you aren't triggering the script area*. If it does, you know the problem is in your SetEntitiyActive code. If you are still struggling to locate the error, print out more information. The more information you have, the easier it will be to find the problem.

*This could mean either your callback code is incorrect, or, teleporting into a script area doesn't fire a collision event - the latter you would have to work around.
(This post was last modified: 04-21-2011, 05:19 PM by Apjjm.)
04-21-2011, 05:18 PM
Find
DominusVita Offline
Member

Posts: 96
Threads: 4
Joined: Apr 2011
Reputation: 0
#6
RE: Monster isn't quite activating.

Thanks for the in-depth response, I'll try to find the error with that method.
04-21-2011, 05:22 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#7
RE: Monster isn't quite activating.

If it turns out teleporting to an area doesn't trigger a collide callback you could always use a very short timer (0.01) seconds to call a function immediately after teleporting the player. In the timer's callback do if(GetEntitiesCollide("Player", "Tele")) SetEntityActive("BadMofo", true);

Or just scratch the if statement and set the entity active 0.01 seconds later hehe Smile

Another option would be to set the entity active in your teleport function as opposed to making a collide callback with the teleport target area. So just add SetEntityActive("BadMofo", true); under your FirstTele function.

(This post was last modified: 04-21-2011, 05:37 PM by palistov.)
04-21-2011, 05:36 PM
Find
DominusVita Offline
Member

Posts: 96
Threads: 4
Joined: Apr 2011
Reputation: 0
#8
RE: Monster isn't quite activating.

That did it, having it all triggered in that one function made it work. Thanks Smile
04-21-2011, 05:46 PM
Find




Users browsing this thread: 1 Guest(s)