Forum

> > Stranded II > Scripts > How to change animal speed
Forums overviewStranded II overview Scripts overviewLog in to reply

English How to change animal speed

7 replies
To the start Previous 1 Next To the start

old How to change animal speed

ModJuicer
Super User Off Offline

Quote
I still can't change animal speeds in single gameplay dispite many attempts. Blood rush doesn't count because it is not variable and I need more than 2x speed. It doesn't seem to show how to do this in the s2 commandlist either. Please help...

old Re: How to change animal speed

Nova
User Off Offline

Quote
I think you can't change the speed of a unit directly in a map. You would have to change the value in the units.def file, but that changes the speed of every instance of this unit type.
You could create a new unit type, copy all the old stuff and just change the speed value there.

Ingame you can still use the blood rush state because it is indeed variable - give the unit the state and then change the value of it with s2 cmd statevalue. A value of 3 would triple the speed of this unit.

old Re: How to change animal speed

ModJuicer
Super User Off Offline

Quote
Thanks. I knew about the I could alter a state value in single, I just didn't know the script to use. See ya
Edit: the code isn't working. Help? Can you plz give me a code that will work...
edited 1×, last 08.09.18 10:31:06 pm

old Re: How to change animal speed

Nova
User Off Offline

Quote
"The code isn't working"... well, we have no idea what code because you didn't post it.

Yes, I could give you a working code example, but I don't want to do that. It's better if you actually learn how to write good and working scripts. I make you an offer: you post your present work for this and we will give you strong hints where the problem is.

old Re: How to change animal speed

ModJuicer
Super User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
on:load
{
	  loop("units", 5)
	  {
			 $loop_id = loop_id();

			 addstate 17, "unit", $loop_id;
			 addstate 9, "unit", $loop_id;
			 statevalue 9, "unit", $loop_id:
	  }
}
This code. Thanks...

old Re: How to change animal speed

Nova
User Off Offline

Quote
Take another look at s2 cmd addstate. In what order are the parameters listed there? The first two are the same as for many other commands. Which parameter is the state you want to add to the unit?
The same is true for s2 cmd statevalue.

Oh, and you don't need to do that with on:load, but with on:start. States are saved together with the unit, so the game will automatically add them again after you load a save. This is not really important for this script I believe, but I should still mention it.

old Re: How to change animal speed

Nova
User Off Offline

Quote
Take a look at the commands I linked to in my answer. There is a very specific order of parameters you have to follow, otherwhise the game won't do what you want it to do. Let's look at s2 cmd addstate:
Quote
addstate "Class", ID, "State"

The game wants as parameters a class type, an ID and a state. Now take a look at the first line with addstate in your code:
1
addstate 17, "unit", $loop_id;
You tell the game 17, then "unit" and finally the current value of the loop ID. It will now interpret the 17 as a class type, the "unit" as a unit ID and then the value of the loop as the state it shall add.

That doesn't make much sense, does it? What is the class type 17? What unit has the ID "unit"?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview