PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Gothic 2 Respawn script - game crashes



Abuyin Sharidi
05.04.2014, 10:16
Hello again! :)

Last time I did a respawn script that should spawn a monster, while no one is on a WP.
The scripts seems to be ok, without any errors, but if I spawn too much monsters, the game crashes. When I use a standard Wld_InsertNpc() Gothic does not crash, even if I spawn monsters on the whole map.


func void B_Wld_InsertNpc (var C_NPC NPC, var string WP){ SpawnRate = Hlp_Random(MaxPercent);




if ((NPC.guild > GIL_SEPERATOR_HUM && NPC.guild < GIL_SEPERATOR_ORC) && NPC.guild != GIL_DRAGON)
{
if !(Npc_IsOnWP (NPC, WP)) && (Npc_GetDistToWp(hero, WP) < MaxRange)//(Npc_GetDistToWP (NPC, WP) > SpawnRange)
{
Wld_InsertNpc (NPC, WP);

if ((NPC.level < hero.level)
|| (NPC.guild == GIL_SCAVENGER) || (NPC.guild == GIL_WOLF) || (NPC.guild == GIL_BLOODFLY)
|| (NPC.guild == GIL_GIANT_RAT) || (NPC.guild == GIL_MOLERAT))
{
if (SpawnRate < BonusSpawn)
{
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
}
else if (SpawnRate > HerdSpawn_02 && SpawnRate < HerdSpawn_01)
{
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);

if (Hlp_GetInstanceID(NPC) == Hlp_GetInstanceID(Wolf)
&& (Hlp_StrCmp(NPC.name, /*Black*/ Wolf.name) && SpawnRate > BlackChances))// && (hero.guild == GIL_NOV || hero.guild == GIL_KDF)
{
Wld_InsertNpc (BlackWolf, WP);

};
NPC.level = NPC.level + HerdBonusExp;
NPC.name = ConcatStrings (NPC.name, HerdMember);

};
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
};
};
}
else
{
if !(Npc_IsOnWP (NPC, WP))//(Npc_GetDistToWP (NPC, WP) > SpawnRange)
{
Wld_InsertNpc (NPC, WP);
};
};
};

and here are all used constants and variables
const int SpawnRange = 500;
const int MaxRange = 200000;
const int HerdSpawn_01 = 95;
const int HerdSpawn_02 = 84;
const int BonusSpawn = 35;
const int BlackChances = 50;
const int MaxPercent = 100;
const int HerdBonusExp = 10;
var int SpawnRate;

BTW! I did make a NpcGetDistToWP from hero to monster NPC, because I thought it would be better, but then I realized that it would be bad idea, because if I'll sleep in Khorinis and I'll teleport to Big Farm, monsters won't spawn at this place, because of the range (the range variable is MaxRange) and I want it to spawn monsters on the whole map while they are not on their WPs. I just want to make this script work, does not matter if there will be lag or not.
I was thinking how to make this script work like for 2 months (not non-stop, obviously), but without any results, so I chose to ask better modders than me. :)

Milky-Way
05.04.2014, 10:39
Could you please briefly explain what the code is supposed to do and how you call the function?

When showing code, please try to do it like this:

here your code
(you also get that by clicking on the # symbol in the editor)
Using spoilers, indentation is lost and it doesn't show as nicely. Here is what your code would look like:

func void B_Wld_InsertNpc (var C_NPC NPC, var string WP){
SpawnRate = Hlp_Random(MaxPercent);


if ((NPC.guild > GIL_SEPERATOR_HUM && NPC.guild < GIL_SEPERATOR_ORC) && NPC.guild != GIL_DRAGON)
{
if !(Npc_IsOnWP (NPC, WP)) && (Npc_GetDistToWp(hero, WP) < MaxRange)//(Npc_GetDistToWP (NPC, WP) > SpawnRange)
{
Wld_InsertNpc (NPC, WP);

if ((NPC.level < hero.level)
|| (NPC.guild == GIL_SCAVENGER) || (NPC.guild == GIL_WOLF) || (NPC.guild == GIL_BLOODFLY)
|| (NPC.guild == GIL_GIANT_RAT) || (NPC.guild == GIL_MOLERAT))
{
if (SpawnRate < BonusSpawn)
{
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
}
else if (SpawnRate > HerdSpawn_02 && SpawnRate < HerdSpawn_01)
{
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);

if (Hlp_GetInstanceID(NPC) == Hlp_GetInstanceID(Wolf)
&& (Hlp_StrCmp(NPC.name, /*Black*/ Wolf.name) && SpawnRate > BlackChances))// && (hero.guild == GIL_NOV || hero.guild == GIL_KDF)
{
Wld_InsertNpc (BlackWolf, WP);

};
NPC.level = NPC.level + HerdBonusExp;
NPC.name = ConcatStrings (NPC.name, HerdMember);

};
Wld_InsertNpc (NPC, WP);
Wld_InsertNpc (NPC, WP);
};
};
}
else
{
if !(Npc_IsOnWP (NPC, WP))//(Npc_GetDistToWP (NPC, WP) > SpawnRange)
{
Wld_InsertNpc (NPC, WP);
};
};
};

Abuyin Sharidi
05.04.2014, 11:32
Ok, I did change the spoiler to a code.

The function should work as Wld_InsertNpc (NPC, WP);, but with some "bonuses".

I call the function like this in SleepABit.d:
B_Wld_InsertNpc (Wolf, "BIGFARM"); etc. (this one is just an example).

The whole respawn script I use is much bigger, also it spawns almost every monster from startup.d (only for NewWorld.ZEN at the moment).

I'll post this script, it's about 300 lines.


