• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Loan shark add

Tyrant1442

Landlubber
First up, apologies if this has been raised before, I did try searching for something similar, but there was no related posts.

I took a loan, totally forgot about it, then was stumped why my rep was so bad and no one would talk to me.
Now I have to plunder the entire continent now to pay the church to reverse the rep.

I dont know anything about modding, but would it be do-able, say, when you take a loan an entry is made in the journal, stating where and how much is owed?

I know I could write it down, but I would only lose that too.
 
Yep it would be very possible to do that :yes

Im actually suprised it hasnt been included :shrug

I may do it myself for the next patch ;)
 
Yes, that would definitly be a good idea.
And as Captain Maggee says, quite easily done too.
I hope you can get that sorted, Cap'n! :woot
 
Turns out this is harder than I thought it would be :facepalm

I thought I had the code right to get it to work but it doesnt :modding
 
Code:
		        PlayStereoSound("INTERFACE\took_item.wav");
AddMoneyToCharacter(Pchar, makeint(Pchar.Quest.Loans.(NPC_Area).Sum));
// Pagliarini -->
Pchar.Quest.Loans.(NPC_Area).TotalSum = makeint(Pchar.Quest.Loans.(NPC_Area).TotalSum) + makeint(Pchar.Quest.Loans.(NPC_Area).Sum);
Log_SetStringToLog(XI_ConvertString("Total Loan") + " " + makeint(Pchar.Quest.Loans.(NPC_Area).TotalSum));
iLoanAmmount = sti(Pchar.Quest.Loans.(NPC_Area).TotalSum);
//Pagliarini <--
Pchar.Quest.Loans.(NPC_Area) = true;
Pchar.Quest.Loans.(NPC_Area).StartDay = getDataDay();
Pchar.Quest.Loans.(NPC_Area).StartMonth = getDataMonth();
Pchar.Quest.Loans.(NPC_Area).StartYear = getDataYear();
Pchar.Quest.Loans.(NPC_Area).StartTime = getTime();

Pchar.quest.(NPC_Area).win_condition.l1 = "Timer";
Pchar.quest.(NPC_Area).win_condition.l1.date.day = getDataDay();
Pchar.quest.(NPC_Area).win_condition.l1.date.month = getDataMonth() + makeint(Pchar.Quest.Loans.(NPC_Area).Period);
Pchar.quest.(NPC_Area).win_condition.l1.date.year = getDataYear();
Pchar.quest.(NPC_Area).win_condition = "Loans_" + (NPC_Area); // KK

// KK -->
Preprocessor_AddQuestData("town", XI_ConvertString(FindTownName(NPC_Area)));
Preprocessor_AddQuestData("island", XI_ConvertString(FindIslandName(GetIslandIDFromTown(NPC_Area)))); // PB
Preprocessor_AddQuestData("ammount", iLoanAmmount);
Preprocessor_AddQuestData("deadline", GetHumanDate(sti(Pchar.quest.(NPC_Area).win_condition.l1.date.year), sti(Pchar.quest.(NPC_Area).win_condition.l1.date.month), sti(Pchar.quest.(NPC_Area).win_condition.l1.date.day))); 
Preprocessor_AddQuestData("loanshark", XI_ConvertString(NPchar.id));
DeleteQuestHeader("Loan");
SetQuestHeader("Loan");
AddQuestRecord("Loan", 1);
Preprocessor_Remove("town");
Preprocessor_Remove("island"); // PB
Preprocessor_Remove("ammount");
Preprocessor_Remove("deadline");
Preprocessor_Remove("loanshark");
// <-- KK
That is the code I have used for this textbook entry
Code:
title=Borrowed money off of #sloanshark#.
text.t1=I've borrowed #dammount# gold off of the loanshark in #stown# on #sisland# and need to pay it back by the #sdeadline#.

The questbook entry and header just dont get added and it is in a place where it should :facepalm
 
I just tested it and it's actually working quite nicely for me!
Did you put the loan.txt file in RESOURCE\INI\TEXTS\ENGLISH\QUESTBOOK?
That's where I put it and it works. :yes

Some things you might need to look into:
- I changed the "loanshark" name code to this: Preprocessor_AddQuestData("loanshark", GetMySimpleName(NPChar));
- Questbook entry isn't yet removed when you repay your debt.
- What if you get multiple loans at the same time from different loansharks?
You'd only get a questbook entry for the last loan you took, right?
Might be tricky to fix though without giving each loanshark his own questbook file.
 
Ive got it working quite nicely now ;)

Ive got it set up to record multiple loans as well, but I need a new questbook function (RemoveQuestRecord) and then it will be PERFECT
 
RemoveQuestRecord? I think I understand what you want.
Might be a bit tricky though, because how does the game know which quest record you want to remove?
I imagine that'd be based on the order in which you took the loans.
 
I have got it set up now so it will know which questrecord it is so if we can have the function like add but instead remove
eg RemoveQuestRecord("Loan", 1); to remove questbook entry 1
 
Are the function definitions somewhere around? In PROGRAM\QUESTS, most likely, if they're there.
If so, there's a chance you can do it. If not, then you might need to figure out something else.
 
Yep it is in PROGRAM\Quests... Hopefully it wont be to tricky to just pretty much reverse a current function :shrug
 
Why don't you add a simple imperfect version?
And maybe limit the player to one loan only, which seems quite fair to me anyway.
Then it won't be so complicated anymore.
 
Do you still have the code to include it? I had the simple version (almost?) working in my game version,
but then my laptop died and now I don't know if/when I'll have access to those files again.
 
Back
Top