Getting Started w/ Modding

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
RavynousHunter
Posts: 8
Joined: Thu May 14, 2020 1:34 pm

Getting Started w/ Modding

Post 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?
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post 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.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
RavynousHunter
Posts: 8
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post by RavynousHunter »

Aah, thankee, Dominus! I didn't think mods would be housed with the rest of the code for Exult.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post by Dominus »

Only Marzo's and SF Island ;)
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
RavynousHunter
Posts: 8
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post 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.
RavynousHunter
Posts: 8
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post 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.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post 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)
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
RavynousHunter
Posts: 8
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post by RavynousHunter »

Wooh! Thankee, Dominus! Got that bugger compiled! Next step: inclusion...then, everyone's favourite, debugging!
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post by Dominus »

It did work? Great because I was unsure if I got this all wrong ;)
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
RavynousHunter
Posts: 8
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post 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?
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post 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 :)
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
RavynousHunter
Posts: 8
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post by RavynousHunter »

I think I'm accidentally overwriting the curing code...hm.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post 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.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
RavynousHunter
Posts: 8
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post 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!
Dale
Posts: 176
Joined: Thu May 14, 2020 1:34 pm

Re: Getting Started w/ Modding

Post by Dale »

Really hope you get everything figured out. I hope to get back into in eventually, too. What are you working on?
Locked