func void Respawn_Bed (){
B_Wld_InsertNpc (Waran , "FP_ROAM_INSEL_01");//
B_Wld_InsertNpc (Waran , "FP_ROAM_INSEL_03");//
B_Wld_InsertNpc (Waran , "FP_ROAM_INSEL_05");//
B_Wld_InsertNpc (Waran , "FP_ROAM_INSEL_07");//
B_Wld_InsertNpc (Waran , "FP_ROAM_INSEL_09");//
B_Wld_InsertNpc (Waran , "FP_ROAM_INSEL_11");//
B_Wld_InsertNpc (Waran , "FP_ROAM_INSEL_13");//
B_Wld_InsertNpc (YBloodfly, "NW_FARM1_PATH_SPAWN_02");
B_Wld_InsertNpc (YWolf, "NW_FARM1_PATH_SPAWN_07");
B_Wld_InsertNpc (YGobbo_Green,"NW_FARM1_PATH_CITY_19_B");
B_Wld_InsertNpc (YBloodfly, "NW_FARM1_PATH_CITY_10_B");
B_Wld_InsertNpc (YWolf, "NW_FARM1_PATH_CITY_05_B");
B_Wld_InsertNpc (YGiant_Bug, "NW_FARM1_CITYWALL_RIGHT_02");
B_Wld_InsertNpc (YGiant_Bug, "NW_FARM1_OUT_13");
B_Wld_InsertNpc (Bloodfly, "NW_FARM1_CITYWALL_02_B");
B_Wld_InsertNpc (Snapper, "NW_FARM1_CITYWALL_05");
B_Wld_InsertNpc (Wolf, "NW_FARM1_CITYWALL_FOREST_03");
B_Wld_InsertNpc (Shadowbeast, "NW_FARM1_CITYWALL_FOREST_04_B");
B_Wld_InsertNpc (Bloodfly, "NW_FARM1_CITYWALL_FOREST_06");
B_Wld_InsertNpc (Gobbo_Black, "NW_FARM1_CITYWALL_FOREST_14");
B_Wld_InsertNpc (Gobbo_Black, "NW_FARM1_CITYWALL_FOREST_15");
B_Wld_InsertNpc (Gobbo_Black, "NW_FARM1_CITYWALL_FOREST_16");
B_Wld_InsertNpc (StonePuma, "NW_BIGFARM_FARM4_FOREST_01");
B_Wld_InsertNpc (Alligator, "NW_LAKE_GREG_TREASURE_01");
B_Wld_InsertNpc (Alligator, "NW_LAKE__WATER_02");
B_Wld_InsertNpc (Alligator, "NW_LAKE__WATER_04");
B_Wld_InsertNpc (Alligator, "NW_LAKE__WATER_06");
B_Wld_InsertNpc (YWolf, "NW_XARDAS_PATH_FARM1_11");
B_Wld_InsertNpc (YGobbo_Green, "NW_XARDAS_GOBBO_01");
B_Wld_InsertNpc (YWolf, "NW_XARDAS_MONSTER_INSERT_01");
B_Wld_InsertNpc (Keiler, "FP_ROAM_XARDAS_SECRET_23");
B_Wld_InsertNpc (Waran, "FP_ROAM_XARDAS_SECRET_08");
B_Wld_InsertNpc (Waran, "FP_ROAM_XARDAS_SECRET_15");
B_Wld_InsertNpc (Waran, "FP_ROAM_XARDAS_SECRET_04");
B_Wld_InsertNpc (Giant_Rat, "FP_ROAM_XARDAS_SECRET_27");
B_Wld_InsertNpc (YGobbo_Green, "NW_XARDAS_TOWER_WATERFALL_CAVE_03");
B_Wld_InsertNpc (YGobbo_Green, "NW_XARDAS_TOWER_WATERFALL_CAVE_ENTRANCE_05");
B_Wld_InsertNpc (YGobbo_Green, "NW_XARDAS_TOWER_WATERFALL_CAVE_ENTRANCE_GOBBO");
B_Wld_InsertNpc (YGiant_Bug, "NW_XARDAS_TOWER_WATERFALL_CAVE_SIDE_02");
B_Wld_InsertNpc (YWolf, "NW_XARDAS_VALLEY_03");
B_Wld_InsertNpc (YWolf, "NW_XARDAS_VALLEY_04");
B_Wld_InsertNpc (YWolf, "NW_XARDAS_VALLEY_06");
B_Wld_InsertNpc (YGiant_Rat, "NW_XARDAS_TOWER_VALLEY_RAT");
B_Wld_InsertNpc (YWolf, "NW_XARDAS_TOWER_VALLEY_WOLF");
B_Wld_InsertNpc (YBloodfly, "NW_XARDAS_TOWER_VALLEY_08");
B_Wld_InsertNpc (YGiant_Rat, "NW_XARDAS_TOWER_SECRET_CAVE_01");
B_Wld_InsertNpc (YGiant_Rat, "NW_XARDAS_TOWER_SECRET_CAVE_01");
B_Wld_InsertNpc (YGiant_Rat, "NW_XARDAS_TOWER_SECRET_CAVE_01");
B_Wld_InsertNpc (YGiant_Rat, "NW_XARDAS_TOWER_SECRET_CAVE_03");
B_Wld_InsertNpc (Scavenger, "NW_PATH_TO_MONASTER_AREA_11");
B_Wld_InsertNpc (Scavenger, "NW_PATH_TO_MONASTER_AREA_11");
B_Wld_InsertNpc (Scavenger, "NW_PATH_TO_MONASTER_MONSTER22");
B_Wld_InsertNpc (Scavenger, "NW_PATH_TO_MONASTER_AREA_01");
B_Wld_InsertNpc (Giant_Rat, "NW_PATH_TO_MONASTER_AREA_02");
B_Wld_InsertNpc (Giant_Rat, "NW_PATH_TO_MONASTER_AREA_10");
B_Wld_InsertNpc (Giant_Rat, "NW_PATH_TO_MONASTER_AREA_10");
B_Wld_InsertNpc (Giant_Bug, "NW_PATH_TO_MONASTER_AREA_08");
B_Wld_InsertNpc (Giant_Rat, "NW_SHRINE_MONSTER");
B_Wld_InsertNpc (Scavenger, "NW_FOREST_CONNECT_MONSTER2");
B_Wld_InsertNpc (Giant_Bug, "NW_BIGFARM_FELDREUBER");
B_Wld_InsertNpc (Giant_Bug, "NW_BIGFARM_FELDREUBER2");
B_Wld_InsertNpc (Giant_Bug, "NW_BIGFARM_FELDREUBER4");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_MONSTERMILL_11");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_MONSTERMILL_13");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_MONSTERMILL_04");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_MONSTERMILL_03");
B_Wld_InsertNpc (Lurker, "NW_BIGMILL_FIELD_MONSTER_03");
B_Wld_InsertNpc (Giant_Bug, "NW_BIGMILL_FIELD_MONSTER_02");
B_Wld_InsertNpc (Giant_Bug, "NW_BIGFARM_FIELD_MONSTER_01");
B_Wld_InsertNpc (Scavenger, "NW_TAVERNE_TROLLAREA_MONSTER_01_01");
B_Wld_InsertNpc (Wolf, "NW_TAVERNE_TROLLAREA_MONSTER_04_01");
B_Wld_InsertNpc (Gobbo_Green, "NW_TAVERNE_TROLLAREA_MONSTER_05_01");
B_Wld_InsertNpc (Wolf, "NW_BIGFARM_LAKE_MONSTER_01_01");
B_Wld_InsertNpc (Lurker, "NW_BIGFARM_LAKE_MONSTER_02_01");
B_Wld_InsertNpc (Bloodfly, "NW_BIGFARM_LAKE_MONSTER_02_01");
B_Wld_InsertNpc (Wolf, "NW_BIGFARM_LAKE_MONSTER_03_01");
B_Wld_InsertNpc (Lurker, "NW_LAKE_GREG_TREASURE_01");
B_Wld_InsertNpc (Warg, "NW_FARM4_WOOD_MONSTER_01");
B_Wld_InsertNpc (Bloodfly, "NW_FARM4_WOOD_MONSTER_02");
B_Wld_InsertNpc (Bloodfly, "NW_FARM4_WOOD_MONSTER_02");
B_Wld_InsertNpc (Wolf, "NW_FARM4_WOOD_MONSTER_03");
B_Wld_InsertNpc (Wolf, "NW_FARM4_WOOD_MONSTER_05");
B_Wld_InsertNpc (Bloodfly, "NW_FARM4_WOOD_MONSTER_06");
B_Wld_InsertNpc (Bloodfly, "NW_FARM4_WOOD_MONSTER_07");
B_Wld_InsertNpc (Shadowbeast, "NW_FARM4_WOOD_MONSTER_08");
B_Wld_InsertNpc (Bloodfly, "NW_FARM4_WOOD_MONSTER_10");
B_Wld_InsertNpc (Minecrawler, "NW_CASTLEMINE_13");
B_Wld_InsertNpc (MinecrawlerWarrior, "NW_CASTLEMINE_10");
B_Wld_InsertNpc (MinecrawlerWarrior, "NW_CASTLEMINE_06");
B_Wld_InsertNpc (Gobbo_Black, "FP_ROAM_NW_BIGFARMFORESTCAVE_01");
B_Wld_InsertNpc (Gobbo_Warrior, "FP_ROAM_NW_BIGFARMFORESTCAVE_02");
B_Wld_InsertNpc (Gobbo_Black, "FP_ROAM_NW_BIGFARMFORESTCAVE_03");
B_Wld_InsertNpc (Gobbo_Black, "FP_ROAM_NW_BIGFARMFORESTCAVE_04");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_BIGFARM_LAKE_CAVE_02");
B_Wld_InsertNpc (Gobbo_Black, "FP_ROAM_BIGFARM_LAKE_CAVE_07");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_BIGFARM_LAKE_CAVE_08");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_BIGFARM_LAKE_CAVE_10");
B_Wld_InsertNpc (Gobbo_Black, "FP_ROAM_BIGFARM_LAKE_CAVE_11");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_BIGFARM_LAKE_CAVE_13");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_NW_BIGFARMFORESTCAVE_05");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_NW_BIGFARMFORESTCAVE_07");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_NW_BIGFARMFORESTCAVE_08");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_NW_BIGFARMFORESTCAVE_10");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_BIGFARM_LAKE_CAVE_01");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_BIGFARM_LAKE_CAVE_03");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_BIGFARM_LAKE_CAVE_04");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_BIGFARM_LAKE_CAVE_05");
B_Wld_InsertNpc (Gobbo_Green, "FP_ROAM_BIGFARM_LAKE_CAVE_06");
B_Wld_InsertNpc (Bloodfly, "NW_BIGFARM_LAKE_MONSTER_BLOODFLY");
B_Wld_InsertNpc (Giant_Bug, "NW_TAVERNE_TROLLAREA_MONSTER_03_01M1");
B_Wld_InsertNpc (Wolf, "NW_SAGITTA_MOREMONSTER_01");
B_Wld_InsertNpc (Giant_Bug, "NW_SAGITTA_MOREMONSTER_03");
B_Wld_InsertNpc (Bloodfly, "NW_FARM4_WOOD_NEARPEASANT7");
B_Wld_InsertNpc (Bloodfly, "NW_FARM4_WOOD_NEARPEASANT2_14");
B_Wld_InsertNpc (Bloodfly, "NW_FARM4_WOOD_NEARPEASANT2_10");
B_Wld_InsertNpc (Wolf, "NW_FARM4_WOOD_NEARPEASANT2_8");
B_Wld_InsertNpc (Scavenger, "NW_FARM4_WOOD_NEARPEASANT2_7");
B_Wld_InsertNpc (Giant_Bug, "NW_FARM4_WOOD_NEARPEASANT2_12");
B_Wld_InsertNpc (Gobbo_skeleton, "NW_FARM4_WOOD_MONSTER_MORE_02");
B_Wld_InsertNpc (Giant_Bug, "NW_FARM4_WOOD_MONSTER_MORE_01");
B_Wld_InsertNpc (Giant_Bug, "NW_FARM4_WOOD_MONSTER_N_3");
B_Wld_InsertNpc (Giant_Bug, "NW_FARM4_WOOD_MONSTER_N_2");
B_Wld_InsertNpc (Giant_Bug, "NW_BIGFARM_FOREST_02");
B_Wld_InsertNpc (Keiler, "NW_BIGFARM_FOREST_03_NAVIGATION");
B_Wld_InsertNpc (Keiler, "NW_FARM4_WOOD_NAVIGATION_09");
B_Wld_InsertNpc (Wolf, "NW_CASTLEMINE_TROLL_05");
B_Wld_InsertNpc (Giant_Bug, "NW_BIGFARM_ALLEE_08_N");
B_Wld_InsertNpc (Giant_Bug, "NW_BIGFARM_ALLEE_08_N_2");
B_Wld_InsertNpc (Scavenger, "NW_BIGMILL_05");
B_Wld_InsertNpc (Scavenger, "NW_FARM3_BIGWOOD_02");
B_Wld_InsertNpc (Keiler, "NW_FARM3_BIGWOOD_03");
B_Wld_InsertNpc (Lurker, "NW_FARM3_PATH_11_SMALLRIVER_02");
B_Wld_InsertNpc (Lurker, "NW_FARM3_PATH_11_SMALLRIVER_02");
B_Wld_InsertNpc (Lurker, "NW_FARM3_PATH_11_SMALLRIVER_04");
B_Wld_InsertNpc (Scavenger, "NW_FARM3_PATH_11_SMALLRIVER_08");
B_Wld_InsertNpc (Scavenger, "NW_FARM3_PATH_11_SMALLRIVER_10");
B_Wld_InsertNpc (Scavenger, "NW_FARM3_PATH_11_SMALLRIVER_10");
B_Wld_InsertNpc (Lurker, "NW_FARM3_PATH_11_SMALLRIVER_17");
B_Wld_InsertNpc (Lurker, "NW_FARM3_PATH_11_SMALLRIVER_17");
B_Wld_InsertNpc (Lurker, "NW_FARM3_PATH_11_SMALLRIVER_20");
B_Wld_InsertNpc (Bloodfly, "NW_FARM3_PATH_11_SMALLRIVER_24");
B_Wld_InsertNpc (Bloodfly, "NW_FARM3_PATH_11_SMALLRIVER_24");
B_Wld_InsertNpc (Lurker, "NW_FARM3_PATH_11_SMALLRIVERMID_03");
B_Wld_InsertNpc (Lurker, "NW_FARM3_PATH_11_SMALLRIVERMID_02");
B_Wld_InsertNpc (Keiler, "NW_FARM3_PATH_12_MONSTER_01");
B_Wld_InsertNpc (Keiler, "NW_FARM3_PATH_12_MONSTER_03");
B_Wld_InsertNpc (Lurker, "NW_FARM3_MOUNTAINLAKE_03");
B_Wld_InsertNpc (Lurker, "NW_FARM3_MOUNTAINLAKE_MONSTER_01");
B_Wld_InsertNpc (Keiler, "NW_BIGFARM_LAKE_03_MOVEMENT");
B_Wld_InsertNpc (Giant_Bug, "NW_BIGFARM_LAKE_03_MOVEMENT3");
B_Wld_InsertNpc (YWolf,"NW_PASS_06");
B_Wld_InsertNpc (YWolf,"NW_PASS_11");
B_Wld_InsertNpc (YWolf,"NW_PASS_SECRET_15");
B_Wld_InsertNpc (YWolf,"NW_PASS_SECRET_16");
B_Wld_InsertNpc (YWolf,"NW_PASS_SECRET_17");
B_Wld_InsertNpc (Giant_Rat,"NW_PASS_SECRET_05");
B_Wld_InsertNpc (Giant_Rat,"NW_PASS_SECRET_06");
B_Wld_InsertNpc (Giant_Rat,"NW_PASS_SECRET_07");
B_Wld_InsertNpc (Giant_Rat,"NW_PASS_SECRET_08");
B_Wld_InsertNpc (Gobbo_Green,"NW_PASS_GRAT_04");
B_Wld_InsertNpc (Gobbo_Green,"NW_PASS_GRAT_05");
B_Wld_InsertNpc (Gobbo_Green,"NW_PASS_GRAT_06");
B_Wld_InsertNpc (Giant_Rat, "FP_ROAM_MEDIUMFOREST_KAP2_12");
B_Wld_InsertNpc (Giant_Rat, "FP_ROAM_MEDIUMFOREST_KAP2_10");
B_Wld_InsertNpc (Scavenger, "FP_ROAM_MEDIUMFOREST_KAP2_28");
B_Wld_InsertNpc (Scavenger, "FP_ROAM_MEDIUMFOREST_KAP2_29");
B_Wld_InsertNpc (Scavenger, "FP_ROAM_MEDIUMFOREST_KAP2_17");
B_Wld_InsertNpc (Scavenger, "FP_ROAM_MEDIUMFOREST_KAP2_13");
B_Wld_InsertNpc (Wolf, "FP_ROAM_MEDIUMFOREST_KAP2_36");
B_Wld_InsertNpc (Wolf, "FP_ROAM_MEDIUMFOREST_KAP2_34");
B_Wld_InsertNpc (Warg, "FP_ROAM_MEDIUMFOREST_KAP3_08");
B_Wld_InsertNpc (Warg, "FP_ROAM_MEDIUMFOREST_KAP3_09");
B_Wld_InsertNpc (Warg, "FP_ROAM_MEDIUMFOREST_KAP3_11");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_MEDIUMFOREST_KAP3_15");
B_Wld_InsertNpc (Wolf, "FP_ROAM_MEDIUMFOREST_KAP3_17");
B_Wld_InsertNpc (Keiler, "FP_ROAM_MEDIUMFOREST_KAP3_21");
B_Wld_InsertNpc (Warg, "FP_ROAM_MEDIUMFOREST_KAP3_23");
B_Wld_InsertNpc (Warg, "FP_ROAM_MEDIUMFOREST_KAP3_28");
B_Wld_InsertNpc (Warg, "FP_ROAM_MEDIUMFOREST_KAP3_29");
B_Wld_InsertNpc (Shadowbeast, "FP_ROAM_MEDIUMFOREST_KAP3_20");
B_Wld_InsertNpc (Giant_Rat, "FP_ROAM_MEDIUMFOREST_KAP3_27");
B_Wld_InsertNpc (Giant_Rat, "FP_ROAM_MEDIUMFOREST_KAP3_26");
B_Wld_InsertNpc (Bloodfly, "NW_CITY_TO_LIGHTHOUSE_03");
B_Wld_InsertNpc (Waran, "FP_ROAM_SHIPWRECK_04");
B_Wld_InsertNpc (Waran, "FP_ROAM_SHIPWRECK_01");
B_Wld_InsertNpc (Wolf, "NW_CITY_TO_FOREST_05");
B_Wld_InsertNpc (Wolf, "NW_CITY_TO_FOREST_07");
B_Wld_InsertNpc (Giant_Rat, "NW_CITY_TO_FOREST_11");
B_Wld_InsertNpc (Giant_Rat, "NW_CITY_TO_FOREST_12");
B_Wld_InsertNpc (Gobbo_Green, "NW_CITY_TO_FOREST_15"); //FPs fehlen
B_Wld_InsertNpc (Wolf, "FP_ROAM_CITY_TO_FOREST_47");
B_Wld_InsertNpc (Giant_Rat, "FP_ROAM_CITY_TO_FOREST_11");
B_Wld_InsertNpc (Giant_Rat, "FP_ROAM_CITY_TO_FOREST_10");
B_Wld_InsertNpc (Giant_Rat, "FP_ROAM_CITYFOREST_KAP3_22");
B_Wld_InsertNpc (Giant_Rat, "FP_ROAM_CITYFOREST_KAP3_20");
B_Wld_InsertNpc (Giant_Rat, "FP_ROAM_CITYFOREST_KAP3_21");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_CITYFOREST_KAP3_23");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_CITYFOREST_KAP3_27");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_CITYFOREST_KAP3_28");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_CITYFOREST_KAP3_29");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_CITYFOREST_KAP3_30");
B_Wld_InsertNpc (Giant_Bug, "FP_ROAM_CITYFOREST_KAP3_38");
B_Wld_InsertNpc (Waran, "FP_ROAM_CITY_TO_FOREST_32");
B_Wld_InsertNpc (Waran, "FP_ROAM_CITY_TO_FOREST_29");
B_Wld_InsertNpc (Waran, "FP_ROAM_CITY_TO_FOREST_31");
B_Wld_InsertNpc (Molerat, "FP_ROAM_CITY_TO_FOREST_42");
B_Wld_InsertNpc (Shadowbeast, "FP_ROAM_CITYFOREST_KAP3_04");
B_Wld_InsertNpc (Gobbo_Black, "FP_ROAM_CITYFOREST_KAP3_07");
B_Wld_InsertNpc (Gobbo_Black, "FP_ROAM_CITYFOREST_KAP3_06");
B_Wld_InsertNpc (Gobbo_Black, "FP_ROAM_CITYFOREST_KAP3_08");
B_Wld_InsertNpc (Warg, "FP_ROAM_CITYFOREST_KAP3_09");
B_Wld_InsertNpc (Warg, "FP_ROAM_CITYFOREST_KAP3_10");
B_Wld_InsertNpc (Warg, "FP_ROAM_CITYFOREST_KAP3_11");
B_Wld_InsertNpc (Warg, "FP_ROAM_CITYFOREST_KAP3_12");
B_Wld_InsertNpc (Warg, "FP_ROAM_CITYFOREST_KAP3_14");
B_Wld_InsertNpc (Warg, "FP_ROAM_CITYFOREST_KAP3_15");
B_Wld_InsertNpc (Warg, "FP_ROAM_CITYFOREST_KAP3_17");
B_Wld_InsertNpc (Giant_Rat ,"NW_FOREST_VINOSKELLEREI_01");
B_Wld_InsertNpc (Giant_Rat, "NW_CITY_SMFOREST_05");
B_Wld_InsertNpc (Giant_Rat, "NW_CITY_SMFOREST_09");
B_Wld_InsertNpc (Giant_Rat, "NW_CITY_SMFOREST_03");
B_Wld_InsertNpc (Shadowbeast, "NW_FOREST_PATH_35_06");
B_Wld_InsertNpc (Wolf, "NW_CITY_TO_FOREST_04_09");
B_Wld_InsertNpc (Molerat, "NW_TAVERN_TO_FOREST_05_05");
B_Wld_InsertNpc (Molerat, "NW_TAVERN_TO_FOREST_05_06");
B_Wld_InsertNpc (Giant_Rat, "NW_CITYFOREST_CAVE_04");
B_Wld_InsertNpc (Molerat, "NW_CITYFOREST_CAVE_06");
B_Wld_InsertNpc (Shadowbeast, "NW_CITYFOREST_CAVE_A06");
B_Wld_InsertNpc (Giant_Rat, "NW_FARM1_CITYWALL_RIGHT_04");
B_Wld_InsertNpc (Scavenger, "NW_FOREST_PATH_38_MONSTER");
B_Wld_InsertNpc (Keiler, "NW_CITY_TO_LIGHTHOUSE_13_MONSTER");
B_Wld_InsertNpc (Wolf, "NW_FOREST_PATH_35_01");
B_Wld_InsertNpc (Warg, "NW_FOREST_PATH_31_MONSTER");
B_Wld_InsertNpc (Molerat, "NW_FOREST_PATH_21_MONSTER");
B_Wld_InsertNpc (Giant_Bug, "NW_FARM2_TO_TAVERN_09_MONSTER");
B_Wld_InsertNpc (Giant_Bug, "NW_FARM2_TO_TAVERN_09_MONSTER2");
B_Wld_InsertNpc (Giant_Bug, "NW_FARM2_TO_TAVERN_09_MONSTER3");
B_Wld_InsertNpc (Molerat, "NW_FARM2_TO_TAVERN_09_MONSTER4");
B_Wld_InsertNpc (Bloodfly, "NW_FARM2_TO_TAVERN_09_MONSTER5");
B_Wld_InsertNpc (Wolf, "NW_CITY_TO_FOREST_04");
B_Wld_InsertNpc (Wolf, "NW_FOREST_CAVE1_01");
B_Wld_InsertNpc (Giant_Bug, "NW_FOREST_PATH_75_2_MONSTER");
B_Wld_InsertNpc (Keiler, "NW_FOREST_PATH_79");
B_Wld_InsertNpc (Keiler, "NW_FOREST_PATH_80_1");
B_Wld_InsertNpc (Waran, "NW_FOREST_PATH_82");
B_Wld_InsertNpc (Waran, "NW_FOREST_PATH_82_M");
B_Wld_InsertNpc (Wolf, "NW_FOREST_PATH_66_M");
B_Wld_InsertNpc (Giant_Bug, "NW_FOREST_PATH_57");
B_Wld_InsertNpc (Bloodfly, "NW_FOREST_PATH_35_01_MONSTER");
B_Wld_InsertNpc (Giant_Bug, "NW_FOREST_PATH_80_1_MOVEMENT8_M");
B_Wld_InsertNpc (Giant_Bug, "NW_FOREST_PATH_80_1_MOVEMENTF");
B_Wld_InsertNpc (Giant_Bug, "NW_FOREST_PATH_31_NAVIGATION3");
B_Wld_InsertNpc (Giant_Bug, "NW_FOREST_PATH_31_NAVIGATION10");
B_Wld_InsertNpc (Giant_Rat, "NW_FOREST_PATH_31_NAVIGATION11");
B_Wld_InsertNpc (Snapper, "NW_FOREST_PATH_80_1_MOVEMENT6");
B_Wld_InsertNpc (Snapper, "NW_FOREST_PATH_80_1_MOVEMENT15");
B_Wld_InsertNpc (Snapper, "NW_FOREST_PATH_80_1_MOVEMENT8_M5");
B_Wld_InsertNpc (Warg, "NW_FOREST_PATH_31_NAVIGATION16");
B_Wld_InsertNpc (Snapper, "NW_FOREST_PATH_80_1_MOVEMENT8_M3");
B_Wld_InsertNpc (Warg, "NW_FOREST_PATH_04_16_MONSTER");
B_Wld_InsertNpc (Warg, "NW_FOREST_PATH_04_16_MONSTER2");
B_Wld_InsertNpc (Giant_Bug, "NW_FOREST_PATH_04_13");
B_Wld_InsertNpc (Giant_Bug, "NW_FOREST_PATH_04_3");
B_Wld_InsertNpc (Giant_Bug, "NW_FOREST_PATH_04_4");
B_Wld_InsertNpc (Warg, "NW_FOREST_PATH_72_MONSTER");
B_Wld_InsertNpc (Bloodfly, "NW_FOREST_PATH_62_06");
B_Wld_InsertNpc (Molerat, "NW_FOREST_PATH_56_MONSTER");
B_Wld_InsertNpc (Bloodfly, "NW_FOREST_PATH_27_03");
B_Wld_InsertNpc (Warg, "NW_FOREST_PATH_27_02");
B_Wld_InsertNpc (Scavenger, "NW_CITY_TO_LIGHTHOUSE_13_MONSTER7");
B_Wld_InsertNpc (Scavenger, "NW_CITY_TO_LIGHTHOUSE_13_MONSTER7");
B_Wld_InsertNpc (Bloodfly, "NW_CITY_TO_LIGHTHOUSE_13_MONSTER8");
B_Wld_InsertNpc (Bloodfly, "NW_CITY_TO_LIGHTHOUSE_13_MONSTER8");
B_Wld_InsertNpc (Keiler, "NW_FOREST_PATH_35_MONSTER");
B_Wld_InsertNpc (Warg, "NW_FOREST_PATH_72_MONSTER23");
B_Wld_InsertNpc (Molerat, "NW_FOREST_PATH_76");
B_Wld_InsertNpc (Warg, "NW_FOREST_PATH_66_MONSTER");
B_Wld_InsertNpc (Giant_Bug, "NW_FOREST_PATH_04_5");
B_Wld_InsertNpc (Keiler, "NW_FOREST_PATH_04_14_MONSTER");
B_Wld_InsertNpc (Molerat, "NW_CITY_SMFOREST_03_M");
B_Wld_InsertNpc (Molerat, "NW_FOREST_PATH_25_01_M");
B_Wld_InsertNpc (Bloodfly, "FP_ROAM_TROLLAREA_SEA_01");
B_Wld_InsertNpc (Bloodfly, "FP_ROAM_TROLLAREA_SEA_02");
B_Wld_InsertNpc (Bloodfly, "FP_ROAM_TROLLAREA_SEA_03");
B_Wld_InsertNpc (Bloodfly, "FP_ROAM_TROLLAREA_SEA_04");
B_Wld_InsertNpc (Bloodfly, "FP_ROAM_NW_TROLLAREA_RUINS_22");
B_Wld_InsertNpc (Bloodfly, "FP_ROAM_NW_TROLLAREA_RUINS_24");
B_Wld_InsertNpc (Waran, "FP_ROAM_NW_TROLLAREA_RUINS_28");
B_Wld_InsertNpc (Waran, "FP_ROAM_NW_TROLLAREA_RUINS_29");
B_Wld_InsertNpc (Waran, "FP_ROAM_NW_TROLLAREA_RUINS_30");
B_Wld_InsertNpc (Shadowbeast, "FP_ROAM_NW_TROLLAREA_RUINS_10");
B_Wld_InsertNpc (Bloodfly, "NW_TROLLAREA_PATH_38_MONSTER");
B_Wld_InsertNpc (Scavenger, "NW_TROLLAREA_PLANE_04");
B_Wld_InsertNpc (Scavenger, "NW_TROLLAREA_RUINS_17");
B_Wld_InsertNpc (Scavenger, "NW_TROLLAREA_PATH_71_MONSTER2");
B_Wld_InsertNpc (Scavenger, "NW_TROLLAREA_PATH_15_MONSTER");
B_Wld_InsertNpc (Scavenger, "NW_TROLLAREA_RITUALPATH_04");
};

