[ X ]
Conditions Question
Post new topic   Reply to topic Page 1 of 1
View previous topic :: View next topic  
Author Message
OMnom
Level: 29


Position: Registered User
Joined: 28 Oct 2016
Posts: 199
Kel: 209  [ Donate ]

Online Status: Offline
PostPosted: Sun May 07, 2017 11:44 am    Post subject: Conditions Question Reply with quote

Currently playing around with the new conditions system -- absolutely loving it and it makes way more sense for your average noob modder ( aka me).

However, I do have one question...is there any to use the conditions system to give one unit 2 versions of the same trait? (i.e, an if/elseif condition?)

For example, lets say I gave tanks GrantConditionOnDeploy: DeployedConditioned: "block." and :UndeployedCondition:"mobile." Is there any way to make the speed = 40 when "block" is true, and the speed 75 when "mobile" is true?
Back to top
View user's profile Find all posts by OMnom Send private message ICQ Number
Graion Dilach
Level: 46



Position: Registered User
Joined: 15 May 2015
Posts: 194
Kel: 16  [ Donate ]

Online Status: Offline
PostPosted: Sun May 07, 2017 12:18 pm  Reply with quote

Speeds directly aren't conditionable like that due to being part of Mobile, but SpeedMultiplier is a way to go.

Assuming you set default speed to 75, you can then add a
Code:
SpeedMultiplier@deployed:
->RequiresCondition: block
->Modifier: 53 # 0.53*75 is 39.75, close enough.

block for such an effect. Mind you that during the deploy animation (if you use such) neither condition is applied! Which actually provides a nice example case to answer your main question, since the following block would stop the unit during the deploy animation:
Code:
SpeedMultiplier@deploying:
->RequiresCondition: !block && !mobile
->Modifier: 0


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 (WithSpriteTurret crashes when there are more than 1 Attack* trait on the actor, Mobile is limited to one trait instance, etc).

_________________
http://i.imgur.com/xVfhzis.png
http://i.imgur.com/kuuHd4s.pnghttp://i.imgur.com/6pDXsCS.png
http://i.imgur.com/n0J1wqE.pnghttp://i.imgur.com/IX8pBXZ.png

AS Discord server: https://discord.gg/7aM7Hm2
Back to top
View user's profile Find all posts by Graion Dilach Send private message Send e-mail ICQ Number
OMnom
Level: 29


Position: Registered User
Joined: 28 Oct 2016
Posts: 199
Kel: 209  [ Donate ]

Online Status: Offline
PostPosted: Mon May 08, 2017 8:00 am  Reply with quote

Thanks! SpeedMultiplier worked beautifully.

Last question regarding these conditions: can these conditions be applied to projectiles and missiles? I tried looking in the Traits wiki, but I couldn't find anything regarding weapons at all.
Back to top
View user's profile Find all posts by OMnom Send private message ICQ Number
abcdefg30
Level: 52


Position: Registered User
Joined: 18 Aug 2014
Posts: 205
Kel: 209  [ Donate ]

Online Status: Offline
PostPosted: Mon May 08, 2017 10:07 am  Reply with quote

You can enable/disable different armaments to give the unit different weapons. (For example nod-vehicles.yaml#L62-L69)
Back to top
View user's profile Find all posts by abcdefg30 Send private message ICQ Number
fernoe
Level: 92


Position: Registered User
Joined: 24 Sep 2005
Posts: 26
Kel: 29  [ Donate ]

Online Status: Offline
PostPosted: Mon May 15, 2017 1:20 pm  Reply with quote

you can give the unit two different weapons and use conditions to set which weapons is fired (so if you had two weapon, one shoots faster than the other)

so if you had

Armament@Condition1
RequiresCondition: condition1

Armament@Condition2
RequiresCondition: -condition1

(this code isn't 100% accurate, but I think it conveys the idea)

so the first weapon is active whenever condition 1 is being met and the second is active whenever condition 1 isn't being met (put negative sign before condition)
Back to top
View user's profile Find all posts by fernoe Send private message ICQ Number
OMnom
Level: 29


Position: Registered User
Joined: 28 Oct 2016
Posts: 199
Kel: 209  [ Donate ]

Online Status: Offline
PostPosted: Mon May 15, 2017 10:58 pm  Reply with quote

Hmm I see...yeah I was just trying to piece it together by analyzing how you guys wrote weapons.yaml, and that clarified a lot of it.
Back to top
View user's profile Find all posts by OMnom Send private message ICQ Number
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1