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 help (complex script) SOLVED
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#1
Script help (complex script) SOLVED

int glNumOfAreas = 6;

string[] gvEnemies = { "brute", "grunt" }

//---------------------------------------------------------------------

// This chooses what enemy to pick
string ChoseEnemy()
{
    int lIndex = RandInt(0, 1);
    
    return gvEnemies[lIndex];
}

// This inits an enemy
void InitEnemies()
{
    // General setup
    SetEntityActive("servant_ChoseEnemy()_*, false);
    SetEnemyDisabled("servant_ChoseEnemy()_*, false);
    ClearEnemyPatrolNodes("servant_ChoseEnemy()_*);
    
    ////////////////
    // Different pathnodes
    // 1
    if(RandInt(0,1)==1)    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_8", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_80", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_83", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_78", RandFloat(1,3), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_41", RandFloat(1,2), "");
    else            AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_3", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_1", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_4", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_5", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_8", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_14", RandFloat(1,1), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_17", RandFloat(1,1), "");
    
    //////////////////////////
    // 2
    if(RandInt(0,1)==1)    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_78", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_83", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_83", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_8", RandFloat(1,3), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_14", RandFloat(1,2), "");
    else            AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_85", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_88", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_56", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_57", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_55", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_59", RandFloat(1,1), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_64", RandFloat(1,1), "");
    
    //////////////////////////
    // 3
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_59", RandFloat(1,3), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_55", RandFloat(1,3), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_57", RandFloat(1,2), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_88", RandFloat(1,1), "");
    
    //////////////////////////
    // 4
    if(RandInt(0,1)==1)    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_71", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_74", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_30", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_34", RandFloat(1,3), "");
    else            AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_65", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_64", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_59", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_55", RandFloat(1,3), "");
                    
    //////////////////////////
    // 5
    if(RandInt(0,1)==1)    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_17", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_14", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_8", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_5", RandFloat(1,3), "");
    else            AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_24", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_27", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_30", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_74", RandFloat(1,3), "");
                    
    //////////////////////////
    // 6
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_43", RandFloat(1,2), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_41", RandFloat(1,3), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_78", RandFloat(1,2), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_83", RandFloat(1,1), "");
}

// Helper to reset all enemy event related stuff
void ResetEnemyEvent()
{
    SetLocalVarInt("EnemyEventActive", 0); //Clear that any enemy event is in progress!
    
    RemoveTimer("EnemyEventStart"); //In case the timer has ended yet.
}

//---------------------------------------------------------------------

void EnemyDisabled(string &in asEnemy, string &in asType)
{
    ResetEnemyEvent();
    
    AddDebugMessage("Disabled Enemy: "+ asEnemy, false);
}

//---------------------------------------------------------------------

void CollideEnemyEvent(string &in asParent, string &in asChild, int alState)
{
    /////////////////////////
    //Check if OK to start event
    
    //There can only be one enemy event triggered at any time!
    if(GetLocalVarInt("EnemyEventActive")==1) return;
    SetLocalVarInt("EnemyEventActive",1);
    
    //Get index of area (and the enemy)
    int lIdx = GetLocalVarInt(asChild+"_Idx");
    SetLocalVarInt("EnemyEvent_Idx",lIdx);
    
    /////////////////////////
    //Start up event
    
    //Area only triggered once!
    SetEntityActive(asChild, false);
        
    //Use timer so it enconter feels more random
    AddTimer("EnemyEventStart", RandFloat(0.5, 3.5), "TimerEnemyEventStart");
    
    //Setup checkpoint
    string sCheckPointStartPos = "PlayerStartArea_"+RandInt(2,4);
    
    CheckPoint("checkpoint", sCheckPointStartPos, "CheckPointEnemy", "Hints", "Regular");
}