The one bug in it is the Game Crash, which should not happen.

Milky-Way
05.04.2014, 11:47
Does the game also crash when you call the function only once?

Abuyin Sharidi
05.04.2014, 11:54
Does the game also crash when you call the function only once?

Now I tested it and yes, it does.
B_Wld_InsertNpc (Wolf, "START"); >> Crash

Milky-Way
05.04.2014, 12:20
Okay, please keep the one-spawn-only for now.

Next, try to see where in B_Wld_InsertNpc the game crashes.

If you place comments // in front of all Wld_InsertNpc, does the game still crash?

If yes:
Put the entire inner code of the function into comments /* ... */

func void B_Wld_InsertNpc (var C_NPC NPC, var string WP){
SpawnRate = Hlp_Random(MaxPercent);
/*
...
*/
};
If it still crashes, please let us know ;)
If not, start taking your if statements out of the comment one by one:

func void B_Wld_InsertNpc (var C_NPC NPC, var string WP){
SpawnRate = Hlp_Random(MaxPercent);
if ((NPC.guild > GIL_SEPERATOR_HUM && NPC.guild < GIL_SEPERATOR_ORC) && NPC.guild != GIL_DRAGON)
{
/*
...
*/
};
};
If it crashes here, let us know. If not, take another if statement out of the comments...

