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
Script/area problem.
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#11
RE: Script/area problem.

Its ok. I see now that the value for that monster function is actually 1... Smile But it's still false

Trying is the first step to success.
01-07-2013, 07:26 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#12
RE: Script/area problem.

(01-07-2013, 07:32 PM)Robosprog Wrote: Monster doesn't spawn at all, and I don't do quick reloads because of that, I restart entire story/game. And it only activates once, with that script, and I have tested that on another map :p.

That's weird. Because you put false in there, it should activate again when you collide with the area again

Trying is the first step to success.
01-07-2013, 07:43 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#13
RE: Script/area problem.

Is the area itself active?

Tutorials: From Noob to Pro
01-07-2013, 07:49 PM
Website Find
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#14
RE: Script/area problem.

I've tested the script - as far as code goes, it's well formed (should work in theory).

Is your monster by any chance completely inside (or at least intersects with) ScriptArea_1? Like, did you want it to be deactivated once it exits that area? That would explain it all. If it is, then almost as soon as you activate it in cake(), a collision is detected with the script area, so cake1() is called, where the monster is immediately disabled. It happens so fast you can't even see the enemy appearing in game.

If that's it, you can simply fix the problem by editing the cake() function, replacing the last parameter to AddEntityCollideCallback() from 1 (collision detected on enter) to -1 (collision detected on exit):

AddEntityCollideCallback
("suitor", "ScriptArea_1", "cake1", false, -1);


BTW, to avoid errors of this kind, which arise when code is based on "magic numbers", it's a good idea to use named constants - you don't have to worry about actual values all the time, and it improves code readability.

Something like this:
PHP Code: (Select All)
// First you consult the wiki once, to see what the values mean,
// and then you declare them as named constants (use descriptive names).
// Note: constants are oftern written in all caps, to easily distingusih them,
// but it's not required.
const int COLLIDE_ON_ENTER 1;
const 
int COLLIDE_ON_LEAVE = -1;
const 
int COLLIDE_ON_BOTH 0;

void OnStart()
{
    
AddDebugMessage("In OnStart()."false);   // The message will be displayed in the lower left corner
   
    
AddPropForce ("rope_beam02_Body_1"50000"world");  
    
PlayMusic("12_amb.ogg"true0.811true);   
    
AddEntityCollideCallback("Player""area""cake"false0);
}

void cake(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("suitor"true);   
    
AddEnemyPatrolNode("suitor""PathNode1"0"");   
    
AddEnemyPatrolNode("suitor""PathNode2"0""); 
    
    
// ----- HERE: ----- 
    
AddEntityCollideCallback("suitor""ScriptArea_1""cake1"falseCOLLIDE_ON_LEAVE);
}

