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.
TheGreatCthulhu Offline
Member

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

Are you sure there isn't a bug in the script itself? The fact that AddPropForce() works only means that OnStart() get's called, it doesn't tell you anything about the other functions. There could be other subtle errors.

For example, here:
PHP Code: (Select All)
AddEntityCollideCallback("Player""area""cake"false0); 

Are you sure that the first script area is named "area" in the editor?

You can use AddDebugMessage() to check which functions get called when. If a callback should be called but isn't, then it means that it wasn't hooked up correctly. Something along these lines:

PHP Code: (Select All)
// Debugging using AddDebugMessage()

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)
{
    
AddDebugMessage("In cake()."false);

    
SetEntityActive("suitor"true);   
    
AddEnemyPatrolNode("suitor""PathNode1"0"");   
    
AddEnemyPatrolNode("suitor""PathNode2"0""); 
    
AddEntityCollideCallback("suitor""ScriptArea_1""cake1"false1);
}

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

(This post was last modified: 01-07-2013, 02:30 PM by TheGreatCthulhu.)
01-07-2013, 02:28 PM
Find
The chaser Offline
Posting Freak

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

Delete map_cache if there is.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
01-07-2013, 02:38 PM
Find
TheGreatCthulhu Offline
Member

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

(01-07-2013, 02:46 PM)Robosprog Wrote: I did not notice a debug message at any rate, when running through the area, so that means that it is being called, yes?

For a function, if the corresponding message was shown (each should be different, so that you can tell which one is it), then yes.

(01-07-2013, 02:46 PM)Robosprog Wrote: Done that, noticed it after second test but it still doesn't work.

Hm... If all checks out, then I'm not sure what's going on. Gotta go now, but I'm going to try and test the code later on, if the issue isn't resolved. For now, when you say it doesn't work, you mean that everything compiles, no errors are shown, but enemy doesn't patrol the area? What exactly happens, and what did you expect to happen?

Also, do you happen to use CreateEntityAtArea() anywhere in the script file (in parts not shown here, if any)? It says in the wiki:
Quote:When creating an enemy [using this function], it cannot chase properly along PathNodes(using for example ShowEnemyPlayerPosition).
(This post was last modified: 01-07-2013, 02:59 PM by TheGreatCthulhu.)
01-07-2013, 02:57 PM
Find
FlawlessHappiness Offline
Posting Freak

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

Have you been to the properties of the area and unchecked "AutoRemoveAtLookAt" or something like that?

Trying is the first step to success.
01-07-2013, 04:06 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#5
RE: Script/area problem.

Does the enemy appear, and not walk along the path, or does the enemy just not appear at all?
01-07-2013, 04:08 PM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#6
RE: Script/area problem.

Try
PHP Code: (Select All)
AddEntityCollideCallback("Player""area""cake"true1); 

In Ruins [WIP]
01-07-2013, 04:08 PM
Find
FlawlessHappiness Offline
Posting Freak

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

(01-07-2013, 04:08 PM)NaxEla Wrote: Try
PHP Code: (Select All)
AddEntityCollideCallback("Player""area""cake"true1); 

That shouldn't change anything.
What you change there is that the scripts isn't able to call again, and only calls when the player enters the area.
Though it's a little strange to have it set to "...false, 0);"

Trying is the first step to success.
01-07-2013, 05:03 PM
Find
TheGreatCthulhu Offline
Member

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

Another guess at what could be happening - if you add code to the script file and just hit "Quick Reload", only OnEnter() is called, if it exists, and OnStart() is not. OnStart() is only called when the player enters the map for the first time, or during development, only on full reload.

If the handler assignment code was added to preexisting code after you started the map (which would explain why rope swinging works), but you've only used quick reload, the updated OnStart() function is never called, so the cake() callback is never hooked up.


Edit: Apparently, that's not the case. Both OnStart() and OnEnter() get called on quick reload... God dammit. XD

P.S.
(01-07-2013, 05:03 PM)beecake Wrote: Though it's a little strange to have it set to "...false, 0);"
Nah. It may not be used so often, but it isn't strange if the collision needs to be detected only once.
(This post was last modified: 01-07-2013, 07:31 PM by TheGreatCthulhu.)
01-07-2013, 06:35 PM
Find
FlawlessHappiness Offline
Posting Freak

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

(01-07-2013, 06:35 PM)TheGreatCthulhu Wrote:
(01-07-2013, 05:03 PM)beecake Wrote: Though it's a little strange to have it set to "...false, 0);"
Nah. It may not be used so often, but it isn't strange if the collision needs to be detected only once.

But if the detection should be only once then it should be true, and not false.

If it's false the monster will keep being set active, and be assigned patrol nodes everytime the function calls, and that's at least 2 times since the next value is 0

Trying is the first step to success.
(This post was last modified: 01-07-2013, 07:10 PM by FlawlessHappiness.)
01-07-2013, 07:10 PM
Find
TheGreatCthulhu Offline
Member

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

Oh, sry - you are correct; I completely misread that code snippet. Didn't even notice the value of the last param.
(This post was last modified: 01-07-2013, 07:17 PM by TheGreatCthulhu.)
01-07-2013, 07:16 PM
Find




Users browsing this thread: 1 Guest(s)