Jump to content

Merchants always give gwent cards. A little help with scripting...


Cutflood

Recommended Posts

I've been trying to mod the quest_function.ws file to get all merchants to give you a random gwent card every time you win.

I've looked at a number of the mods available that are suppose to do just that but have been unable to get it to work just right.

 

I've gotten it to where they will always give you the one that they are suppose to give you the first time you play them.

But I don't care for 27 Young Berserkers.

 

I'm trying to make it so that you get one, completely random card from all available cards in the game. Even duplicates.

 

If anyone could give it a look see, that would be great. :D

-------------------------------------

alreadyGivenCount = FactsQuerySum(merchantTag + "_gwent_given");
quantity = Max(1, quantity - FloorF(alreadyGivenCount * 0.5f));
thePlayer.inv.AddAnItem(itemDef.itemName, quantity, true, false, true);
FactsAdd(merchantTag + "_gwent_given");
}
quest function GiveSpecificGwentCardViaMerchantQuest( merchantTag : name, cardName : name, disableCraftingComponentsIfGiven : bool )
{
var i: int;
if( FactsQuerySum( "merchant_card_" + merchantTag + "_card_already_given" ) >= 1 )
{
FactsAdd( "merchant_card_" + merchantTag + "_card_already_given", 0, -1);;
}
else
{
FactsAdd( "merchant_card_" + cardName + "_already_given", 1, -1 );
FactsAdd( "merchant_card_" + merchantTag + "_card_already_given", 1, -1);
thePlayer.inv.AddAnItem( cardName, 1, true, true);
}
}
quest function GiveMerchantRandomGwintCardToPlayerQuest( merchantTag : name )
{
var cards : array<name>;
var allCardsNames : array<name>;
var cardsAvailable : array<name>;
var selectedCard : name;
var i: int;
allCardsNames = theGame.GetDefinitionsManager().GetItemsWithTag(theGame.params.GWINT_CARD_ACHIEVEMENT_TAG);
for( i = 0; i < allCardsNames.Size(); i+=1 )
{
cards.PushBack(allCardsNames);
}
for( i = 0; i < cards.Size(); i+=1 )
{
if( FactsQuerySum( "merchant_card_" + cards + "_already_given" ) == 0 )
FactsAdd("merchante_card_"+cards+"_already_given",0,-1);
cardsAvailable.PushBack( allCardsNames );
}
if( cardsAvailable.Size() > 0 )
{
selectedCard = allCardsNames[ RandRange(allCardsNames.Size() - 1 ) ];
FactsAdd( "merchant_card_" + selectedCard + "_already_given", 1, -1 );
FactsAdd( "merchant_card_" + merchantTag + "_card_already_given", 1, -1);
thePlayer.inv.AddAnItem( selectedCard, 1, true, true);
}
}
quest function KillWithoutAgony( killTag : name )
{
----------------------------------------------------------------------------------------------------
Edited by Cutflood
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...