• 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!

Editing characters_init.c for better weapons in Build v11.

kgsuarez

Powder Monkey
Hello everyone.

I have been messing around with a lot of the config files of POTC for almost an hour. I have played around with "items.h" and "characters_init.h" and I am a little bit lost. What I want to do is start out a new game with certain weapons and items.

Can anyone please explain to me what I have to do in order to start a new game with the weapons and spyglass of my choice?

Thanks in advance.
 
Find the end of the ch start properties
It'll be something like
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->SetCharacterGoods(&Characters[0],GOOD_BOMBS,GetCannonQuantity(ch)*BOMBS_PER);

    // NK <--<!--c2--></div><!--ec2-->
I forget which good is last.
After that, add
GiveItem2Character(ch, ITEMID);
where itemID is the ID of the item you want to start with. Add more lines like that if you have multiple items you want to add.
(an item ID is something like "blade5+1" or "spyglass3")
This assumes you have the weaponsmod turned on (it defaults to on). If not, omit the +x or -x on the end of blade and gun item IDs.

See inititems.c for a list of all item IDs (well, a list of all _Base_ itemids for blades and guns; due to the new quality system, they're modified like so:
"`itemid-2`" = worst
-1
"itemid" = average
"itemid+1" = good
+2 = fine
+3 = excellent.

note it's "blade5+2" not "blade7" though. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
Are you sure that section is for items? It looks like it's only for cargo on your ship.

I played around some more and I found that a section towards the top is commented out. Something like . . .

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->string stmp;

stmp = POTION; Ch.items.(stmp) = 2;<!--c2--></div><!--ec2-->

It's in the "charaters_init.c" somewhere. It doesn't look like exactly like that though. There are more lines. I just replaced stuff like "POTION" or "GUN_COMMON" with stuff like "GOOD_GUN" or "GOOD_SWORD". The program looks for these name in the "items.h" file. So you just add lines like "#define GOOD_GUN "pistol4"".

What I did is working. But all my items are of average quality. So I am going to try adding the "+3" thing.
 
GiveItem2Character is just a function; you can place it anywhere as long as the reference passed to it, ch, points to the main character.

Actually, if you change it to GiveItem2Character(GetMainCharacter(), "itemid");

you can place it _anywhere at all_, as long as the block of code it's in executes on initialization.

So, you could put it in locations init, or in ships_init, or wherever. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

But, yes, what you're talking about works too, so good work figuring it out! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />

{There is one slight problem: that way, you address the items attribute directly; if we ever _change_ the way items are tracked, i.e. add multiple inventories as we've kicked around elsewhere here, you'll need to use a function "`front-end`" like giveitem2character.}

You see, items right now are tracked as character (in this case the reference variable ch).items.ITEMID where item id is the ID of the item.
So if you add the line
ch.items.pistol4 = 2, you are saying, make the quantity of item "pistol2" carried by character ch 2.
(No need to use string variables in () in this case)
The need for defines come if you add the + or -, as you can't have that "standing naked" in the attribute (i.e. you can't do ch.items.pistol4+2 = 2 because the program will interpret that as trying to add 2 to the _value_ of the attribute ch.items.pistol4).
Same as if you start an attribute name with a number, you need to set it to a string variable and then address the attribute as string somevar = "something+somethingelse"; object.(somevar) = x;, like you see there.

Hope that makes sense. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
<!--`QuoteBegin-NathanKell`+--><div class='quotetop'>QUOTE(NathanKell)</div><div class='quotemain'><!--QuoteEBegin-->Find the end of the ch start properties
It'll be something like
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->SetCharacterGoods(&Characters[0],GOOD_BOMBS,GetCannonQuantity(ch)*BOMBS_PER);

    // NK <--<!--c2--></div><!--ec2-->
I forget which good is last.
After that, add
GiveItem2Character(ch, ITEMID);
where itemID is the ID of the item you want to start with. Add more lines like that if you have multiple items you want to add.
(an item ID is something like "blade5+1" or "spyglass3")
This assumes you have the weaponsmod turned on (it defaults to on). If not, omit the +x or -x on the end of blade and gun item IDs.

See inititems.c for a list of all item IDs (well, a list of all _Base_ itemids for blades and guns; due to the new quality system, they're modified like so:
"`itemid-2`" = worst
-1
"itemid" = average
"itemid+1" = good
+2 = fine
+3 = excellent.

note it's "blade5+2" not "blade7" though. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />[/quote]

+3 excellent? I didn't know there are also excellent blades. The best i've seen is "fine".
 
They can't be bought.
Or found randomly either, IIRC; they can only be cheated. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/diomed.gif" style="vertical-align:middle" emoid=":dio" border="0" alt="diomed.gif" />
 
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Or found randomly either, IIRC; they can only be cheated.<!--QuoteEnd--></div><!--QuoteEEnd-->

I did find a couple of "exellent" blades, Nathan, in the random locations, but I think my level, over one hundred, may have had something to do with it because I had never located them previously.
I have never found an "exellent" pistol.

I made a little "mod" where you can gain an "exellent" sword and pistol after successfully completing a governor's pirate mission, but I wanted to get permission from Verruct and Scheffnow before I released it to the site, (I sent them PMs, but haven't heard back.) because I'm under the impression that I'm incorporating mods that both of them put together.

I love the effect that someone put into the "exellent" blades! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
I stand corrected. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
Ah, neat idea!

You may want to try email rather than PM; I don't think either of them stops by here much...and kudos to you sir for asking first! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Nathan,

I've been looking at the read me for Build 11 more closely and I have to ask permission, it turns out, to not only Verruct and Scheffnow, but to you and AlexusB as well, because I discovered that both of you created the Pirate Hunting Mod. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />

It's not really a mod because I just changed some dialouge for the governors and some code in Quest reaction.c, but I'll have to see what I can do to get those emails out... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/bookish.gif" style="vertical-align:middle" emoid=":mm" border="0" alt="bookish.gif" />
 
First, on my part you're welcome to do whatever you like to anything I've made. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

Do you have everyone's email? If not, gimme a (PM) shout and I'll grab them for ya.

And, how do you think the PH mod _itself_ was made? Other than something in char init to make the quest pirate the _entire_ mod is governor dialog and QR code! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="icon_wink.gif" />
 
Back
Top