Cartography / Sextant
Posted: Sun Dec 23, 2007 7:33 pm
I'm going to post this script fast because I'm pleased with how it works. (I have to leave so more info to follow.)
Basically you create a map with the map.js attached to it. Set the more to ## for difficulty (similar to my lockpick skill), set morex to the x coordinate you wish the map to point to, and morey to the y coordinate.
When you use the map and your cartography skill allows for a successful roll, a gump appears with a pin pointing to nearly the exact location on the color Britannia map image.
I also plan to incorporate the ability to "record" to a map based on cartography skill.
The sextant is the same way (only attach the script to a sextant), except it shows your current location. This script is a MUST for boat travel, as you can plot your relative position instead of getting lost in the high seas.
It is really pretty fun. This is my favorite script I've made to date.
I have a sweet screenshot showing how it works. If you'd like me to email you the screenie before you install, boardmail me your email addy.
map.js
sextant.js
Basically you create a map with the map.js attached to it. Set the more to ## for difficulty (similar to my lockpick skill), set morex to the x coordinate you wish the map to point to, and morey to the y coordinate.
When you use the map and your cartography skill allows for a successful roll, a gump appears with a pin pointing to nearly the exact location on the color Britannia map image.
I also plan to incorporate the ability to "record" to a map based on cartography skill.
The sextant is the same way (only attach the script to a sextant), except it shows your current location. This script is a MUST for boat travel, as you can plot your relative position instead of getting lost in the high seas.
It is really pretty fun. This is my favorite script I've made to date.
I have a sweet screenshot showing how it works. If you'd like me to email you the screenie before you install, boardmail me your email addy.
map.js
//pick targeting
function onUseChecked( pUser, iUsed )
{
//read function == Random ((1-100) + (skills - difficulty))
must be greater than difficulty
var Check =RandomNumber( 0, 100 ); //edit random ##
roll here. (default 0-100)
// NOTE Remember skills and morey should be from 1-
1000, so be sure to divide by 10 to get it into the proper number format (Ie 1
-100)
var Bonus = ((pUser.skills.cartography -
iUsed.more)/10); // edit bonus here (default = skill - difficulty)
var BaseOpen = 35; //35% chance of reading a
map with no bonuses or difficulty...use for a base value of difficulty
var DC = 100-BaseOpen; //Base difficulty check based
on the BaseOpen variable
//debug text for formula check
var Debug = Check + Bonus;
pUser.SysMessage("Check" + Check);
pUser.SysMessage("Bonus" + Bonus);
pUser.SysMessage("DC" + DC);
pUser.SysMessage(Debug + ">" + DC);
pUser.CheckSkill( 12, 0, 1000 ); //run dummy function
for skill gain purposes only.
//Formula calculation
if ((Check + Bonus) > DC) // Fire if check is greater
than lock difficulty
{
pUser.SysMessage("The map reads:");
pUser.SysMessage(iUsed.morex + " East");
pUser.SysMessage(iUsed.morey + " North");
var myGump = new Gump;
var Gumpx = parseInt(iUsed.morex / 13);
var Gumpy = parseInt(iUsed.morey / 11.5);
myGump.AddPage( 0 );
myGump.AddGump( 0, 0, 2529 );
myGump.AddGump( 0, 0, 5528 );
myGump.AddGump( Gumpx, Gumpy, 9009 );
myGump.Send( pUser );
myGump.Free();
}
else //perform failure check here.
{
pUser.SysMessage("The map is too obscure to read");
}
}
function onUseChecked( pUser, iUsed )
{
//read function == Random ((1-100) + (skills - difficulty))
must be greater than difficulty
var Check =RandomNumber( 0, 100 ); //edit random ##
roll here. (default 0-100)
// NOTE Remember skills and morey should be from 1-
1000, so be sure to divide by 10 to get it into the proper number format (Ie 1
-100)
var Bonus = ((pUser.skills.cartography -
iUsed.more)/10); // edit bonus here (default = skill - difficulty)
var BaseOpen = 35; //35% chance of reading a
map with no bonuses or difficulty...use for a base value of difficulty
var DC = 100-BaseOpen; //Base difficulty check based
on the BaseOpen variable
//debug text for formula check
var Debug = Check + Bonus;
pUser.SysMessage("Check" + Check);
pUser.SysMessage("Bonus" + Bonus);
pUser.SysMessage("DC" + DC);
pUser.SysMessage(Debug + ">" + DC);
pUser.CheckSkill( 12, 0, 1000 ); //run dummy function
for skill gain purposes only.
//Formula calculation
if ((Check + Bonus) > DC) // Fire if check is greater
than lock difficulty
{
pUser.SysMessage("The map reads:");
pUser.SysMessage(iUsed.morex + " East");
pUser.SysMessage(iUsed.morey + " North");
var myGump = new Gump;
var Gumpx = parseInt(iUsed.morex / 13);
var Gumpy = parseInt(iUsed.morey / 11.5);
myGump.AddPage( 0 );
myGump.AddGump( 0, 0, 2529 );
myGump.AddGump( 0, 0, 5528 );
myGump.AddGump( Gumpx, Gumpy, 9009 );
myGump.Send( pUser );
myGump.Free();
}
else //perform failure check here.
{
pUser.SysMessage("The map is too obscure to read");
}
}
//pick targeting
function onUseChecked( pUser, iUsed )
{
//read function == Random ((1-100) + (skills - difficulty)) must be greater than difficulty
var Check =RandomNumber( 0, 100 ); //edit random ## roll here. (default 0-100)
// NOTE Remember skills and morey should be from 1-1000, so be sure to divide by 10 to get it into the proper number format (Ie 1-100)
var Bonus = ((pUser.skills.cartography )/10); // edit bonus here (default = skill - difficulty)
var BaseOpen = 45; //35% chance of reading a map with no bonuses or difficulty...use for a base value of difficulty
var DC = 100-BaseOpen; //Base difficulty check based on the BaseOpen variable
//debug text for formula check
var Debug = Check + Bonus;
pUser.SysMessage("Check" + Check);
pUser.SysMessage("Bonus" + Bonus);
pUser.SysMessage("DC" + DC);
pUser.SysMessage(Debug + ">" + DC);
pUser.CheckSkill( 12, 0, 1000 ); //run dummy function for skill gain purposes only.
//Formula calculation
if ((Check + Bonus) > DC) // Fire if check is greater than lock difficulty
{
pUser.SysMessage("Current Location is:");
pUser.SysMessage(pUser.x + " East");
pUser.SysMessage(pUser.y + " North");
var myGump = new Gump;
var Gumpx = parseInt(pUser.x / 13);
var Gumpy = parseInt(pUser.y / 11.5);
myGump.AddPage( 0 );
myGump.AddGump( 0, 0, 2529 );
myGump.AddGump( 0, 0, 5528 );
myGump.AddGump( Gumpx, Gumpy, 9009 );
myGump.Send( pUser );
myGump.Free();
}
else //perform failure check here.
{
pUser.SysMessage("The sextant readings are inaccurate");
}
}
function onUseChecked( pUser, iUsed )
{
//read function == Random ((1-100) + (skills - difficulty)) must be greater than difficulty
var Check =RandomNumber( 0, 100 ); //edit random ## roll here. (default 0-100)
// NOTE Remember skills and morey should be from 1-1000, so be sure to divide by 10 to get it into the proper number format (Ie 1-100)
var Bonus = ((pUser.skills.cartography )/10); // edit bonus here (default = skill - difficulty)
var BaseOpen = 45; //35% chance of reading a map with no bonuses or difficulty...use for a base value of difficulty
var DC = 100-BaseOpen; //Base difficulty check based on the BaseOpen variable
//debug text for formula check
var Debug = Check + Bonus;
pUser.SysMessage("Check" + Check);
pUser.SysMessage("Bonus" + Bonus);
pUser.SysMessage("DC" + DC);
pUser.SysMessage(Debug + ">" + DC);
pUser.CheckSkill( 12, 0, 1000 ); //run dummy function for skill gain purposes only.
//Formula calculation
if ((Check + Bonus) > DC) // Fire if check is greater than lock difficulty
{
pUser.SysMessage("Current Location is:");
pUser.SysMessage(pUser.x + " East");
pUser.SysMessage(pUser.y + " North");
var myGump = new Gump;
var Gumpx = parseInt(pUser.x / 13);
var Gumpy = parseInt(pUser.y / 11.5);
myGump.AddPage( 0 );
myGump.AddGump( 0, 0, 2529 );
myGump.AddGump( 0, 0, 5528 );
myGump.AddGump( Gumpx, Gumpy, 9009 );
myGump.Send( pUser );
myGump.Free();
}
else //perform failure check here.
{
pUser.SysMessage("The sextant readings are inaccurate");
}
}