Hill Objects for Random Map

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Hill Objects for Random Map

Post by Merr »

Pip and Amaris,

We know that we can't build a hill with code (yet), however, if a BAM contains a hill there is a way to indentify the height and place a special hill object there.

A special hill object is an object that has it's Z-AXIS (height position) in it's S3F modified especially for placement on the hill.

All of the S3F files are available in their object folders for editting. What I can do is edit these and build a special objects folder for each theater, e.g. BULGE_HILL.

Now, the code to indentify the hill is located in the AUTODOCS :

Code: Select all

//return the height of the center of a given tile, in 100ths.  So 0 would be ground level, 100 the top of a 1st level hill, etc
GetTileHeight(x,y)
Anyway ... If/When Pip allows us to build a hill with code, the next problem would be dropping the object on the hill at the correct height.

Now, there is some code out there that I saw that relates to a "threat markers" ( :?: object) height that will automatically bump the marker higher based on the tile height.
I think that code would work but it's all speculation.


Merr.
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

Any object should automatically sit on the terrain it is placed on. You CAN tell objects to ignore the height (e.g. if you want to build things like a bridge that can flow into the landscape) but generally they will just work automagically.

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

pipfromslitherine wrote:Any object should automatically sit on the terrain it is placed on. You CAN tell objects to ignore the height (e.g. if you want to build things like a bridge that can flow into the landscape) but generally they will just work automagically.

Cheers

Pip
Hmmm, I tested this earlier on my random map ... the object will automatically ignore the height and assume the tile height is ground level, despite being on a hill.
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

Hmmm - that's odd. It might be that the object placement code doesn't take the height of the map into account.

What happens if you save out the map and reload it - do the objects pop up onto the hills?

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

Good question .... but, unfortunately not :cry:

I added some hills to my random map BAM ... started scenario ... objects on hill at ground level.
I then saved scenario, exited scenario, reloaded saved scenario file .... objects are still buried in the hill :cry:
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

Pip,

I added some hills to a BAM and ran Amaris' Plugin .... Objects behave as you said, it will read height in EDITOR.

It appears it won't read the height outside of the EDITOR, e.g. when you start a scenario and run the object placement function.
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

Ah - I see what you mean. A little odd certainly, but I must have built it like that!

Probably too late to put a fix in for the upcoming (please God) update, as we are into some final testing, and there is plenty there to keep us busy! But I will fix it ready for post 1.6 update.

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

Pip,

I was incorrect about the object sitting at the correct height when using Amaris' Random Map Plugin :cry:

If you add a hill to the map, then run his plugin, the objects will be placed at ground level, height not considered.
However, if you CRTL_Left Click (the function to create a hill in the editor) on the map, the editor will update the entire map and move the objects to their correct height. :D

So ... I have a brilliant idea (yeah right!) ....

If you can create a function that mimics the CRTL_Left Click, we can run this in the script after the map is generated !!

Perhaps .... function RaiseHeight(x, y) ... or MerrRaiseHeightSuchAGreatIdea(x,y) ... :P

Just brainstorming, but I wanted to let you know about it.

Rob
Post Reply

Return to “Battle Academy : Modders Corner ”