PDA

View Full Version : How to make a hero attacking loop on my map?



Trondhor
September 27th, 2014, 15:28
Greetings everyone :-)

Nice to be here. I just found this forum. I had no idea that it exists. I know DK1 since the 90s, too. I found a way to get the original map editor work with a virtual win95 machine.

Scripting help needed:
I made a single player map. It should be an endless fight against hero parties. I'm a real newbie in scripting those things. I can tell you what should happen. I hope you can help me out with the script.

Download the map (http://thinkshare.de/DungeonKeeper/mydk1map.zip)
Look at the script (http://thinkshare.de/DungeonKeeper/MAP00202.txt)

The player starts in the center of the map. It contains 4 Hero doors and 4 action points. The hero doors and action points are together. Example: Action point 1 is at the same place as hero door 1. They are placed in the middle of north, south, west, east.

Please tell me. Are the IF settings for the win correct? I mean the syntax. I want that it needs much time before you win. Kinda good for a loop fight. Or?

I tell you what the script has to do. How the hero player should work.

If the player reaches action point 1, has minimum 50 creatures and hero player has 0 creatures then start a timer. Lets say 5 minutes. After those 5 minutes place a party on hero door 1. After all heros are beaten and the creatures of hero player are 0 start a timer for 10 minutes. After those 15 minutes place the same party at the same hero door. And that again every 15 minutes. And this with different parties for each hero door / action point.

Please write that IF syntax for me. Use Action Point / Hero Door 1 and Party "RPG" from the script. After that i can copy it for the other hero doors.

I think it takes a lot of time to win on this map but its okay. I want it :-)

Beside, i use KeeperFX on Win7 64bit and it works fine. Is it stable enough to manage this many creatures? I mean. When i have about 230 creatures and there are 4 or 5 hero parties coming. Can the game crash or will it work?

Thank you so much for help! I appreciate it.

YourMaster
September 27th, 2014, 19:26
Greetings.

The original editor works in Win7, you don't need a virtual machine. See this topic (http://keeperklan.com/threads/1666-How-to-get-the-official-editor-to-work-with-KeeperFX). But when it works, it works, so using the VM is fine.

KeeperFX won't crash with the 230 creatures. However, I'm not sure your level will work, note there is an ingame limit of 255 creatures which includes workers, and you're limited to 48 if-statements in your level script. Easiest would be to make separate loops for the 5, 10 and 15 minutes, but if you want that with different parties and different action points, you'll quickly reach the limit. Also, be aware that like the original, there is the 'thing limit', if there is too much stuff, no new things can be created, which includes creature spells, so if you build too big a dungeon and have too much stuff, you basically can't play on. Even new parties won't spawn.
In any case, you can take a look at level 18 in the keeperfx campaign, that features a loop where creatures continue to come.

What you could do, if you make it a KeeperFX map, is to use the If_control command to see how many heroes there are, this helps speed up the level a lot, as the timer will start again as soon as they are imprisoned, instead of when they are skeletons/converted.

I think your victory condition works, but if I were you, I'd test it with 15 battles won and without the other conditions to make sure it works.

Edit: Here you go:

LEVEL_VERSION(1)
REM ********************************************
REM
REM Script for Level 202
REM
REM ********************************************

START_MONEY(PLAYER0,5000)
SET_GENERATE_SPEED(250)
MAX_CREATURES(PLAYER0,250)

ADD_CREATURE_TO_POOL(HORNY,200)
ADD_CREATURE_TO_POOL(ORC,200)
ADD_CREATURE_TO_POOL(TENTACLE,200)
ADD_CREATURE_TO_POOL(GHOST,200)
ADD_CREATURE_TO_POOL(HELL_HOUND,200)
ADD_CREATURE_TO_POOL(SPIDER,200)
ADD_CREATURE_TO_POOL(VAMPIRE,200)
ADD_CREATURE_TO_POOL(BUG,200)
ADD_CREATURE_TO_POOL(BILE_DEMON,200)
ADD_CREATURE_TO_POOL(SORCEROR,200)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,200)
ADD_CREATURE_TO_POOL(FLY,200)
ADD_CREATURE_TO_POOL(DEMONSPAWN,200)
ADD_CREATURE_TO_POOL(DRAGON,200)
ADD_CREATURE_TO_POOL(TROLL,200)
ADD_CREATURE_TO_POOL(SKELETON,200)

