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

Modders Reference...

Fantasia

Landlubber
Storm Modder
I am currently trying to work out what each function in the source code can do to make it possible to make actual mods, rather than small additions in places...

I'll add to this list as i work out what does what......
(Feel free to add on to the list!)

==============================================
<b>Sound functions</b>
==============================================

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->PlayStereoSound("notebook");<!--c2--></div><!--ec2-->

Plays the "Logbook Update!" jingle, which is located in AOP2/RESOURCE/Sounds/Interface..

==============================================
<b>Text functions</b>
==============================================

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Log_SetStringToLog(XI_ConvertString("MyMessage"));<!--c2--></div><!--ec2-->

This will show text in the top right corner of the screen, where the Logbook update message shows.. To add your own string, open up;

AOP2/RESOURCE/INI/Texts/russian/common.ini

At the bottom add

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->string = MyMessage,"Hello world! This is a test!"<!--c2--></div><!--ec2-->

===============================================
<b>Item Functions</b>
===============================================

Give an item to the player...

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->GiveItem2Character(Pchar, "ITEMREF");<!--c2--></div><!--ec2-->

Change ITEMREF to the id of the item, id's can be found in AOP2/Program/ITEMS/initItems.c

------------------

Check to see if player has an item...

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->if(CheckCharacterItem(Pchar, "ITEMREF") == 0)
{
  // FALSE; Does not have this item.
}
else {
  // TRUE; Has 1 or more of this item.
}<!--c2--></div><!--ec2-->

-------------------

Equip an item automatically. (Weapon, Armor, Spyglass ect)

EquipCharacterbyItem(Pchar, "ITEMREF");

==========================================
<b>Money Functions</b>
==========================================

Change money/piasters to specific value..

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->pchar.money = 100000;<!--c2--></div><!--ec2-->

--------------

Add onto current money / take away current money..

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->pchar.money = pchar.noney + 100;<!--c2--></div><!--ec2-->
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->pchar.money = pchar.noney - 100;<!--c2--></div><!--ec2-->

===========================================
<b>Experience Functions</b>
===========================================

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->pchar.rank_exp = 1000000;<!--c2--></div><!--ec2-->
Sets experience to <i>specific</i> value..

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->pchar.rank_exp = pchar.rank_exp + 100;
pchar.rank_exp = pchar.rank_exp - 100;<!--c2--></div><!--ec2-->

Add or Take experience from your current exp.
 
Good to see that the code seems to be very similar to PotC <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />
 
PotC, AoP and CoAS really ARE very similar indeed. What applies to the one would in most cases apply to the other too.
Here's some info about PotC that might also be useful:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// NK -->
// Keywords used in POTC but defined in engine.

#event_handler(string eventname, string funcname) //calls funcname when event eventname occurs. Like SetEventHandler() below

string stringdef; //string; add as keyword
object objdef; //string with attributes; kw
ref refdef; //reference to variable; kw
aref arefdef; //reference to attribute of an object; kw

call string funcname; //calls func funcname, and if funcname has vars; kw

native functype func(); //says func is native to DLLs, but is given so scripts know that it exists
extern functype func(); //says func is defined in a segment loaded when needed, so script doesn't crash on not seeing it on launch


int sti(string str); //string to integer
int makeint(ref intref); //makes intref an integer
float stf(string str); //string to float
float makefloat(ref floatref); //makes floatref a float
string fts(float num, int places); //displays float with so many places

string GetSymbol(string str, int pos); //return character of str[pos], i.e. the pos+1'th character of str.
int findSubStr(string parsestr, string findstr, int startpos); //returns pos of first occurrence of findstr in parsestr from startpos; else return -1
int strlen(string str); //return length of str
string strcut(string str, int start, int end); //return the string starting at char start and ending at end
bool isDigit(string str, int pos); //return true if character at pos is digit. I think.

float pow(float num, float exponent); //return num to the exponent power. exponent must be >=1. You can use sqrt(pow(num, exp*2) if the exp is > 0.5 but < 1, and so forth.
float sqrt(float num); //returns square root of num
float sqr(float num); //returns square of num
float abs(float num); //returns absolute value of num
float sin(float a); //returns sin of a (where a is in radians)
float cos(float a); //cos
float tan(float a); //tan
float atan2(float x, float y); //arctan

