This game is now available on Steam!

Thanks for your help in getting this game selected for distribution via Steam. More information including a link to the Steam store page can be found below.

Hammerwatch
Soga Jun 13, 2013 @ 10:37am
Editor Tips 'n Tricks
Hey guys! I kind of figured that the pinned editor thread would be better reserved for actual editor help and questions. I wanted to set apart an area here where we could exchange tips and tricks for doing cool things with the Hammerwatch editor. For example, you could post instructions on how to set up different systems using scripts. Or you could explain how to manipulate XML files to achieve certain effects in the game. This could turn into an useful repository to help newbies get used to the editor and to give them a foundation from which they can start thinking up advanced concepts that could be used to really enrich the gameplay experience!

I'll start:

Detect Number Of Players
There are actually several ways to do this. But one method is to set up a shape over the whole playable portions of the level then attach an AreaTrigger to that shape. Next, set up 4 lines of script with the following sequence:

1. SetGlobalFlag("1Player", Enable)(trigger 1 time)
2. Counter(2)(trigger 2 times) -> SetGlobalFlag("2Player", Enable) -> SetGlobalFlag("1Player", Disable)
3. Counter(3)(trigger 3 times) -> SetGlobalFlag("3Player", Enable) -> SetGlobalFlag("2Player", Disable) -> SetGlobalFlag("1Player", Disable)
4. Counter(4)(trigger 4 times) -> SetGlobalFlag("4Player", Enable) -> SetGlobalFlag("3Player", Disable) -> SetGlobalFlag("2Player", Disable) -> SetGlobalFlag("1Player", Disable)

You should have something that looks like this:

Picture 1

Now, this won't necessarily work well because the players may be spawned before the AreaTrigger script element is activated in-game. One way you can address this is to disable the shape over the level initially, then have a GlobalEventTrigger on LevelLoad that enables the shape after a delay. In the screenshot below, I used a delay of 60 before invoking ToggleElement on the shape.

Picture 2

And presto! Now if you need to do things based on the number of players, simply pop down a CheckGlobalFlag that checks the state of the flags 1Player, 2Player, 3Player, or 4Player. Need to spawn extra monsters for more players in the game? No problem! Want to open up routes intended for multiple players only? Knock yourself out!

Just keep in mind that when performing the CheckGloblalFlag for these flags, that there is a delay from the beginning of the game before these flags are set. So ensure that your CheckGlobalFlags occur after that delay.
Last edited by Soga; Jun 13, 2013 @ 10:41am
Showing 1-7 of 7 comments
< >
hipshot  [developer] Jun 13, 2013 @ 12:40pm 
Interesting!
hipshot  [developer] Jun 14, 2013 @ 6:08pm 
This isn't really a editor script or so, but it's the batch file I use to start any level instead of having to go though the menu and play.

@Echo off
Echo Level_* file:
set /p Input=
Echo Class (knight/ranger/wizard/warlock):
set /p Input2=
"hammerwatch.exe" l levels\level_%Input%.xml c %Input2% r 1280x720
Soga Jun 14, 2013 @ 6:27pm 
Very nifty! I might use that.
HerpMaDerp Jun 29, 2013 @ 8:03pm 
Is there some way to reset the counters on Level Load?
I find that the Global flags don't persist through level changes but the counters do and I as I am attempting to make a sandbox "endgame muckabout" level swapping zones and having monsters spawn on level enter is a big part of it.
Myran  [developer] Jun 30, 2013 @ 5:10am 
If you use a variable instead of a counter you can reset it with the ChangeVariable node.
Soga Jun 30, 2013 @ 10:39am 
My original tip here has been rendered obsolete by the "CountPlayers" script element.

Still, if anybody has a tip they'd like to share, feel free to post it here.
Linaru Jul 4, 2013 @ 7:40am 
i did post this in the editor help but then i figured it might be easyer for people to find here

i have begun writing a simple guide to makeing dungeons for begginers, its only a rough draft so far how ever i thought id post it up here as soon as possible for people to use.

https://www.dropbox.com/s/9qq3342syqith0b/Hammerwatch%20A%20guide%20to%20dungeoneering.docx

enjoy =3
Showing 1-7 of 7 comments
< >
Per page: 15 30 50