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


Position: Registered User
Joined: 28 Oct 2016
Posts: 254
Kel: 267  [ 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: 50



Position: Registered User
Joined: 15 May 2015
Posts: 210
Kel: 32  [ 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: 38


Position: Registered User
Joined: 28 Oct 2016
Posts: 254
Kel: 267  [ 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: 56


Position: Registered User
Joined: 18 Aug 2014
Posts: 238
Kel: 242  [ 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: 93


Position: Registered User
Joined: 24 Sep 2005
Posts: 31
Kel: 34  [ 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: 38


Position: Registered User
Joined: 28 Oct 2016
Posts: 254
Kel: 267  [ 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
OMnom
Level: 38


Position: Registered User
Joined: 28 Oct 2016
Posts: 254
Kel: 267  [ Donate ]

Online Status: Offline
PostPosted: Thu Jun 01, 2017 1:38 am  Reply with quote

I was trying to play around with the new conditions by giving sandbags BlocksProjectiles when an infantry unit is next to it. I can get the Blockable trait of the sandbags to turn on and off, but I can't seem to make the weapons switch and/or get the Blockable: false trait to work.
Code:
Rules:
    World:
        MissionData:
            Briefing: \n-Sandbags provide cover for infantry
    ^Infantry:
        ConditionManager:
        ExternalCondition:
            Condition: takecover
        ProximityExternalCondition:
            Condition: iscover
            Range: 2c0
    SBAG:
        ConditionManager:
        ProximityExternalCondition:
            Condition: takecover
            Range: 2c0
        BlocksProjectiles@SANDBAG:
            Height: 0c5
            RequiresCondition: iscover
        ExternalCondition:
            Condition: iscover
           
    E1:
        Armament@Primary:
            Weapon: M1Carbine
            RequiresCondition: !takecover
        Armament@TAKECOVER:
            Weapon: M1CarbineCover
            RequiresCondition: takecover
        Armament@GARRISONED:
            Weapon: Vulcan
            MuzzleSequence: garrison-muzzle
           
Weapons:
    M1CarbineCover:
        Projectile: Bullet
            Blockable: false
        ReloadDelay: 20
        Range: 5c0
        Report: gun11.aud
        Warhead@1Dam: SpreadDamage
            Versus:
                Wood: 25


Probably not the smartest way to write it, but it was a product of trial and error...i tried -takecover, -Blockable, switching the order of the armaments, and adjusting the height of BlocksProjectiles, but nothing seems to work. I know I'm missing something here, but I couldn't find any documentation on Weapon traits in the wiki, nor could I figure it out from reading weapons.yaml...
Back to top
View user's profile Find all posts by OMnom Send private message ICQ Number
Graion Dilach
Level: 50



Position: Registered User
Joined: 15 May 2015
Posts: 210
Kel: 32  [ Donate ]

Online Status: Offline
PostPosted: Sun Jun 04, 2017 9:23 pm  Reply with quote

Ciould you point me towards the testmap? I don't see anything wrong with this as-is.
_________________
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: 38


Position: Registered User
Joined: 28 Oct 2016
Posts: 254
Kel: 267  [ Donate ]

Online Status: Offline
PostPosted: Sun Jun 04, 2017 10:09 pm  Reply with quote

http://resource.openra.net/maps/21685/#

The lint checker on the resource site is going crazy, but the map runs without crashing. I have other maps that have that same error, but I don't know how to fix it.
Back to top
View user's profile Find all posts by OMnom Send private message ICQ Number
Graion Dilach
Level: 50



Position: Registered User
Joined: 15 May 2015
Posts: 210
Kel: 32  [ Donate ]

Online Status: Offline
PostPosted: Mon Jun 05, 2017 9:41 am  Reply with quote

Ahyeah, now I can see the problems.

Armament@Primary != Armament@PRIMARY - you basically allow the default M1Carbine be shot along with that setup.

The lint errors are because you added the ExternalCondition trait (which should have an @ID suffix for clarity IMO) to ^Infantry, but the consumers are only on E1 and the linter is completely valid that no other infantry utilizes it at the moment.

_________________
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: 38


Position: Registered User
Joined: 28 Oct 2016
Posts: 254
Kel: 267  [ Donate ]

Online Status: Offline
PostPosted: Tue Jun 13, 2017 10:17 pm  Reply with quote

I've tried messing around with it, making sure the conditions are right and that the logic is clear, but I can't spot the error because behavior is very strange. With my current setup, all the projectiles pass through the sand bag as long as the rifleman is standing 2c0 or farther. But when the rifle gets closer to the sandbag (conditions are true), the only armament that gets blocked is the M1Carbine and the M1Carbine clone -- all other projectiles (turret shots, flame turret shots, pillbox shots, etc) go past the sand bags.

I need to figure out this selective BlocksProjectiles for some other applications. In particular, when I gave tanks BlocksProjectiles, if the tank is moving forward and shooting forward (in the exact same direction), the tank sprite actually blocks its own turreted shot.
Code:
Rules:
    World:
        MissionData:
            Briefing: \n-Sandbags provide cover for infantry
    ^Infantry:
        ConditionManager: 
        ProximityExternalCondition@ISCOVER:
            Condition: iscover
            Range: 2c0
    SBAG:
        ConditionManager:
        ProximityExternalCondition@SWITCHGUN:
            Condition: switchgun
            Range: 2c0
        BlocksProjectiles@ISCOVER:
            Height: 0c5
            RequiresCondition: iscover
        ExternalCondition:
            Condition: iscover
           
    E1:         
        ExternalCondition@SWITCHGUN:
            Condition: switchgun
        Armament@PRIMARY:
            Weapon: M1Carbine
            RequiresCondition: !switchgun
        Armament@SWITCHGUN:
            Weapon: M1CarbineCover
            RequiresCondition: switchgun
        Armament@GARRISONED:
            Weapon: Vulcan
            MuzzleSequence: garrison-muzzle
           
Weapons:
    M1CarbineCover:
        Projectile: Bullet
            Blockable: false
        ReloadDelay: 20
        Range: 5c0
        Report: gun11.aud
        Warhead@1Dam: SpreadDamage
            Versus:
                Wood: 25




Also a couple more questions...

How is ReturnFire calculated with the RevealsShroud@GAPGEN? When I tested this, if the unit was hidden by the gap generator (enemy does not see this unit) and it fired on an enemy, that enemy would immediately return fire even though this unit is completely hidden by the Gap Generator.

Also, is there any way to create a clone of the GPS power that reveals the surrounding area around an actor, rather than the entire map?
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