int argb(int a, int r, int g, int b); // returns single int combining the alpha int and the three color ints. 0 <= x <= 255 for each a,r,g,b.

int Rand(int num); //returns a random number between 0 and num
float frnd(); //returns random number from 0.0 to 1.0

void makeref(ref _ref, ref objref); //makes _ref refer to objref
bool TestRef(ref testreference); //returns true if reference is OK
void makearef(aref _aref, aref objattr); //makes _aref refer to objattr (note that objattr can be the base of the object)
ref GetEventData(); //gets data from engine

bool CheckAttribute(aref obj, string attrname); //return true if attribute attrname exists, else returns false
void DeleteAttribute(aref obj, string attrname); //deletes attribute attrname
void CopyAttributes(aref copyto, aref copyfrom);
int GetAttributesNum(aref arobj); //return number of attributes of arobj
aref GetAttributeN(aref arobj, int n); //gets Nth attribute of arobj?
string GetAttributeName(aref arefattr); //gets name of arefattr attribute
string GetAttributeValue(aref attr); //gets value of attribute.

void Trace(string out); //send to debugger
void DumpAttributes(aref attr_root); //may require a ref. Dunno. Will trace, for all attributes of attr_root, attr_root.(attrname) = value.

int SetArraySize(ref array, int newsize);
int GetArraySize(ref array);

void SetEventHandler(string eventname, string funcname, bool unknown); //runs funcname when event eventname occurs
void DelEventHandler(string eventname, string funcnam); //removes event handler
void PostEvent(string eventname, float fdelay, string paramstocome, EXTRA_PROPERTIES); // calls event eventname (set via SetEventHandler) after fdelay milliseconds; see SendMessage for extra info
void Event(string eventname, string paramstocome, EXTRA_PROPERTIES); // same as PostEvent, but with no delay.

float GetDeltaTime(); //unknown. It _may_ return the number of msec elapsed since it was called. It's the number of msecs since _something_, I'm pretty sure.

void LayerFreeze(string layername, bool freeze); //dunno, the engine handles things in layers
void LayerCreate(string layername, bool freeze); //or at least I think it's freeze
void LayerSetRealize(string layername, bool freeze); //no clue. Set as Realize layer?
void LayerSetExecute(string layername, bool freeze); // ditto, but for Execute layer?
void LayerAddObject(string layername, ref obj, int unknown); // adds obj to layer. Unknown int. Perhaps type of obj?
void LayerDelObject(string layername, ref layerobj);

void FindClass(ref obj, string classname);
void CreateClass(string classname);
void DeleteClass(ref obj);

void CreateEntity(aref obj, string newentity); //creates entity as part of obj. I think.
bool GetEntity(string entityname, aref obj); //if finds entity entityname, makes aref of obj to entity named that, return true; else return false
string GetEntityName(aref obj); //gets name of entity.
bool GetEntityNext(aref refObj); //checks for next entity. If no next, return false; else set refobj to next entity and return true

bool IsEntity(ref obj); //true if obj/class/whatever has been created by engine
void DeleteEntitiesByType(string type); //deletes entity with that name?

void SendMessage(ref obj, string paramstocome, int message, EXTRA_PROPERTIES); //sends message to engine
/*messages are defined in messages.h and interface\messages.h
Each message has, in the comment next to it, the arguments that message takes.
l = message_number or regular int
s = string
f = float
i = attribute reference
e = entity (aka object)
i.e. SendMessage(obj, "lssf", MSG_SOME_MESSAGE, "str1", "str2", float1)*/

void SetTimeScale(float newmult); //sets time to newmult x time, from 0->infinity; i.e. SetTimeScale(3.0) for 3x time

void SelfDialog(ref character);

bool LoadSegment(string filename); //loads filename as code; returns true if loaded
void UnloadSegment(string filename);

string GetTargetPlatform(); // returns "PC" or "xbox"

void ExitProgram(); //exits program

// NK <--<!--c2--></div><!--ec2-->
 
Back
Top