
Forum




How to change animal speed
7 replies




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


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
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.

1
2
3
4
5
6
7
8
9
10
11
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: 	 } }


The same is true for

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.



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;
That doesn't make much sense, does it? What is the class type 17? What unit has the ID "unit"?