void cake1(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("suitor"false);


P.S. In code editors you can usually make use of the auto-completion feature. In Notepad++, you can start to type the name of the constant, or function you've allready defined/used elsewhere (like: COLL), and then press Ctrl+Enter (on Windows) to get auto-completion suggestions (which will be, in this case, the three constants declared at the top).
(This post was last modified: 01-07-2013, 09:55 PM by TheGreatCthulhu.)
01-07-2013, 09:43 PM
Find
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#15
RE: Script/area problem.

EDIT: Didn't see your last post, I'll get to it soon.

@OP: If I'm right about what you're trying to do, then it doesn't really matter that the 4th parameter (abDeleteOnCollide) is false, since the monster just disappears one the false-alarm scare is over, but, if you're not going to re-activate the monster later, I'd listen to advice from beecake anyway - setting that parameter to true will enable the game to release any internal resources that are not needed (it probably won't terribly matter, but it's a good practice).

And if the monster needs to be reactivated and deactivated again later on, once the player colides with "area", cake() will be called again, so a new "suitor"-"ScriptArea_1" collision callback will be added anyway.
In fact, if this callback needs to stay in effect the entire gameplay time, you can leave the abDeleteOnCollide parameter false, and move the AddEntityCollideCallback() function call from cake() to OnStart(). It's enough for it to execute just once, from there.

But, dint's you say that the monster won't even appear/load?

Anyway, if it's not what I thought it was, I can only take wild guesses...
Really weird.

Oh, I don't know... Are you sure you used PathNodes (show up as little flags), and not PosNodes (show up like little circular gizmos)? EDIT: Scratch that, just seen your screenshot again - it's path nodes.
Are all the names correct?
(This post was last modified: 01-07-2013, 10:40 PM by TheGreatCthulhu.)
01-07-2013, 10:19 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#16
RE: Script/area problem.

I think that if the monster appears but doesn't walk it must be a NODES file problem. Could you please open with notepad++ the NODES file in the CS folder?

They usually look like this:

<AINodes>    <Node Name="PathNodeArea_1" ID="123">        <Edge Node="PathNodeArea_6" Distance="1.00000000000000000000" />        <Edge Node="PathNodeArea_7" Distance="2.50000000000000000000" />        <Edge Node="PathNodeArea_2" Distance="3.50891709327697750000" />        <Edge Node="PathNodeArea_5" Distance="4.25000000000000000000" />    </Node>    <Node Name="PathNodeArea_2" ID="124">        <Edge Node="PathNodeArea_5" Distance="0.79056942462921143000" />        <Edge Node="PathNodeArea_6" Distance="2.51246881484985350000" />        <Edge Node="PathNodeArea_4" Distance="2.85043859481811520000" />        <Edge Node="PathNodeArea_3" Distance="3.25960111618041990000" />        <Edge Node="PathNodeArea_1" Distance="3.50891709327697750000" />    </Node>    <Node Name="PathNodeArea_3" ID="125">        <Edge Node="PathNodeArea_5" Distance="3.16227769851684570000" />        <Edge Node="PathNodeArea_2" Distance="3.25960111618041990000" />    </Node>    <Node Name="PathNodeArea_4" ID="126">        <Edge Node="PathNodeArea_2" Distance="2.85043859481811520000" />        <Edge Node="PathNodeArea_5" Distance="3.00000000000000000000" />    </Node>    <Node Name="PathNodeArea_5" ID="127">        <Edge Node="PathNodeArea_2" Distance="0.79056942462921143000" />        <Edge Node="PathNodeArea_4" Distance="3.00000000000000000000" />        <Edge Node="PathNodeArea_3" Distance="3.16227769851684570000" />        <Edge Node="PathNodeArea_6" Distance="3.25000000000000000000" />        <Edge Node="PathNodeArea_1" Distance="4.25000000000000000000" />    </Node>    <Node Name="PathNodeArea_6" ID="128">        <Edge Node="PathNodeArea_1" Distance="1.00000000000000000000" />        <Edge Node="PathNodeArea_2" Distance="2.51246881484985350000" />        <Edge Node="PathNodeArea_5" Distance="3.25000000000000000000" />        <Edge Node="PathNodeArea_7" Distance="3.50000000000000000000" />    </Node>    <Node Name="PathNodeArea_7" ID="129">        <Edge Node="PathNodeArea_1" Distance="2.50000000000000000000" />        <Edge Node="PathNodeArea_6" Distance="3.50000000000000000000" />    </Node></AINodes>


You may delete the nodes and replace them with new ones.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
01-08-2013, 05:56 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#17
RE: Script/area problem.

Send us a copy of the map and hps file. If you're still having this issue, at this point we'll only be able to figure it out on our side.

Tutorials: From Noob to Pro
01-09-2013, 06:30 PM
Website Find
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#18
RE: Script/area problem.

Just a question: were you using an enemy entity which came with the game, or did you make your own? Maybe there was something wrong with the entity itself?
01-10-2013, 10:44 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#19
RE: Script/area problem.

(01-11-2013, 08:41 AM)Robosprog Wrote:
(01-10-2013, 10:44 PM)TheGreatCthulhu Wrote: Just a question: were you using an enemy entity which came with the game, or did you make your own? Maybe there was something wrong with the entity itself?

One that came with the game, the suitor, but it was very strange that another monster worked but he didn't.

Perhaps he had some little changed parameters?

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
01-11-2013, 09:15 AM
Find
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#20
RE: Script/area problem.

Maybe it's just some weird bug, out of nowhere... Have you replaced it with a different monster, or have you just deleted and then recreated the entity of the same type? If former, does the bug reappear if you add the original monster back?
01-11-2013, 11:05 PM
Find




Users browsing this thread: 1 Guest(s)