CREATURE_AVAILABLE(PLAYER0,HORNY,1,0)
CREATURE_AVAILABLE(PLAYER0,ORC,1,0)
CREATURE_AVAILABLE(PLAYER0,TENTACLE,1,0)
CREATURE_AVAILABLE(PLAYER0,GHOST,1,0)
CREATURE_AVAILABLE(PLAYER0,HELL_HOUND,1,0)
CREATURE_AVAILABLE(PLAYER0,SPIDER,1,0)
CREATURE_AVAILABLE(PLAYER0,VAMPIRE,1,0)
CREATURE_AVAILABLE(PLAYER0,BUG,1,0)
CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,0)
CREATURE_AVAILABLE(PLAYER0,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(PLAYER0,FLY,1,0)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,0)
CREATURE_AVAILABLE(PLAYER0,DRAGON,1,0)
CREATURE_AVAILABLE(PLAYER0,TROLL,1,0)
CREATURE_AVAILABLE(PLAYER0,SKELETON,1,0)

MAGIC_AVAILABLE(PLAYER0,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_OBEY,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HOLD_AUDIENCE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_HAND,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_SLAP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_CAVE_IN,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CONCEAL,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_SIGHT,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(PLAYER0,POWER_SPEED,1,0)

ROOM_AVAILABLE(PLAYER0,GRAVEYARD,1,1)
ROOM_AVAILABLE(PLAYER0,TRAINING,1,1)
ROOM_AVAILABLE(PLAYER0,BARRACKS,1,1)
ROOM_AVAILABLE(PLAYER0,TREASURE,1,1)
ROOM_AVAILABLE(PLAYER0,WORKSHOP,1,1)
ROOM_AVAILABLE(PLAYER0,GARDEN,1,1)
ROOM_AVAILABLE(PLAYER0,RESEARCH,1,1)
ROOM_AVAILABLE(PLAYER0,SCAVENGER,1,1)
ROOM_AVAILABLE(PLAYER0,LAIR,1,1)
ROOM_AVAILABLE(PLAYER0,PRISON,1,1)
ROOM_AVAILABLE(PLAYER0,TEMPLE,1,1)
ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
ROOM_AVAILABLE(PLAYER0,TORTURE,1,1)

TRAP_AVAILABLE(PLAYER0,ALARM,1,0)
TRAP_AVAILABLE(PLAYER0,POISON_GAS,1,0)
TRAP_AVAILABLE(PLAYER0,LIGHTNING,1,0)
TRAP_AVAILABLE(PLAYER0,BOULDER,1,0)
TRAP_AVAILABLE(PLAYER0,WORD_OF_POWER,1,0)

DOOR_AVAILABLE(PLAYER0,BRACED,1,0)
DOOR_AVAILABLE(PLAYER0,STEEL,1,0)
DOOR_AVAILABLE(PLAYER0,MAGIC,1,0)
DOOR_AVAILABLE(PLAYER0,WOOD,1,0)

CREATE_PARTY(RPG)
ADD_TO_PARTY(RPG,WIZARD,10,900,ATTACK_DUNGEON_HEAR T,0)
ADD_TO_PARTY(RPG,BARBARIAN,10,900,ATTACK_DUNGEON_H EART,0)
ADD_TO_PARTY(RPG,KNIGHT,10,900,ATTACK_DUNGEON_HEAR T,0)
ADD_TO_PARTY(RPG,WITCH,10,900,ATTACK_DUNGEON_HEART ,0)

CREATE_PARTY(BIG)
ADD_TO_PARTY(BIG,AVATAR,10,900,ATTACK_ENEMIES,0)
ADD_TO_PARTY(BIG,KNIGHT,10,900,ATTACK_ENEMIES,0)
ADD_TO_PARTY(BIG,AVATAR,10,900,ATTACK_DUNGEON_HEAR T,0)
ADD_TO_PARTY(BIG,KNIGHT,10,900,ATTACK_DUNGEON_HEAR T,0)

CREATE_PARTY(AGGRO)
ADD_TO_PARTY(AGGRO,GIANT,10,500,ATTACK_DUNGEON_HEA RT,0)
ADD_TO_PARTY(AGGRO,MONK,10,500,ATTACK_ENEMIES,0)
ADD_TO_PARTY(AGGRO,BARBARIAN,10,500,ATTACK_DUNGEON _HEART,0)
ADD_TO_PARTY(AGGRO,ARCHER,10,500,ATTACK_ENEMIES,0)

CREATE_PARTY(MAGIC)
ADD_TO_PARTY(MAGIC,WIZARD,10,550,ATTACK_ENEMIES,0)
ADD_TO_PARTY(MAGIC,FAIRY,10,550,ATTACK_DUNGEON_HEA RT,0)
ADD_TO_PARTY(MAGIC,WITCH,10,550,ATTACK_DUNGEON_HEA RT,0)
ADD_TO_PARTY(MAGIC,SAMURAI,10,550,ATTACK_ENEMIES,0 )

CREATE_PARTY(DWARVES)
ADD_TO_PARTY(DWARVES,DWARFA,10,650,ATTACK_ENEMIES, 0)
ADD_TO_PARTY(DWARVES,DWARFA,10,650,ATTACK_DUNGEON_ HEART,0)
ADD_TO_PARTY(DWARVES,THIEF,10,3000,ATTACK_ENEMIES, 0)
ADD_TO_PARTY(DWARVES,ARCHER,10,3000,ATTACK_DUNGEON _HEART,0)


REM Trigger Timer for continuous spawning of party RPG
IF_ACTION_POINT(1,PLAYER0)
IF_CONTROLS(PLAYER0,TOTAL_CREATURES >= 50)
IF_CONTROLS(PLAYER_GOOD,TOTAL_CREATURES <= 0)
SET_TIMER(PLAYER0,TIMER1)
ENDIF
ENDIF
ENDIF

REM Spawn Party RPG every 5 minutes
IF(PLAYER0,TIMER1 >= 6000)
NEXT_COMMAND_REUSABLE
ADD_PARTY_TO_LEVEL(PLAYER_GOOD,RPG,-1,1)
QUICK_INFORMATION(1,"Your long wait is over Keeper, the role playing party has arrived",-1)
NEXT_COMMAND_REUSABLE
SET_TIMER(PLAYER0,TIMER1)
ENDIF

IF(PLAYER0,TOTAL_CREATURES >= 245)
IF(PLAYER0,MONEY >= 95000)
IF(PLAYER0,BATTLES_WON >= 1500)
IF(PLAYER_GOOD,TOTAL_CREATURES == 0)
WIN_GAME
ENDIF
ENDIF
ENDIF
ENDIF

REM ***** End of Script **********************

Personally I would take the condition of having 0 heroes on the map before the timer resets out. How it is now, you have to wait 5 minutes, but there is nothing to do as you have no rival creatures. You could simply go out for a walk or something until the 5 minutes are up.

Trondhor
September 28th, 2014, 17:20
Thank you very much!

I used this and it works brilliant! Ive overwritten the map download and script from the start posting. Look at it. I played and the win syntax worked.

One question. What exactly is a won battle? Does that mean if you kill a party or amount of killed creatures?

YourMaster
September 28th, 2014, 18:46
The script you have right now shouldn't work,....you'll probably trigger the timer even if you don't have enough creatures or if there are still heroes. You've taken out the 'Level_version(1)' which enables KeeperFX commands, but kept the 'IF_CONTROLS' which is a KeeperFX command,... If you don't want to make it KeeperFX only, simply use an IF command instead.

You've also reintroduced some of the other mistakes I've taken out, like the misspelling of HELL_HOUND.

I don't know what counts as a battle won.

Trondhor
September 28th, 2014, 19:46
Oh tanks for the info! I corrected it. Sorry :)

YourMaster
September 28th, 2014, 23:37
Now you've reintroduced the Level_version(1), but you've kept the non-FX Creature_available command. This way you'll receive creatures even if you don't have the rooms for it. See the script I posted, or look here (https://code.google.com/p/keeperfx/wiki/NewLevelScriptCommands) for the description.

Trondhor
September 29th, 2014, 16:59
I understand. I played it yesterday and in that map im building every room. So its not important.

Beside, i think won battles means how many creatures you killed. Not parties.