What is the 3rd Party HSI?

From OHRRPGCE-Wiki

(Redirected from Thirdparty Plotscripts)
Jump to: navigation, search

Contents

[edit] About

The 3rd Party HSI is a collection of useful plotscripts from various OHRRPGCE plotscripters. FyreWulff maintains the collection.

[edit] Contributors

The Mad Cacti
T-Master
Cube
Codywatts


Contributors, please add documentation for your scripts on this page

[edit] Usage of the 3rd Party HSI

To use the 3rd Party HSI, download it (readme here) from the Hamster Republic OHRRPGCE page. Next, extract
thirdparty.hsi
to your scripts directory. This file is also available online here: 3rd Party HSI Code


Finally, type in the line "include, thirdparty.hsi" after the line with "include, plotscr.hsd". The top of your script file should look something like this:

#my script file! © me!
include, plotscr.hsd
include, thirdparty.hsi

[edit] The Scripts

[edit] abs(number)

Returns the absolute value of number. Ex: abs(-17) equals 17

[edit] cosine (angle, multiplier)

Returns the cosine of an angle (in degrees), multiplied by some number (default 10000, to give the first 4 decimal digits). You can use any angle or multiplier at all. Note that this function does not give perfect results, when using a large multiplier the answer may be out by a few. You may get a script buffer overflow when using this script due to the large amount of memory it uses up (about a third of the buffer).

A use of the sine and cosine scripts is to calculate the co-ordinates on the edge of a circle (see example) You can use the 'multiplier, times cosine, angle' operator if you want.

Ex: 
x coord := radius, times cosine, (direction * 45)
y coord := radius, times sine, (direction * 45)

[edit] digit (number,n)

Returns nth decimal of a number. Counts from the smallest place, with the ones digit being n = 1, ten's is n = 2, etc.
Ex: digit (12345, 2) = 4

[edit] distance (number1,number2)

Calculates the distance between two numbers. Always returned as a positive number.

[edit] divide round (a,b)

Division which rounds the result. Normal division using 'divide(a,b)' or 'a / b' does not round.
You can use the operator a, div, b instead. Ex: nearest tile := hero pixel x (me), div, 20

[edit] fake door (map, x, y)

Teleports the player to the specified coordinate on some map without using builtin doors.

[edit] first free id (low range, high range, direction)

Use to find an npc id number with no instances on the map. You can create an npc of this id number and use the globally-altering 'alter npc' command without fear of mucking up other npcs on the map. Returns the first unused id number it finds. If none is found, it returns -1. By default, it starts searching with id 0, and gos up to 35. You can change this behaviour by specifying a range of id numbers to check, and whether to start at the top or bottom. To start from the bottom, pass the constant forwards (value 1) as direction. To search from the top, pass the constant backwards (value -1). You can use the constants for other things too of course.
Ex:

npc id := first free id (30, 35, backwards)
if (npc id <> -1) then (
  npc := create npc (npc id, 20, 35, south)
  alter npc (npc, npcstat: picture, 15)
  alter npc (npc, npcstat: palette, 12)
)

[edit] have money (amount,strictness)

Checks to see if the player has the amount of money specified. By default the check is loose, meaning it will return true if the amount of money the player has is equal or greater than the amount checked for. Using strict as your second arguement, however, will only return true if they have the exact amount.

[edit] npc above (npc ref, npc ref2, npc ref3, ...)

Pass any number of npc references (up to 8), and this script will return the npc reference of the npc that would be drawn on top of the other npcs in game.exe if the npcs were all placed on the same tile. Largely intended for use with 'swap npc ref' to allow you to change which npc is drawn on top of/underneath another (npc layering depends on the npc reference number of npcs).

[edit] npc below (npc ref, npc ref2, npc ref3, ...)

Like 'npcabove', this script will return the npc reference of the npc that would be drawn below other npcs on the same tile in game.exe. Largely intended for use with 'swap npc ref' to allow you to change which npc is drawn on top of/underneath another.

[edit] number of npcs (low range, high range)

By default (when passing no arguments to it), returns the total number of npc instances on the map. You can set the low and high limits of the npc id numbers it checks for, for instance, 'number of npcs (5, 8)' will return the total number of npcs on the map with id numbers between (and including) 5 and 8.

[edit] reset time

Reset the OHRRPGCE's internal time clock. A save file created right after this command would read 0 days, 0 hours, and 0 minutes.

[edit] restore vehicle

After calling save vehicle, you can use this command to restore the NPC as you left it. This command assumes you have placed the NPC somewhere on the map in CUSTOM.EXE already. The best place to use this script would be in the On Map Load script.

[edit] save vehicle(npc)

Saves the direction, x, y, and ID of the vehicle NPC specified. For use with restore vehicle. The best way to use this command would be in a dismount script. Note that you can only currently save one vehicle at a time.

[edit] sine (angle, multiplier)

Sine behaves in the same way as cosine. It has its own operator, 'multiplier, times sine, angle'.

[edit] sqrt (number)

Returns the rounded square root of a number. Square root of a negative returns zero.

[edit] swap npc ref (npc ref1, npc ref2)

This swaps the npc reference of two npcs. This is done by swapping the locations, directions, walkabout sets, etc. of the two npcs. Note: the current frame of the npcs will not be swapped because the plotscripting commands to do this don't exist.

When you swap the references, you will notice no difference to the npcs on screen (except possibly their frames), but if you use the same npc reference which you stored in a variable earlier, you will now manipulate the other npc.

This script can be used to swap the order of layering of two npcs when they appear on the same tile (in conjuction with 'npc above' or 'npc below'; in which case, you may want to swap the values of your variables afterwards), or to juggle npcs.

Ex:

#Example to insure that a damage animation is drawn on top of a boss made of several pieces
damage pic := create npc (1, 2, 3, 4)
topnpc := npc above (damage pic, boss torso, boss arms, boss legs) #note that 'damage pic' is included
swap npc ref (damage pic, topnpc)
temp := damage pic  #swap the values of the locals
damage pic := topnpc
topnpc := damage pic

[edit] tan (angle, multiplier)

Tan returns the tangent of a angle times some multiplier. It is possible to crash your game with an overflow error if the result is too large. It otherwise behaves in the same way as sine.Tan has its own operator, 'multiplier, times tan, angle'.

[edit] tb (textbox)

Displays textbox number with automatic wait for textbox.

[edit] trunc(dividend, divisor)

Returns the truncation of the dividend and divisor.

[edit] unequip party (group)

Removes all equipment from party members. If you use entire party as the group, it will unequip the active and reserve heroes. You can also use active only to unequip just the active party or reserve only to unequip just the reserve heroes. If you use no arguement, it defaults to entire party.

[edit] x distance (hero,npc)

A simplied version of distance that finds the x distance between the specified hero rank in the party, and the specified NPC.

[edit] y distance (hero,npc)

A simplied version of distance that finds the y distance between the specified hero rank in the party, and the specified NPC.


[edit] See Also

Personal tools