Abuyin Sharidi
05.04.2014, 13:26
Ok, I've got fix the problem.

I was using self-made function Npc_IsOnWP (var C_NPC NPC, var string WP) and there were the problem.

func int Npc_IsOnWP (var C_NPC NPC, var string WP)
{
if (Npc_GetDistToWP (NPC, WP) < SpawnRange)
{
return true;
}
else
{
return false;
};
};

I needed to change it to NPC_GetDistToWp and now it's working. But, not 100% good.
As we know, Wld_InsertNpc () uses an int for NpcInstance, and I have a C_NPC, which does not reveal the NPC (the script works, but does not spawn the Npc because of the var C_NPC NPC). How should I make it work now? I don't have idea how to fix it. :/

Lehona
05.04.2014, 13:29
As far as I can tell (unable to test any code right now; I'm on vacation), you've made some flawed assumptions when writing your code. Now, this isn't really your fault, because when it comes to handling NPCs (esp. monsters), Daedalus is just a huge mess.

NPC is of type C_NPC when it really should be of type int. This directly leads to the next problem: How do you make sure you're testing the distance for the closest monster? I.e. when there are two molerats, one at WP1 and other one at WP2. If you check the distance to WP1 for the second molerat, your script will spawn a new molerat at WP1, although there's still a molerat present! This problem is not easily preventable, though. To circumvent it, you'd have to iterate through all existing molerats (= check the distance for all exisiting molerats), but Gothic doesn't easily allow you to do so, as far as I know it's only possible with Ikarus.

There's this (http://forum.worldofplayers.de/forum/threads/1126551-Skriptpaket-LeGo-2/page4?p=19677272&viewfull=1#post19677272)script, based on LeGo, which I have written that respawns NPCs/monsters, but the tutorial is written in German, so you'll probably have to use Google Translate and ask, if something remains unclear.
With some easy modifications I think it could do exactly what you're trying to do.



I assume the crash stems from the type of the parameter NPC, but I doubt that your script will work correctly, even if you fix it.

Abuyin Sharidi
05.04.2014, 13:45
Well, I just wanted to make a script like Wld_InsertNpc() that has a bonus, not a... whatever it is. I didn't read the topic, because I'm too lazy to use Google Translate AND it translates very badly - I can't understand a thing.

Moreover, I don't understand the scripts written in this topic, so I am a bit frightened about using them. If someone would explain the function it would be great. I suck at LeGo/Ikarus and I can't learn those scripts. :/

Milky-Way
05.04.2014, 14:19
You will need to explain what kind of "bonus" you want. :)