//Used a delay start of enemy to make it feel more random.
void TimerBruteEventStart(string &in asTimer)
{
    int lIdx = GetLocalVarInt("EnemyEvent_Idx");
    
    SetEntityActive("servant_ChoseEnemy()_"+lIdx, true);
    
    AddDebugMessage("Started enemy event: "+ "servant_ChoseEnemy()_"+lIdx, false);
}

//---------------------------------------------------------------------

void CheckPointEnemy(string &in asName, int alCount)
{
    ResetEnemyEvent();
    
    InitEnemies(); //Reset all enemy paths
        
    //Enable a random area
    int lIdx = RandInt(1, glNumOfAreas);
    SetEntityActive("Area_Event_"+lIdx, true);
    
    AddDebugMessage("Checkpoint activated Random Area: "+lIdx, false);
}

////////////////////////////
// Run first time starting map
void OnStart()
{
    SetMapDisplayNameEntry("SewerSouth");
    
    //Enemies
    for(int i=1; i<=glNumOfAreas; ++i)
    {
        AddEntityCollideCallback("Player", "Area_Event_"+i, "CollideEnemyEvent", false, 1);
        SetLocalVarInt("Area_Event_"+i+"_Idx", i);
        
    }
}

Appearntly theres a unexpected end of file or so, and I am really bad at locating those. Would you guys help me a little?
(This post was last modified: 02-19-2014, 03:34 PM by Neelke.)
02-19-2014, 10:24 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Script help (complex script)

I think you forgot some brackets at the InitEnemies function at the If-Else statements. Notepad++ is not helping here.

"Veni, vidi, vici."
"I came, I saw, I conquered."
02-19-2014, 12:41 PM
Find
Traggey Offline
is mildly amused

Posts: 3,257
Threads: 74
Joined: Feb 2012
Reputation: 185
#3
RE: Script help (complex script)

Wrong forum, moved to development support.
02-19-2014, 12:42 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: Script help (complex script)

Yes, as JustAnotherPlayer said, the curly braces are missing in your if-statements. There might be something else wrong here but I do not want to dedicate time to analyse the script if this is the only problem. Fix it, then if it's still not working I can take a closer look.

If-statements do not need the curly braces if you only have 1 function following it, but as soon as you have multiple, you'll need to add the block to surround those. You might already know this but forgot.

Example:
if(a == b) RunScript();
if(a == b) {
    RunScript();
    RunAnotherScript();
}

02-19-2014, 01:08 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#5
RE: Script help (complex script)

Also check this

PHP Code: (Select All)
SetEntityActive("servant_ChoseEnemy()_*, false); 

Try with this instead:
PHP Code: (Select All)
SetEntityActive("servant_" ChoseEnemy(), false); 

02-19-2014, 03:18 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#6
RE: Script help (complex script)

Alright, I fixed it. Turned it to be a quite small detail.

int glNumOfAreas = 6;

string[] gvEnemies = { "brute", "grunt" };

//---------------------------------------------------------------------

// This chooses what enemy to pick
string ChoseEnemy()
{
    int lIndex = RandInt(0, 1);
    
    return gvEnemies[lIndex];
};

// This inits an enemy
void InitEnemies()
{
    // General setup
    SetEntityActive("servant_ChoseEnemy()_*", false);
    SetEnemyDisabled("servant_ChoseEnemy()_*", false);
    ClearEnemyPatrolNodes("servant_ChoseEnemy()_*");
    
    ////////////////
    // Different pathnodes
    // 1
    if(RandInt(0,1)==1){    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_8", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_80", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_83", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_78", RandFloat(1,3), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_41", RandFloat(1,2), "");
    }else{            AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_3", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_1", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_4", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_5", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_8", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_14", RandFloat(1,1), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_17", RandFloat(1,1), "");
    }
    
    //////////////////////////
    // 2
    if(RandInt(0,1)==1){    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_78", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_83", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_83", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_8", RandFloat(1,3), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_14", RandFloat(1,2), "");
    }else{            AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_85", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_88", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_56", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_57", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_55", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_59", RandFloat(1,1), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_64", RandFloat(1,1), "");
    }
    
    //////////////////////////
    // 3
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_59", RandFloat(1,3), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_55", RandFloat(1,3), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_57", RandFloat(1,2), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_88", RandFloat(1,1), "");
    
    //////////////////////////
    // 4
    if(RandInt(0,1)==1){    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_71", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_74", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_30", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_34", RandFloat(1,3), "");
    }else{            AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_65", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_64", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_59", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_55", RandFloat(1,3), "");
    }
                    
    //////////////////////////
    // 5
    if(RandInt(0,1)==1){    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_17", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_14", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_8", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_5", RandFloat(1,3), "");
    }else{            AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_24", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_27", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_30", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_74", RandFloat(1,3), "");
    }
                    
    //////////////////////////
    // 6
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_43", RandFloat(1,2), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_41", RandFloat(1,3), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_78", RandFloat(1,2), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_83", RandFloat(1,1), "");
}

