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
Well, fuck me.
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#10
RE: Well, fuck me.

(01-21-2013, 03:44 AM)Your Computer Wrote: I don't see it as multiple and differing jobs, nor do i see it as any more complex than his current code. Player enters area -> activate monster in the area. Player leaves area -> probably do something different. That's his current code. Even if there is one part of his code that is unique in comparison to the other callbacks that deal with the same thing, that can still be handled within one callback (with a local map variable and a conditional statement). Wrapping the same sequence of code into a separate function i see no significant difference in logic.

No, the relevant bit of the code is: player enters area_1, things start to happen, and then if player is also inside area_2 one set of patrol nodes is added, and if not, another.

Look at his code:
PHP Code: (Select All)
// earlier (note which area): AddEntityCollideCallback("Player", "area_1", "umadbro", true, 0);


void umadbro(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("enemy_super_suitor_3"true);
    
AddEnemyPatrolNode("enemy_super_suitor_3""PathNodeArea_22"0"");
    
AddEnemyPatrolNode("enemy_super_suitor_3""PathNodeArea_23"1"");
    
    if(
GetEntitiesCollide("Player""area_2") == true)  // NOTE the area
    
{
        
AddEnemyPatrolNode("enemy_super_suitor_3""PathNodeArea_24"0"");
        
AddEnemyPatrolNode("enemy_super_suitor_3""PathNodeArea_25"0"");
    }
    else if(
GetEntitiesCollide("Player""area_2") == false)   // NOTE the area
    
{
        
AddEnemyPatrolNode("enemy_super_suitor_3""PathNodeArea_26"0"");
    }
    
    
AddEntityCollideCallback("enemy_super_suitor_3""ScriptArea_1""cake4"false1);


The problem was that GetEntitiesCollide() doesn't support "Player". What I'm saying is for him to do this:
PHP Code: (Select All)
// earlier
// AddEntityCollideCallback("Player", "area_2", "OnCollideWithArea2", false, 0);
// AddEntityCollideCallback("Player", "area_1", "umadbro", true, 0);

bool isPlayerInArea2 false;
void OnCollideWithArea2(string &in asParentstring &in asChildint alState)
{
    
isPlayerInArea2 = (alState == 1);  // will be true if they intersect, false if not


void umadbro(string &in asParentstring &in asChildint alState)
{
    
// do umadbro() stuff as before

    
if(isPlayerInArea2)   // <-----  use this instead
    
{
        
AddEnemyPatrolNode("enemy_super_suitor_3""PathNodeArea_24"0"");
        
AddEnemyPatrolNode("enemy_super_suitor_3""PathNodeArea_25"0"");
    }
    else
    {
        
AddEnemyPatrolNode("enemy_super_suitor_3""PathNodeArea_26"0"");
    }
    
    
// rest of the code omitted...


That's all. Now, sure, he could throw the code from OnCollideWithArea2() inside his umadbro() - I'm saying he shouldn't.
(This post was last modified: 01-21-2013, 05:04 AM by TheGreatCthulhu.)
01-21-2013, 05:01 AM
Find


Messages In This Thread



Users browsing this thread: 1 Guest(s)