Jump to content


Photo

Is it possible to toggle move_to_min_combat_range ingame with an ability?


6 replies to this topic

#1 sam_hamwitch

sam_hamwitch
  • Members
  • 7 posts

Posted 01 September 2020 - 10:13 AM

I was wondering if I could make a toggleable ability that I could add to the taskbar that turns move_to_min_combat_range on and off. The issue is, can I make a modifier that targets that specific thing? There's nothing in the current modifiers list that seems to do it? Can you add new ones, or is that hardcoded?

 

Just thought I'd ask. I thought it'd be a nice little feature to give players a bit more control over the behaviour of their units. 



#2 Gambit

Gambit

    title available

  • Members
  • 6,661 posts
  • Location:Athens, Greece

Posted 01 September 2020 - 10:40 AM

I was wondering if I could make a toggleable ability that I could add to the taskbar that turns move_to_min_combat_range on and off.

You cannot, as far as I know.

> The 1st alternative is ugly: You must make a timed ability (toggleable WON'T work, trust me) that utilities the SoB weapon_change trick (the one they use when firing their "golden" weapons). And have  the 2nd weapon, identical, but with closer range.

> The 2nd alternative is SCaR, and it is difficult. It will do what you ask. Possibly, with 100% efficiency - I do not know what you are asking EXACTLY...

 

The issue is, can I make a modifier that targets that specific thing?

Ah, selective targeting.

It WAS implemented, but the engine does not use it - I believe it totally ignores it, but I am not certain.

Selective targeting is not possible - at least not seamlessly. Even with HEAVY SCaR, you are going to have issues.

The AI can definitelly solve some issues, but it is very time-consuming to code.

 

There's nothing in the current modifiers list that seems to do it? Can you add new ones, or is that hardcoded?

Regrettably, Modifiers are hard-coded. :thumbsdownsmiley:

The same is true with Requirements.

You cannot create new.

 

Sorry brother sam_hamwitch, I know,bad news.


-In search of Papasmurf...

#3 sam_hamwitch

sam_hamwitch
  • Members
  • 7 posts

Posted 02 September 2020 - 07:43 AM

Thanks for the advice!

I'll try and be a bit more specific about what I wanted to do. I'm assuming that move_to_min_combat_range makes the unit move into range of its shortest range weapon when an attack order is given? What I wanted to do was create a generic ability that I could add to the unit control panel for different units that would flip move_to_min_combat_range on and off.

The usage would be something like this: you have a marine squad with a flamer. You want the squad to engage with the flamer when an attack order is given, so you flick the toggle to the 'true' setting. Later you decide that it would be better if they stayed back and engaged with bolters, so you flip the toggle to 'false' and now when you order an attack they move to bolter range.

Anyway, it sounds like I would need to use SCaR to get it working properly, so this is probably more of a longer term project. But thanks for giving me a hint on how to proceed :)

#4 Gambit

Gambit

    title available

  • Members
  • 6,661 posts
  • Location:Athens, Greece

Posted 02 September 2020 - 09:04 AM

What I wanted to do was create a generic ability that I could add to the unit control panel for different units that would flip move_to_min_combat_range on and off.

No modifier to change that variable, so... Impossible.

As I said, there are alternatives - like SCaR. But all, require some serious work.

 

 

You want the squad to engage with the flamer when an attack order is given, so you flick the toggle to the 'true' setting. Later you decide that it would be better if they stayed back and engaged with bolters, so you flip the toggle to 'false' and now when you order an attack they move to bolter range.

Dammit, this is something that I also encountered - with the melta weapons. They are also short-ranged, so what you suggested makes perfect sense.

But my time is limited, and I cannot afford to code it... There are both SCaR and AI parts, so it will require much time to do it right.

For now we must accept what we have :mellow:


-In search of Papasmurf...

#5 sam_hamwitch

sam_hamwitch
  • Members
  • 7 posts

Posted 02 September 2020 - 09:07 PM

Are you saying that without the modifier it's impossible to make it work with move_to_min_combat_range at all? I thought maybe it would be possible to use SCaR to flip the variable instead of a modifier, but then I don't actually know how to use SCaR yet lol.

This is still something that I'd like to do, but I'll have to revisit it in a few months. If I make any progress I'll let you know :)

#6 Moreartillery

Moreartillery
  • Members
  • 181 posts
  • Projects:Cinematic Battles

Posted 03 September 2020 - 02:37 AM

The usage would be something like this: you have a marine squad with a flamer. You want the squad to engage with the flamer when an attack order is given, so you flick the toggle to the 'true' setting. Later you decide that it would be better if they stayed back and engaged with bolters, so you flip the toggle to 'false' and now when you order an attack they move to bolter range.

Doesn't stand ground / hold position do that already? They may not match min combat range perfectly, but its very close to what your asking for.


Developer of the Cinematic Battles mod.

https://www.moddb.co...nematic-battles


#7 Gambit

Gambit

    title available

  • Members
  • 6,661 posts
  • Location:Athens, Greece

Posted 03 September 2020 - 07:25 AM

Are you saying that without the modifier it's impossible to make it work with move_to_min_combat_range at all? I thought maybe it would be possible to use SCaR to flip the variable instead of a modifier, but then I don't actually know how to use SCaR yet lol.

Well, without a modifier, you cannot! 

To change a stat on the game you need an existing modifier. And as you said, there is no modifier that changes the move_to_min_combat_range value, for entities.

And SCaR cannot change that either.

 

But with SCaR, you can try alternatives. For example:

1] See if the unit is using the ability.

2] If yes, then see if the distance from target is the minimum required.

3] If not, then find the vector difference, and then find the new min range x,z coordinates and give the squad the command to move there, IF the target remains the same.

It is "relatively" easy to do for someone with SCaR knowledge (although finding the original target, and target swapping will indeed be a challenge to code properly).

 

I think you must ditch it for now...


-In search of Papasmurf...



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users