Playing around with speedmultiplier

Information and discussion for custom maps and mods.
Post Reply
Blackened
Posts: 310
Joined: Sat May 21, 2016 6:27 pm

Playing around with speedmultiplier

Post by Blackened »

I've been trying to find a way to make transports lose 5% speed per 3 passengers.

Code: Select all

LST:
->cargo:
->->loadedCondition:
->SpeedMultiplier@L1:
->->RequiresCondition: Loaded >= 3 
->->Modifier: 95
->SpeedMultiplier@L2:
->->RequiresCondition: Loaded >= 6 
->->Modifier: 95
->SpeedMultiplier@L3:
->->RequiresCondition: Loaded >= 9 
->->Modifier: 95
->SpeedMultiplier@L4:
->->RequiresCondition: Loaded >= 12
->->Modifier: 95
But this results in two different tiers remaining the same speed. I've tried isolating each level so that only one trait is active at a time but that doesn't seem to work at all.


Graion Dilach wrote:To put it more bluntly: traits which support multiple instances can be used as an if/elseif situation, with each "else statement" would be provided through separate trait instances. However condition support != multiple traits support, there are a few conditionable traits which can't have multiple instances without bugs/crashes
Graion Dilach said this in a omnom thread that also brought up speedmultiplier. Is this a case of traits having bugs with multiple instances? Or is there potential for a work around?

fernoe
Posts: 28
Joined: Sat Sep 24, 2005 10:21 pm

Re: Playing around with speedmultiplier

Post by fernoe »

Blackened wrote:

Code: Select all

LST:
->cargo:
->->loadedCondition:
->SpeedMultiplier@L1:
->->RequiresCondition: Loaded >= 3 
->->Modifier: 95
->SpeedMultiplier@L2:
->->RequiresCondition: Loaded >= 6 
->->Modifier: 95
->SpeedMultiplier@L3:
->->RequiresCondition: Loaded >= 9 
->->Modifier: 95
->SpeedMultiplier@L4:
->->RequiresCondition: Loaded >= 12
->->Modifier: 95
Shouldn't it be this

Code: Select all

LST:
->cargo:
->->loadedCondition:
->SpeedMultiplier@L1:
->->RequiresCondition: Loaded >= 3 
->->Modifier: 95
->SpeedMultiplier@L2:
->->RequiresCondition: Loaded >= 6 
->->Modifier: 90
->SpeedMultiplier@L3:
->->RequiresCondition: Loaded >= 9 
->->Modifier: 85
->SpeedMultiplier@L4:
->->RequiresCondition: Loaded >= 12
->->Modifier: 80
Or possibly this

Code: Select all

LST:
->cargo:
->->loadedCondition:
->SpeedMultiplier@L1:
->->RequiresCondition: Loaded >= 3, !Loaded >= 6 
->->Modifier: 95
->SpeedMultiplier@L2:
->->RequiresCondition: Loaded >= 6, !Loaded >= 9 
->->Modifier: 90
->SpeedMultiplier@L3:
->->RequiresCondition: Loaded >= 9, !Loaded >= 12  
->->Modifier: 85
->SpeedMultiplier@L4:
->->RequiresCondition: Loaded >= 12
->->Modifier: 80
?



pretty sure all the code you've put is just saying "if this condition is met, go 95% speed"

Frame_Limiter
Posts: 22
Joined: Tue Feb 16, 2016 4:55 pm

Re: Playing around with speedmultiplier

Post by Frame_Limiter »

Blackened wrote: But this results in two different tiers remaining the same speed. I've tried isolating each level so that only one trait is active at a time but that doesn't seem to work at all.
You're not seeing any change in speed because there is no difference between speeds 113 and 107 (95%).
If you want to check this try creating a duplicate transport but with speed 107, you'll notice it's the same speed as the 113 transport.

Some LST speed windows:
[103-113]
[94-102]
[86-93]
[79-85]
[74-78]
[69-73]

Blackened
Posts: 310
Joined: Sat May 21, 2016 6:27 pm

Post by Blackened »

Speedmultiplier stacks with previous ones. So with the 95--80 the final speed is actually 58% of the instead of 80.

I haven't tried that second option as I was using && by recommendation from Sircake but that didn't work. I'll try it with ! and see if I get any results.

User avatar
Graion Dilach
Posts: 274
Joined: Fri May 15, 2015 5:57 pm

Post by Graion Dilach »

The multipliers support multiple trait instances.

Code: Select all

LST: 
->cargo:
->->LoadedCondition: Loaded
is what's missing from what I'd guess. The game doesn't know what the "Loaded" condition would be otherwise. If I'm correct that will fix the OP setup.

The other setup - condition expressions doesn't support commas, you need to use && for the and condition, so it should look like Loaded >= min && Loaded < max.
Image
Image
Image
AS Discord server: https://discord.gg/7aM7Hm2

Blackened
Posts: 310
Joined: Sat May 21, 2016 6:27 pm

Post by Blackened »

Oops sorry I have LoadedCondition: Loaded just didn't transcribe that.

I've tried the min max but it doesn't work.

Blackened
Posts: 310
Joined: Sat May 21, 2016 6:27 pm

Post by Blackened »

trrrriiiippppllllleeeeeeeeeee post.
Last edited by Blackened on Mon Jun 05, 2017 6:29 am, edited 1 time in total.

Blackened
Posts: 310
Joined: Sat May 21, 2016 6:27 pm

Re: Playing around with speedmultiplier

Post by Blackened »

Frame_Limiter wrote: You're not seeing any change in speed because there is no difference between speeds 113 and 107 (95%).
If you want to check this try creating a duplicate transport but with speed 107, you'll notice it's the same speed as the 113 transport.

Some LST speed windows:
[103-113]
[94-102]
[86-93]
[79-85]
[74-78]
[69-73]
This seems to be the root of the problem. I couldn't create a duplicate LST because the code refuses to cooperate (looking at you mysterious idle sequence)

I'd set the speed to 105 as the default was way too fast.
And so it would be:
105 (empty)
99.75(100 or 99)
94.5(95 or 94)
89.25(90)
84

As you said there is no difference between 100-94. I'll have to find another work around :(

Frame_Limiter
Posts: 22
Joined: Tue Feb 16, 2016 4:55 pm

Post by Frame_Limiter »

105 is the same speed as 113 :) -- You need to set it to 102.

Your modifier needs to target a number within a different speed window or you'll simply end up with the same speed again.

113 - 10% = 101 (within the 94-102 range)
->SpeedMultiplier@L1:
-->Modifier: 90

To duplicate the transport:
LST.102:
->Inherits: LST
->RenderSprites:
-->Image: LST
->Buildable:
-->Description: LST-102
->Mobile:
-->Speed: 102
->Tooltip:
-->Name: Transport-102

Blackened
Posts: 310
Joined: Sat May 21, 2016 6:27 pm

Post by Blackened »

You're a saint if I haven't told you that yet.

Post Reply