The script Lehona mentions is a basic respawn - dead monsters can be spawned again - which could be extended.

Abuyin Sharidi
05.04.2014, 15:34
You will need to explain what kind of "bonus" you want. :)

The script Lehona mentions is a basic respawn - dead monsters can be spawned again - which could be extended.

The bonus I mean is herd of monsters (6 - 9 monsters) or just one or two more monsters, depending on luck (or we can even say unluck :P). :)

But I think I'll be forced to use this this script that I don't understand. :dnuhr:

Milky-Way
05.04.2014, 15:39
Is your problem that you do not know how to implement the code or that you do not feel comfortable using it without understanding how it works?

Abuyin Sharidi
05.04.2014, 17:00
Is your problem that you do not know how to implement the code or that you do not feel comfortable using it without understanding how it works?

I'd say both, but as I saw in the topic Lehona posted, there were everything put in one, so I need to use merely one thing to make it work (if I understand correctly), and I seriously don't feel comfortable to use it without understanding it.

I know I require much, but, well, so I am. :)

Milky-Way
05.04.2014, 19:13
How much detail do you need in terms of understanding what it does?

The general idea is the following:
In the ZS_Dead, it is checked whether an npc should be respawned (with the function MeetsRespawnCondition). If so, it is added to a array-like object by use of the function AddToRespawnArray. More precisely, the array contains handles with witch you can access objects of type RespawnObject. An object of type RespawnObject has the properties defined in its class:

