Page 1 of 1

Getting Started w/ Modding

Posted: Thu Jan 21, 2016 12:43 am
by RavynousHunter
I had an idea for an SI mod today, but don't really know how to get started other than getting/learning about Exult Studio and usecode. Basically, I want to add the ability to get Cantra as a companion (kind of like SI's answer to Spark) after she's been resurrected and cured, so she can have a chance at kicking Batlin's overly generous behind or, if he's already dead, freeing the world from the Banes.

Anywho, I'm not sure if I'd be hooking into an existing NPC or script, or if I'd just write up my own bits of usecode for the dialogue options...I honestly just don't really know where to begin. Anyone got any advice for me?

Re: Getting Started w/ Modding

Posted: Thu Jan 21, 2016 1:12 pm
by Dominus
The best way to start is to download our source and take a look at the mods in the content folder. In BGkeyring you can see the usecode for having an NPC join the party. in SIfixes you can see the usecode fix for Cantra, so she is properly cured.

Re: Getting Started w/ Modding

Posted: Sat Jan 23, 2016 7:13 pm
by RavynousHunter
Aah, thankee, Dominus! I didn't think mods would be housed with the rest of the code for Exult.

Re: Getting Started w/ Modding

Posted: Sat Jan 23, 2016 7:27 pm
by Dominus
Only Marzo's and SF Island ;)

Re: Getting Started w/ Modding

Posted: Sat Jan 23, 2016 9:04 pm
by RavynousHunter
Okay, it looks...far simpler than I'd expected. At least, for the basic stuff like checking flags, conversing, and whatnot. So used to using VB.Net for work that I forget to put semicolons at the ends of lines, lol.

Re: Getting Started w/ Modding

Posted: Wed Jan 27, 2016 3:43 pm
by RavynousHunter
Okay, I'm probably stupid, but how, exactly, does one actually compile usecode-C one has written into a game-useable form? I've got the script written up in Notepad++, everything appears to check out, buuuut...can't seem to find how to actually compile the stuff. Tried "ucc -s -i \headers\ -o usecode cantra-companion.uc", but all that does is open the command-line editor. I'm...borrowing the headers from SI Fixes (to which I will, of course, give proper attribution) to get constant and function definitions and the like.

Re: Getting Started w/ Modding

Posted: Wed Jan 27, 2016 8:43 pm
by Dominus
-i is for the file you want to "compile" and -o for output. So the order is wrong, I think (need to look it up tomorrow, though). Don't know what -s means right now :(
Try
ucc -s -i cantra-companion.uc -o usecode

(Just be sure that any headers are referenced from cantra-companion.uc)

Re: Getting Started w/ Modding

Posted: Thu Jan 28, 2016 1:51 pm
by RavynousHunter
Wooh! Thankee, Dominus! Got that bugger compiled! Next step: inclusion...then, everyone's favourite, debugging!

Re: Getting Started w/ Modding

Posted: Thu Jan 28, 2016 2:08 pm
by Dominus
It did work? Great because I was unsure if I got this all wrong ;)

Re: Getting Started w/ Modding

Posted: Fri Jan 29, 2016 1:25 am
by RavynousHunter
Haaaa. Rest assured, twas correct! One last thing, other than how to actually get it inserted, but I -might- be able to figure that one, do I need to use the same object# argument (ie: object#(0x440) for Cantra) as the script in SI Fixes, or should I use a new one?

Re: Getting Started w/ Modding

Posted: Fri Jan 29, 2016 8:36 pm
by Dominus
I don't think you *need* to use that # but why not keep it. I think it's safe to start patch object# with 400 or 401 and then go upwards from that. But that is just my impression of quickly looking, not an expert opinion :)

Re: Getting Started w/ Modding

Posted: Sun Jan 31, 2016 1:00 am
by RavynousHunter
I think I'm accidentally overwriting the curing code...hm.

Re: Getting Started w/ Modding

Posted: Tue Feb 02, 2016 10:12 am
by marzo
Lets see: -s is for SI usecode.

object# specifies that the function is bound to an object (an NPC, egg) or is called by script blocks. The number you specify can be used in Exult Studio (which also generally accepts the names of functions in your usecode script). In general, NPCs use functions 0x400+NPC ID by default up to NPC ID of 255; then, you must manually assign them. Eggs in the original game, as well as several other object-related functions, use function IDs in 0x600 to 0x800 range. There are more functions after that.

shape# specifies that the function is an object# function and binds it to the specified shape number. So shape#(200) becomes usecode for shape 300.

Both shape# and object#are special types of functions: they can have no parameters, no return value, and require an object. For historical reasons, ucc calls it 'item'; it is similar to 'this' in many languages. You supply an 'item' by calling in the 'obj->function()' form. If the item is not there, 'item' is assumed.

With neither shape#() nor object#(), the function is a more "normal" function: it can have parameters and (optionally) return a value.

Generally, you want to specify a function number between the parenthesis only in two cases:
(1) you want to override an original usecode function (which you can still call it by appending ".original" to the function name);
(2) you want to bind that function to a shape.

In other cases, leaving it empty (or supplying -1) will autonumber the functions. You just have to supply a '#autonumber value' directive at the start of your usecode to autonumber them starting from the given value; a value of 0xC00 is used in my mods to avoid overwriting original functions.

Finally, to see it in game, either create a mod from within Exult Studio and place it in your mod's patch dir or place it in the main game's patch dir. The compiled file will have to be called 'usecode' for this to work.

Re: Getting Started w/ Modding

Posted: Tue Feb 02, 2016 8:53 pm
by RavynousHunter
Hrm...so, using #autonumber 0xD00 would be advisable, then? After that, I'll have to bind the script to Cantra and all should be well; I think that's what I'm forgetting. Thankee for the help, Marzo!

Re: Getting Started w/ Modding

Posted: Mon Feb 15, 2016 3:35 am
by Dale
Really hope you get everything figured out. I hope to get back into in eventually, too. What are you working on?