Jump to content

What ways can cvar be set?


Orphen

Recommended Posts

I recently started working with the cvar for a mod but having it be set by the item I'm altering is turning into a problem.  Is there a way to have the a cvar set by some other related method? Trying to make the various magazines allow you the option of Read or Use. Read gives a quest that grants 1 skill point but I only want it to work once.  With the cvar being set by the objects normal use it gives it some quirky issues. If you use a copy of a magazine before you have read a copy you can never read it.  if you read it first, you get the skill point and can still use 1 time to learn the recipe, but cannot use additional copies for the XP.

 

If possible I would like the cvar to be set by the completion of the quest instead of by the use of the item. or have it be set by Action1.  I tried a few ways to move the effect_group function to the action1 and to the quest but they have all met with failure.  Is this something I can actually do?

Link to comment
Share on other sites

 

17 hours ago, convergent said:

If it helps, I have an item (candy cane club, for lols) that when you use the primary action it increments a cvar, and secondary action decrement it. I use this to test cvars on the fly.

If you just add some requirement conditions you can really do a lot.

Oh your mod sounds like exactly what I was looking for. I was trying to tie the cvar change to a specific action of the item but I couldn't find an example of an item that did that. Do you happen to have a link to download it somewhere or can you post the action coding.

Link to comment
Share on other sites

Here you go - I tried to strip out references to my stuff that would not be valid but it should work just fine. I could test later if needed. The item just increases or decreases a Cvar and there is a bit of buff code to show how to display the cvar. 

 

As far as quests only rewarding items, if you want a super hokey workaround you could make a quest reward a follow up quest that is auto accepted without a confirmation. That quest could trigger an event similar to the challenge quests triggering spawns etc. I am not sure what the limitations are but it is the only way that I can think of to avoid having an item that needs to be read/consumed.

 

<item name="TESTCvarClub"> <!-- USED TO INCREASE OR DECREASE A CVAR -->
    <property name="CustomIcon" value="meleeWpnClubT1CandyClub"/>
    <property name="Tags" value="blunt,club,melee,grunting,light,longShaft,perkFlurryOfBlows,weapon,meleeWeapon,attStrength,perkPummelPete,canHaveCosmetic"/>
    <property name="DisplayType" value="melee"/>
    <property name="Group" value="Ammo/Weapons"/>
    <property name="Meshfile" value="#Other/Items?Weapons/Melee/Candycane/candycanePrefab.prefab"/>
    <property name="HoldType" value="2"/>
    <property name="Material" value="Mmetal"/>
    <property name="RepairTools" value="resourceRepairKit"/>
    <property name="SoundDestroy" value="wooddestroy1"/>
    <property name="RepairExpMultiplier" value="5.5"/>
    <property name="EconomicBundleSize" value="1"/>
    <property name="EconomicValue" value="350"/>
    <property name="FuelValue" value="250"/>
    <property name="ShowQuality" value="true"/>
    <property class="Action0">
        <property name="Class" value="Melee"/>
        <property name="Delay" value=".1"/>
        <property name="Range" value="1.65"/>
        <property name="Sphere" value=".1"/>
        <property name="Block_range" value="2.5"/>
        <property name="DamageEntity" value="10"/>
        <property name="DamageBlock" value="16"/>
        <property name="Sound_start" value="swoosh"/>
    </property>
    <property class="Action1">
        <property name="Class" value="Melee"/>
        <property name="Delay" value=".1"/>
        <property name="Range" value="1.65"/>
        <property name="Sphere" value=".1"/>
        <property name="Block_range" value="2.5"/>
        <property name="DamageEntity" value="10"/>
        <property name="DamageBlock" value="16"/>
        <property name="Sound_start" value="swoosh"/>
    </property>
    <effect_group tiered="false">
        <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="myCvar" operation="add" value="1"/>
        <triggered_effect trigger="onSelfSecondaryActionEnd" action="ModifyCVar" cvar="myCvar" operation="add" value="-1"/>
    </effect_group>
</item>

    <buff name="showMyCvarBuff" icon="ui_game_symbol_destruction2" remove_on_death="false">
        <stack_type value="ignore"/>
        <update_rate value="1"/>
        <display_value value="myCvar"/>
        <display_value_key value="Your Text {0:0.00}"/>
        <effect_group tiered="false">
            <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="myCvar" operation="set" value="20"/>
            <triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="myCvar" operation="add" value="-0.1">
                <requirement name="CVarCompare" cvar="myCvar" operation="GTE" value="0"/>
            </triggered_effect>
            <triggered_effect trigger="onSelfBuffUpdate" action="AddBuff" buff="buffStatusHungry01">
                <requirement name="CVarCompare" cvar="myCvar" operation="LT" value="15"/>
                <requirement name="CVarCompare" cvar="myCvar" operation="GTE" value="10"/>
                <requirement name="NotHasBuff" buff="buffStatusHungry01"/>
            </triggered_effect>
            <triggered_effect trigger="onSelfBuffUpdate" action="AddBuff" buff="buffStatusHungry02">
                <requirement name="CVarCompare" cvar="myCvar" operation="LT" value="10"/>
                <requirement name="CVarCompare" cvar="myCvar" operation="GTE" value="5"/>
                <requirement name="NotHasBuff" buff="buffStatusHungry02"/>
            </triggered_effect>
            <triggered_effect trigger="onSelfBuffUpdate" action="AddBuff" buff="buffStatusHungry03">
                <requirement name="CVarCompare" cvar="myCvar" operation="LT" value="5"/>
                <requirement name="NotHasBuff" buff="buffStatusHungry03"/>
            </triggered_effect>
            <triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffStatusHungry01">
                <requirement name="CVarCompare" cvar="myCvar" operation="GTE" value="15"/>
                <requirement name="HasBuff" buff="buffStatusHungry01"/>
            </triggered_effect>
            <triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffStatusHungry01">
                <requirement name="CVarCompare" cvar="myCvar" operation="LT" value="10"/>
                <requirement name="HasBuff" buff="buffStatusHungry01"/>
            </triggered_effect>
            <triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffStatusHungry02">
                <requirement name="CVarCompare" cvar="myCvar" operation="GTE" value="10"/>
                <requirement name="HasBuff" buff="buffStatusHungry02"/>
            </triggered_effect>
            <triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffStatusHungry02">
                <requirement name="CVarCompare" cvar="myCvar" operation="LT" value="5"/>
                <requirement name="HasBuff" buff="buffStatusHungry02"/>
            </triggered_effect>
            <triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffStatusHungry03">
                <requirement name="CVarCompare" cvar="myCvar" operation="GTE" value="5"/>
                <requirement name="HasBuff" buff="buffStatusHungry03"/>
            </triggered_effect>
        </effect_group>        
    </buff>

Link to comment
Share on other sites

  • 4 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...