class RespawnObject {
var int inst; //Die Monsterinstanz
var string wp; //Der Wegpunkt
var int respawnDay; // Der Tag des Respawns, wobei der erste Tag den Wert 0 hat... Genau wie Gothic.
};
So, the function AddToRespawnArray creates an object of that class and fills its fields with appropriate values:

func void AddToRespawnArray(var c_npc slf) {
var int hndl; hndl = new(RespawnObject@);
var RespawnObject myRespawnObject; myRespawnObject = get(hndl);
myRespawnObject.inst = Hlp_GetInstanceID(slf);
myRespawnObject.wp = slf.spawnPoint;
myRespawnObject.respawnDay = Wld_GetDay() + (slf.level/10)+2; // Irgendeine Formel
};

Now there exists a RespawnObject for each npc that should be respawned. But how is it actually respawned? In the example, it happens when sleeping. In the PC_Sleep.d (which contains the functions called when a bed is used), he calls
CheckRespawns();

the function does this:

func void CheckRespawns() {
ForEachHndl(RespawnObject@, _CheckRespawns);/* Dieser Part bedarf vielleicht einer kurzen Erklärung:
Mit ForEachHndl() führe ich eine angegebene Funktion (2. Parameter) für alle Objekte/Handles
einer angegebenen Ursprungsinstanz (1. Parameter) aus. So kann ich ganz einfach
alle RespawnObjects überprüfen :) */
};
What does it mean? (it is explained in the comment in German)
ForEachHndl will call the function that is given as the second argument once for each handle of objects of the first argument. So, since we only create handles to RespawnObject from the ZS_Dead, the function _CheckRespawns is called once for each of the RespawnObject that we created.

