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

Name and status of the main character's blade?

RobC

Landlubber
Hi,

I've been fiddling around trying to create a blacksmith. What he'll do is get the main character's weapon and repair it from say "badly worn" to "fine".

Only problem that I'm having is, how do I get the main char's blade? I fiddled around with this:

ref MainChar;
MainChar = GetMainCharacter();
trace (MainChar.equip.blade);

But this returns "blade1". What I want to get is something like "Fine Bosun's Choice" or whatever blade he's carrying.
How would I go about this?

Thanks in advance.
 
cool idea robc, we were just talking about this in another thread <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

the names and descriptions of the items are defined in the language file RESOURCEINITEXTSENGLISHItemsDescribe.txt

i've had a look at PROGRAMINTERFACEitems.c, and it seems that to get the name of an item you use the function <b>LanguageConvertString(<<<the id of an open language file>>>,<<<the id of the string you're looking for in that file>>>)</b>

in this particular case, the stringid is <b>itmname_</b> + <<<the item's id>>> (to get its name), or <b>itmdescr_</b> + <<<the item's id>>> (to get its description)

so for example, to get the name of "blade1":

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->int lngFileID; // remember this is an INTEGER not a string!

string the_id_of_the_blade;

string the_id_of_the_string;

string the_name_of_the_blade;

ref mainchar;



lngFileID = LanguageOpenFile("ItemsDescribe.txt"); // this is the language file that has the name of the blade in it

mainchar = GetMainCharacter();



...



the_id_of_the_blade = mainchar.equip.blade; // this comes out as "blade1"

the_id_of_the_string = "itmname_" + the_id_of_the_blade; // this comes out as "itmname_blade1"

the_name_of_the_blade = LanguageConvertString(lngFileID,"itmname_blade1"); // this should look up "itmname_blade1" in the file and come out as "Saber"



...



LanguageCloseFile(lngFileID); // remember to close the file after...<!--c2--></div><!--ec2-->

ok? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />
 
oh, and er, <span style='`font-size`:30pt;`line-height`:100%'><b>welcome!</b></span>

<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 always forget to say that <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />
 
Thanks!
My original idea was to have a whole interface (like the trading interface) allowing you to select which blades to repair etc. But when I looked at the interface files I got scared, really, really scared. So now I just have a guy who fixes the sword you have equipped, for a price ofcourse, and it takes some time (probably 1 day).

Just a quick question: I've noticed that there is an "Excellent" status for the swords which ís disabled for random and trade, would it disturbe the game balance if I used those too, or would that be an extra to pay a handsome fee to have your blade repaired?

Yours,
Rob
 
It's coming along wonderfully, better than I expected really.

Only one problem, which functions does potc support for string manipulation? I checked some standard C functions but they didn't seem to work... I'm looking for functions to search in a string for any occurance of another string (a variant of index, instring, whatever you wish to call it), and a way to get certain characters from a string (a substring variant). Anyone know of these?

Thanks,
Rob
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" /> <b>RobC, </b>and welcome aboard! Pull up a keg, have a seat, and have a couple on us! <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" />

<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid=":keith" border="0" alt="keith.gif" /> We're glad you found your way into these fair waters, and hope you visit often! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />

And you come bearing gifts! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_praise.gif" style="vertical-align:middle" emoid=":bow" border="0" alt="icon_praise.gif" />

This sounds great, I like it... I'm no coder, really (depends on who you ask, I guess) so I can't advise you there... But rest assured, someone will pop in and help... Kieron's VERY good at that! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />

Looking forward to seeng how this all turns out! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/william.gif" style="vertical-align:middle" emoid=":will" border="0" alt="william.gif" />

Again, welcome aboard! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" />
 
hey, your mod sounds really cool <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />

