Jump to content

Running, charging, stamina and stances (with a bit of formations)


Karamel
 Share

Recommended Posts

  On 19/05/2019 at 11:24 PM, asterix said:

Look at the section formations https://trac.wildfiregames.com/wiki/Alpha23

Expand  

Is says that the speed bonus is removed, is that what you are referring to? Because I tried to let units actually run in the formations (visualise an awesome cavalry charge) but, strangely, they only slow down when I try to use the run speed.

  On 20/05/2019 at 10:39 AM, (-_-) said:

What kind of information do you need from the hyrule code? (I talked to exo and while he did adapt it, the core concept remains the same)

Expand  

Well, I don't *need* anything, but I'm just curious :) I wanted to see what code they used for the different steps, but if it is basically the same it is okay.

Link to comment
Share on other sites

Formation.prototype.Run = function()
{
	let maxSpeed = 0;

	for (let ent of this.members)
	{
		let cmpUnitMotion = Engine.QueryInterface(ent, IID_UnitMotion);
		if (cmpUnitMotion) {
			if (maxSpeed == 0)
				maxSpeed = cmpUnitMotion.GetRunMultiplier();
			else
				maxSpeed = Math.min(maxSpeed, cmpUnitMotion.GetRunMultiplier());
		}
	}
	maxSpeed *= this.GetSpeedMultiplier(); <- apply formation speed multiplier

	this.speed = maxSpeed * this.minSpeed; <- this.minSpeed is minimal walking speed of formation
	this.running = true;

	let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
	cmpUnitMotion.SetSpeedMultiplier(this.speed);
}

I use something like this

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

  • 2 months later...
  On 23/07/2019 at 12:42 AM, Lion.Kanzen said:

Now is possible ? Or we need more pathfinder changes?

Expand  

Well, my solution was neither regarding the pathfinder nor UnitMotion, it was regarding a function in Formation.js.

  Reveal hidden contents

 

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
  On 23/07/2019 at 6:36 AM, Freagarach said:

Well, my solution was neither regarding the pathfinder nor UnitMotion, it was regarding a function in Formation.js.

  Reveal hidden contents

 

Expand  

But how will work for the user, a hotkeys or mouse command?

Link to comment
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.

 Share

×
×
  • Create New...