English How to change animal speed

7 replies
Goto Page
To the start Previous 1 Next To the start
08.09.18 02:51:42 am
Up
Fresh Software
Super User
Offline Off
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...
IMG:https://www.mediafire.com/convkey/a63a/8crqb654d54ocql6g.jpg
08.09.18 04:32:03 am
Up
Nova
User
Offline Off
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.
Hexenverbrennung, Inquisition, Kreuzzüge... Wir wissen, wie man feiert! - Ihre Kirche
08.09.18 05:33:27 am
Up
Fresh Software
Super User
Offline Off
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
IMG:https://www.mediafire.com/convkey/a63a/8crqb654d54ocql6g.jpg
09.09.18 05:02:46 am
Up
Nova
User
Offline Off
"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.
Hexenverbrennung, Inquisition, Kreuzzüge... Wir wissen, wie man feiert! - Ihre Kirche
09.09.18 05:36:14 am
Up
Fresh Software
Super User
Offline Off
Code:
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...
IMG:https://www.mediafire.com/convkey/a63a/8crqb654d54ocql6g.jpg
09.09.18 06:47:45 am
Up
Nova
User
Offline Off
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.
Hexenverbrennung, Inquisition, Kreuzzüge... Wir wissen, wie man feiert! - Ihre Kirche
10.09.18 08:15:00 pm
Up
Fresh Software
Super User
Offline Off
btw I don't do any hardcore programming. How do I fix this?
IMG:https://www.mediafire.com/convkey/a63a/8crqb654d54ocql6g.jpg
10.09.18 09:58:11 pm
Up
Nova
User
Offline Off
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:
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"?
Hexenverbrennung, Inquisition, Kreuzzüge... Wir wissen, wie man feiert! - Ihre Kirche
To the start Previous 1 Next To the start