but you should be ambitious, not defeatist! it would be really cool if you used a `store-style` interface, with extra buttons for repairing and/or upgrading swords. it's not too hard to copy an interface and just alter it slightly (see the 'international affairs' interface, which i made by copying the 'trade book' interface and adding stuff <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" /> ). what throws a lot of people is that the interfaces have code in RESOURCEINIINTERFACES and also in PROGRAMINTERFACE...

actually, without wanting to sound too `own-trumpet`-blowing <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/blush.gif" style="vertical-align:middle" emoid=":eek:ops" border="0" alt="blush.gif" />: i'm the resident expert on interfaces - so if you want me to have a little look at the code...? up to you of course!

i've noticed the 'excellent' status too, and i've noticed the cool pictures there are for `top-status` blades (use the txconverter tool to view the game's textures and graphics; i think the url for it is in the 'tools of the trade' sticky thread in this forum). they seem to be unused, so i don't see why you shouldn't implement them! it should cost, though, i think. or perhaps you could make it possible to buy `excellent-status` blades for a high price, but not to upgrade blades to excellent status.

as for string functions, we know of the function <b>strcut</b> (example: <b>if(strcut(Dialog.CurrentNode, 0, 3) == "flag")</b>); i think there are some others too, but i can't remember their names... i've done a quick search on the PROGRAM folder and not found any. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
 
Yes, I'm so excited to hear someone's making progress on a blacksmith! In my own attempts I've made a humble skin for the character himself, just making "searcher" look like he has a leather apron and lots of sooty smudges. I'll post that here soon. Maybe later I'll give him a different face, though I really like that old guy and his raised eyebrow. When he's a crewman he looks so cool hacking someone up then calmly replacing his sword... like Jim Belushi, I picture.

I don't know whether I'd prefer to see it as a `store-style` interface, where you choose from a number of blades, or as simply a dialog where he'll fix your equipped sword. I like the idea of him keeping your sword (like the B11 monks do) for a day or two so you have to go out, spend the night somewhere and manage without it.

If you'd like some ideas, here's at least one place where we've been discussing a blacksmith's shop: <a href="http://forum.piratesahoy.net/ftopic2325.php" target="_blank">http://forum.piratesahoy.net/ftopic2325.php</a>

My favourite suggestion is that in addition to money, you have to give the smith some material, like steel ingots you can buy or find. He'd need them to repair your sword or even craft you some special brand new ones.

Is it possible to upgrade a weapon's stats beyond the standard max -- to, for instance, increase a Piranha's HP to 40 `in-game`?

Anyway, I can't wait to see this come out. Best of luck mate!
 
oh another question, robc - where have you put your blacksmiths? are they in the buildings that have little fires going on outside them?
 
Maybe we can model some sorts of signs for the outsides of buildings, too. For blacksmith shops and tailors'.

Here's my blacksmith... maybe a simple recolouring of the skin will suffice, or maybe I ought to retexture the clothes a little and give him a new face.

<img src="http://img78.photobucket.com/albums/v251/alan_smithee/blacksmith.jpg" border="0" class="linked-image" />
 
Uhh, what's everybody getting all excited about? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/blush.gif" style="vertical-align:middle" emoid=":eek:ops" border="0" alt="blush.gif" />:

Anyhow, I'm really glad that you guys like the idea. I'm just fiddling around with it, so there's no interface yet, there's no building yet (tried that too but couldn't find /any/ info on how to add an interior for a building <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />), and there's no custom skin.

I'm just working on the functionality for now <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />.

What I have is: a guy walking around the Douwesen port, having the blaze look just so I can easily distinguish him (he'll look different later), when you talk to him, he tells you about him being a blacksmith and all, and then you can say goodbye or continue to repair your current blade (you can pick up to where, so you can reduce costs by just making it "good" instead of say "excellent"). When you talk to him again later he'll get down to business immediately, skipping the introductions.

What I want later on:
- Blacksmiths in every town (or perhaps not, let him be rare...)
- A blacksmith's workshop (indeed with the fire outside <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />)
- A custom blacksmith skin, making him look veeeery `blacksmith-like`
- A custom interface for repairing all the swords you have on you

But alas, I'm no designer, so the skin would come from one of you, and I'll need quite some help when making the interface and the workshop, but I know where to call when I need that help <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />.

Thanks guys! I'll continue coding, the guy in the docks is nearly finished, I'll post it as soon as I finish him.
 
That was quick... I've stumbled upon a bug.

To retrieve the ID of the blade the main character is holding, I use MainChar.equip.blade (MainChar is a reference to the main character). But when I have a dagger equipped, it is empty. Is there a more robust way of finding the blade?

Thanks,
Rob
 
aaaargh i just wrote a long post then my connection failed...


alan - wow, your blacksmith is <i>good</i>. fancy doing a blacksmith's shop too? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />

robc - it wouldn't be too hard to have a blacksmith's shop in every town. the hard bit is the texturing. we could use the same model for the blacksmith and the location in every town.

oh and, if you don't mind this becoming a group mod, i can get started on that interface right away <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />
 
K - I'll get to work on the shop, but I'll have to edit the model itself if I can. Do you know if anyone's ever successfully remodelled a room? And while I have Maya 4.5 and the right plugins, I don't know the conversion process... I asked this question in another thread a few days ago, but I forget which thread.
 
IMHO, this is really very cool, I like it... Nice job on the blacksmith skin, Alan - make him younger tho, maybe dark hair would do it... And darken the lenses on his goggles, like he might use them to protect his eyes against not only the heat but the light of an excessively bright flame... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />
 
I woke up from a nap for just the purpose of skinning a small series of blacksmithi, with different faces and variations in clothing. But for the most part they'll be the "researcher" model.
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_eek.gif" style="vertical-align:middle" emoid=":shock:" border="0" alt="icon_eek.gif" /> Wow!!!

Jeeez, this is great!!! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />

Well, just wanted to let ye know yer doin' a great job.

Keep it up mates!!! <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" />
 
<!--QuoteBegin-RobC+--><div class='quotetop'>QUOTE(RobC)</div><div class='quotemain'><!--QuoteEBegin-->- A custom blacksmith skin, making him look veeeery `blacksmith-like`<!--QuoteEnd--></div><!--QuoteEEnd-->

Arr, and what do you think we look like laddy?
 
<!--QuoteBegin-alan_smithee+--><div class='quotetop'>QUOTE(alan_smithee)</div><div class='quotemain'><!--QuoteEBegin-->K - I'll get to work on the shop, but I'll have to edit the model itself if I can. Do you know if anyone's ever successfully remodelled a room? And while I have Maya 4.5 and the right plugins, I don't know the conversion process... I asked this question in another thread a few days ago, but I forget which thread.<!--QuoteEnd--></div><!--QuoteEEnd-->

i believe it can be done; that's what the pmt are up to...
 
Uhh, me minding it becoming a group mod? Naaah!

If my original work is online, download it and have a look. All code for the blacksmith is in place, if you want to make an interface you'll just have to tie it to different events instead of dialog <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />.

Great mates! I'll be on vacation from wednesday until God knows when, so I probably won't see the completion of this mod, but at least I'll know I contributed to it! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/bounce.gif" style="vertical-align:middle" emoid=":b:" border="0" alt="bounce.gif" />

Anyhow, what the code does now:
- Determine the quality of the currently equipped blade and use dialogs accordingly
- Calculate the price for an upgrade (with a little thinking help from Kieron <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile2.gif" style="vertical-align:middle" emoid=":))" border="0" alt="smile2.gif" />
- Allow the user to select how much to upgrade
- Take the old sword, take the money, take a day, and give back the new sword

With that, pretty much anything is possible. I did quite some inline documentation so it should be very easy to adapt the files.

Let me know how things go, and ofcourse if I can do anything else for this (I'm an experienced coder, so...)

<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" />
 
Back
Top