So what does the _CheckRespawns function do?

func void _CheckRespawns(var int hndl) { // In diesem Parameter steht, für welches Handle die Funktion gerade ausgeführt wird
var RespawnObject myRespawnObject; myRespawnObject = get(hndl);
//Jetzt haben wir unser Objekt!

if (myRespawnObject.respawnDay <= Wld_GetDay()) { // Der Tag des Respawns ist gekommen! \o/
Wld_InsertNpc(myRespawnObject.inst, myRespawnObject.wp); // Daher fügen wir einfach den NPC an seinem WP ein :)
// Allerdings müssen wir nun unser Objekt auch entfernen, sonst würde es ja beim nächsten Mal wieder eingefügt!
// Ich werde daher einfach mal die Funktion RemoveRespawnObject() aufrufen - wie die aussehen muss, schauen wir später.
RemoveRespawnObject(hndl);
return rContinue; // Wir wollen schließlich weiterhin alle Handles durchlaufen - bis wir alle haben
};
First, it gets the object of the handle. Then, it checks whether the field respawnDay of that object indicates that the npc should be respawned by today at the latest. If so, the monster is respawned. Lastly, since the npc is now respawned, we can delete the handle in the function RemoveRespawnObject.

The return rContinue means that the game will go on calling the _CheckRespawn for the next handle. (if our goal was to find a specific handle, we could stop once we found it, but here all RespawnObjects might potentially need to be respawned)

That is basically it. Only a technical thing remains:

const string RespawnObject_Struct = "auto|3";
tells the game what objects of the class RespawnObject look like. The internal scripts will use that information to associate the saved information with the correct fields of the object. Here, "auto|3" means that there are 3 fields of auto, where auto means that it is a simple value (Func, float, int, string) - if you introduce more fields (e.g. the class gets an additional integer value to indicate how many of these monsters should be respawned) you need to change the 3 e.g. into a 4. If you have "more complicated" fields, such as a pointer to another object, you need to mention it explicitly as the "auto" does not know how to handle it. E.g.

const string RespawnObject_Struct = "auto|3 RespawnObject*";

I explained all relevant code blocks except for this one:

instance RespawnObject@(RespawnObject);
RespawnObject@ is now an instance of the RespawnObject class. The instance can then be used to create actual objects. Here, that happens with the handle and new in the function AddToRespawnArray.
Similar things happen in the normal scripts as well. You have a class C_NPC that has several fields, e.g. name, id,... which you can actually see in the Classes.d - you will see the similarity to our own class RespawnObject. In the script of a Wolf for example, it uses a similar line to create an instance from that class: INSTANCE Wolf (Mst_Default_Wolf), where Mst_Default_Wolf is a prototype, a kind of template that gives default values to the fields of the class C_NPC. When you then look at the startup, this instance wolf is used to create the actual wolves (Wld_InsertNpc (Wolf, wp)).
After inserting such an NPC, you can of course change the values like name, level,... e.g. when the player has enough experience, the value of the field level is increased by one.
A problem that one faces is that one instance (Wolf) is used to create many objects (Wld_InsertNpc (Wolf,wp) is used more than once), so there is not a one-to-one correspondence. After bringing a wolf into the world, you do not have access to that particular wolf anymore, but only to the instance from which it was created. That is exactly what the handles are for, you save access to the actual individual object.

If you need more information (e.g. how handles work internally or on implementation) or if you have questions about my explanation (which I did not read again to make sure it's coherent), please let us know :)

Abuyin Sharidi
06.04.2014, 10:35
In the ZS_Dead, it is checked whether an npc should be respawned (with the function MeetsRespawnCondition).

What is it? I didn't find it in your explaination. :P

func int MeetsRespawnCondition(var c_npc slf)
{ return (slf.guild > GIL_SEPERATOR_HUM); // Überprüft bisher bloß, ob 'slf' nicht menschlich ist
};
Now it's explained! I understand this function. ^^
You explained it very well, for me, thank you! :)
But I've got one more question: if I'd spawn for example 3 monsters, if these are wolfs, scavengers, molerats, giant rats or bloodflys, what should I do? Call the function CheckRespawns few more times or just put here something more?

And one more thing (I do not want to make another useless topic):
How can I call (with the help of LeGo) hero's target?
I am using this

var oCNpc her; her = Hlp_GetNpc(hero);
var c_npc oth; oth = MEM_PtrToInst(her.focus_vob);

if (Hlp_Is_oCNpc(her.focus_vob))
{ [...] };
but as I know it's taking the first thing that hero sees and I want merely C_NPC target.

Milky-Way
06.04.2014, 11:15
Respawn:
There are several ways to achieve what you plan.
In the current setup, there exists a RespawnObject@ for each monster that died. When the function CheckRespawns is called, it will call the function _CheckRespawns for each of these objects.
What you can do:
in the function _CheckRespawns, determine how many monsters of this "type" you want to spawn.
So instead of only
Wld_InsertNpc(myRespawnObject.inst, myRespawnObject.wp);
you can get a random number and then spawn as many monsters as the random number gave you.
(the respawn does not really care what kind of NPC you respawn (rat, wolf,...) as long as it meets the respawn condition - you always respawn the same monster that dies (of course you could change that as well by changing the myRespawnObject.inst = Hlp_GetInstanceID(slf); in AddToRespawnArray))

WARNING: by spawning several monsters, each of these will become a RespawnObject@ once it dies, potentially creating ever more monsters. You could use some probability theory / Markov chains to figure out how to model it appropriately.



target:
Please specify what you actually want to achieve and what exactly you mean by the heros target - it might not be well defined at all times.


And just so you know: there is nothing bad about opening new topics. In fact, it often makes it easier to help if each problem is discussed in a new topic, so they don't get mixed up)

Abuyin Sharidi
06.04.2014, 11:57
target:
Please specify what you actually want to achieve and what exactly you mean by the heros target - it might not be well defined at all times.


And just so you know: there is nothing bad about opening new topics. In fact, it often makes it easier to help if each problem is discussed in a new topic, so they don't get mixed up)

Well, you're right.
I'll do one more topic about the target in a second.

Thank you for explaining me this respawn script. I think I understand everything now. If I'll have more questions about the script I'll refresh this topic. Thank you again! :gratz ;)