Added a few missing ; { and }. Dont know why a few of these were necessary.
(This post was last modified: 02-19-2014, 03:33 PM by Neelke.)
02-19-2014, 03:33 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#7
RE: Script help (complex script) SOLVED

Well, it is part of the syntax. I would've expected someone using complex code like this to know the syntax. Did you not write this code yourself perhaps?

02-19-2014, 03:59 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#8
RE: Script help (complex script) SOLVED

I knew why these ; were necessary. I don't undestand why the { } were needed.

// 1
    if(RandInt(0,1)==1){    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_8", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_80", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_83", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_78", RandFloat(1,3), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_41", RandFloat(1,2), "");
    }else{            AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_3", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_1", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_4", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_5", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_8", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_14", RandFloat(1,1), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_1", "PathNodeArea_17", RandFloat(1,1), "");
    }
    
    //////////////////////////
    // 2
    if(RandInt(0,1)==1){    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_78", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_83", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_83", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_8", RandFloat(1,3), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_14", RandFloat(1,2), "");
    }else{            AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_85", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_88", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_56", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_57", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_55", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_59", RandFloat(1,1), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_2", "PathNodeArea_64", RandFloat(1,1), "");
    }
    
    //////////////////////////
    // 3
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_59", RandFloat(1,3), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_55", RandFloat(1,3), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_57", RandFloat(1,2), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_3", "PathNodeArea_88", RandFloat(1,1), "");
    
    //////////////////////////
    // 4
    if(RandInt(0,1)==1){    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_71", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_74", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_30", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_34", RandFloat(1,3), "");
    }else{            AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_65", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_64", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_59", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_4", "PathNodeArea_55", RandFloat(1,3), "");
    }
                    
    //////////////////////////
    // 5
    if(RandInt(0,1)==1){    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_17", RandFloat(1,7), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_14", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_8", RandFloat(1,5), "");
                        AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_5", RandFloat(1,3), "");
    }else{            AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_24", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_27", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_30", RandFloat(1,3), "");
                    AddEnemyPatrolNode("servant_ChoseEnemy()_5", "PathNodeArea_74", RandFloat(1,3), "");
    }
                    
    //////////////////////////
    // 6
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_43", RandFloat(1,2), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_41", RandFloat(1,3), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_78", RandFloat(1,2), "");
    AddEnemyPatrolNode("servant_ChoseEnemy()_6", "PathNodeArea_83", RandFloat(1,1), "");

I expected it to be fine without those here. And I wrote most of this, but I used other hps files as guides.
(This post was last modified: 02-19-2014, 04:48 PM by Neelke.)
02-19-2014, 04:47 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#9
RE: Script help (complex script) SOLVED

Ah, well as I explained in my example before, the if-statement only executes the first thing coming after it. If the first thing is a block however, it will run everything within that block. Without the block, the script will only test the first line with the if-statement, but accept all the others regardless.

02-19-2014, 06:16 PM
Find




Users browsing this thread: 1 Guest(s)