Jump to content

How to make an non-interactable (but persistent) object? [Solved+Download]


Recommended Posts

I noticed in the map editor that when you place a tree underwater, a ship can't go 'through' or, better said, over it. This can be extremely handy to safeguard ridges that aren't meant for ungarrisoning by creating a underwater barrier of trees. You can place them quite spacious so performance wise it costs nearly nothing.

However, the problem with using real trees is that the workers on land will try to reach it infinitely. So that's bad. 

My solution to this is to implement a horizontal log (wider = better) that:

  1. Doesnt float, so it doesnt impact map visuals.
  2. That can't be chopped, but is persistent. Just like a tree.

Have no idea where to start though. Or maybe someone has a better approach to it or hopefully point me in the right direction.

Edited by Grapjas
Link to post
Share on other sites

We you could create a special actor with the field mesh and a custom template with obstruction. This way you wi have a custom obstruction object. You can set it to be only visible in atlas  See the trigger markers for example.

  • Like 1
  • Thanks 1
Link to post
Share on other sites

@Stan` would you be willing to put this into the base of the game? I think it's quite an important tool for map makers who want functional ridges without destroying their visuals. 

 

In any case, if anyone needs it / want to use it here  you go: invisible_obstruction_field.rar

It's a farm field that belongs to no-one, is visible in atlas only. Blocks any units from moving over it, also when submerged in water.

Place the template files in simulation-> templates

Place  'invisible_obstruction_field' in simulation-> templates -> structures

Once you've done that you can find it in the map editor under the name 'invisible_obstruction_field'.

 

Example:

: Edited by Grapjas
Link to post
Share on other sites
  • Grapjas changed the title to How to make an non-interactable (but persistent) object? [Solved+Download]
9 minutes ago, Stan` said:

Well for it to be there we would need an object just like the markers cause it would be very hard to move after placed :)

I'm not sure i follow. In the atlas editor you see a farmfield. You can just target that to move the barrier around.

Link to post
Share on other sites

Have you tried using custom special filters, haven't tried myself but should be able to expand the template of the entity you want to have the effect applied without template duplication.
Here is an example I did for a map where i wanted to  make the a wonder ungarrisonable
https://code.wildfiregames.com/D1634

the file in question is binaries/data/mods/public/simulation/templates/special/filter/disableGarrisonHolder.xml so should be similar for your case

  • Thanks 1
Link to post
Share on other sites

Delenda Est has these placement obstructors, whose code may be useful to you.

 

<?xml version="1.0" encoding="utf-8"?>
<Entity>
  <AIProxy/>
  <Footprint>
    <Square width="38.5" depth="7.0"/>
    <Height>9.0</Height>
  </Footprint>
  <Obstruction>
    <Active>true</Active>
    <BlockMovement>false</BlockMovement>
    <BlockPathfinding>false</BlockPathfinding>
    <BlockFoundation>true</BlockFoundation>
    <BlockConstruction>true</BlockConstruction>
	<DeleteUponConstruction>false</DeleteUponConstruction>
    <DisableBlockMovement>false</DisableBlockMovement>
    <DisableBlockPathfinding>false</DisableBlockPathfinding>
    <Static width="37.0" depth="6.0"/>
  </Obstruction>
  <Ownership/>
  <Position>
    <Altitude>0</Altitude>
    <Anchor>upright</Anchor>
    <Floating>false</Floating>
	<FloatDepth>0.0</FloatDepth>
    <TurnRate>6.0</TurnRate>
  </Position>
  <Selectable>
    <Overlay>
      <Outline>
        <LineTexture>outline_border.png</LineTexture>
        <LineTextureMask>outline_border_mask.png</LineTextureMask>
        <LineThickness>0.4</LineThickness>
      </Outline>
    </Overlay>
  </Selectable>
  <Visibility>
	<RetainInFog>true</RetainInFog>
	<AlwaysVisible>false</AlwaysVisible>
	<Corpse>false</Corpse>
	<Preview>false</Preview>
  </Visibility>
  <VisualActor>
    <Actor>structures/hellenes/wall_long.xml</Actor>
    <SilhouetteDisplay>false</SilhouetteDisplay>
    <SilhouetteOccluder>false</SilhouetteOccluder>
    <VisibleInAtlasOnly>true</VisibleInAtlasOnly>
  </VisualActor>
</Entity>

 

  • Thanks 1
Link to post
Share on other sites
17 minutes ago, Grapjas said:

Thanks for helping, but i think it's pretty much the same thing as what i got going on at this moment :)

You do it slightly different but i guess the outcome is the same. 

 

Honestly, I would do whatever makes sense to you, but my way gets rid of a lot of files. You could split it up into a template_ file, and then make the entity file have just the footprint and actor and obstruction size. 

Link to post
Share on other sites
19 hours ago, Grapjas said:

@Stan` would you be willing to put this into the base of the game? I think it's quite an important tool for map makers who want functional ridges without destroying their visuals. 

Well, I don't have objections to including a generic `template_obstruction.xml` in the public mod, provided it does not include more lines than strictly necessary. Have a look at the trigger points.

 

Link to post
Share on other sites
6 hours ago, Nescio said:

Well, I don't have objections to including a generic `template_obstruction.xml` in the public mod, provided it does not include more lines than strictly necessary. Have a look at the trigger points.

Would this be acceptable? 

Only 2 files total, 1 for each version.

obstruction.rar

I guess templates -> other, would be the best place for it, but i'll leave that to you.

Spoiler

image.thumb.png.a97c7aeebda87a8e3ae0d0a553463412.png

your code was more useful then anticipated @wowgetoffyourcellphone. I tried many other ways and failed.

 

Edited by Grapjas
Link to post
Share on other sites
2 hours ago, Grapjas said:

Would this be acceptable? 

Only 2 files total, 1 for each version.

obstruction.rar 1 kB · 1 download

I guess templates -> other, would be the best place for it, but i'll leave that to you.

  Hide contents

image.thumb.png.a97c7aeebda87a8e3ae0d0a553463412.png

your code was more useful then anticipated @wowgetoffyourcellphone. I tried many other ways and failed.

 

No problem! I could make a new actor using the wall model plus a loud neon color so the obstruction object is very obvious in Atlas what it is. Right now the map maker might forget what it is since it has the skin of a standard stone wall. 

Link to post
Share on other sites
1 hour ago, wowgetoffyourcellphone said:

No problem! I could make a new actor using the wall model plus a loud neon color so the obstruction object is very obvious in Atlas what it is. Right now the map maker might forget what it is since it has the skin of a standard stone wall. 

Yeah that would be helpful in some occassions like campaign maps. I'm interested in how you would do such a thing though, to learn from it. Which programs you use for the tasks etc.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...