Jump to content
Sign in to follow this  
Muratus del Mur

Quest Idea - Compass , Warm Cold Directions, Find Location

Recommended Posts

This is not sample code, it is just a note on a possible quest concept i was thinking.

by using uv(location) on an item, to determine someones current location, you could create a list of locations and based on that you could return a message like "you are getting close" or a direction indication like "go left until you find a tree". In this way you could create items like a compass that will point you to a predefined location the editor picks, or quests like treasure hunting.

If you combine this with the storage and the date functions you could for example ask someone to find the propper place for some seeds to grow, considering soil, light or anything else you want. The quester will have to wait one day in a place to see if the seeds start to grow or not, then try an other one. The one that manages to get them grow first wins.

Other things like a dynamic map direction items are possible in the same way, all you need to do is to use the location of the current player and prepare a list of responses based on that location.

Maybe someone can point out why this might not work, or provide a sample code for it.

Share this post


Link to post
Share on other sites
i was discussing a topic about a possible compass in md, when i realised how many things could be done with the location spell combined with inventory items. I didn't saw anyone using it so i thought to place it on forum. Sorry if i spoiled any of your ongoing quests.

Share this post


Link to post
Share on other sites
My attempt at creating a compass is up now [url="http://magicduel.invisionzone.com/topic/8032-missing-cards/"]here[/url]. Once it has run, I will post some of the code here. Any comments or questions are welcome.

Create an array of locations. This was originally two functions that were used at different points in the quest but I realized that I could combine them. This is the result.
[code]function create_locations(@vm=array('all')){
//allowed values: nomansland, marindbell, mda, labyrinth, tribunal, loreroot, golemus, necro
@vl=array();
if(in_array('nomansland', @vm) OR in_array('all', @vm)){
array_push(@vl,
array("Paper Cabin", "1_-2x-1_2", "-20", "-10"),
array("Clash of Ages", "1_-1x-2_1", "-10", "-20"),
array("Gazeebo of Equalibrium", "1_0x0_1", "0", "0"),
array("Winds Game", "1_2x1_1", "20", "10")
);
}
if(in_array('marindbell', @vm) OR in_array('all', @vm)){
array_push(@vl,
array("Marble Dale Park", "1_0x2_1", "0", "20"),
array("Marinds Marble Stairs", "1_-1x2_1", "-10", "20"),
array("Marinds Roundabout", "1_-1x3_1", "-10", "30"),
array("Willows Shop", "1_1x3_1", "10", "30"),
array("Willows Shop Interior", "1_1x3_2", "10", "31"),
array("Sages Keep", "1_3x4_1", "30", "40"),
array("Winds Sanctuary", "1_4x4_1", "40", "40"),
array("Angien Shrine", "1_2x4_1", "20", "40)
);
}
if(in_array('mda', @vm) OR in_array('all', @vm)){
array_push(@vl,
array("Heresy Lane", "3_4x-4_1", "50", "50"),
array("Fountain of Dark Vibrations", "3_2x-2_1", "30", "70"),
array("Alches Alley", "3_0x-2_1", "10", "70"),
array("Alches Alley W", "3_-2x-3_1", "-10", "60"),
array("MDA Alley", "3_1x0_1", "20", "90"),
array("Fountain of the Lost Path", "3_1x3_15","20", "115"),
array("Fountain of the Lost Path NW", "3_1x3_6","19", "116"),
array("MDA East Wall", "3_1x3_14", "23", "111"),
array("MDA Study Room", "4_1x2_7", "19", "111"),
array("P"."ublic Bathroom", "4_1x2_11", "18", "113"),
array("MDA Cellar", "4_1x2_27", "19", "113"),
array("Fountain of the Lost Path NW", "3_1x3_6", "19", "116"),
array("Golden G"."lobe Gazeebo", "3_1x3_17", "18", "115"),
array("Marinds P"."rivate Bathroom", "4_1x2_19", "19", "113")
);
//Anyone know why I don't include Marind's Room clickable?
}
if(in_array('labyrinth', @vm) OR in_array('all', @vm)){
array_push(@vl,
array("Labyrinth Entrance", "6_0x-5_1", "10", "100"),
array("Labyrinth E"."xit", "6_0x4_1", "-90", "100")
);
}
if(in_array('tribunal', @vm) OR in_array('all', @vm)){
array_push(@vl,
array("Portal to Tribunal Lands", "7_gate_1", "40", "10"),
array("Outs"."ide Tribunal Pub", "7_localpub_1", "120", "-30"),
array("Tribunal Kitchen", "7_kitchen_1", "110", "-20")
);
}
if(in_array('loreroot', @vm) OR in_array('all', @vm)){
array_push(@vl,
array("Ash Arch", "1_-3x0_1", "-30", "0"),
array("Lore Manor Interior", "1_-3x2_2", "-30", "20")
);
}
if(in_array('golemus', @vm) OR in_array('all', @vm)){
array_push(@vl,
array("Siege Crest", "1_-5x-2_1", "-50", "-20"),
array("Drachorns Lair", "1_-4x-3_1", "-40", "-30"),
array("Wraiths Wreck", "1_-5x-3_1", "-50", "-30"),
array("Ivory Lighthou"."se", "1_-5x-4_1", "-50", "-40")
);
}
if(in_array('necro', @vm) OR in_array('all', @vm)){
array_push(@vl,
array("Well of Tears", "1_1x-2_1", "10", "-20"),
array("Way of Cleansing", "1_1x-1_1", "10", "-10"),
array("Demented Ascent","1_2x-2_1", "20", "-20"),
array("Accursed Growth", "1_2x-3_1", "20", "-30"),
array("Island of Seclusion", "1_3x-3_1", "30", "-30"),
array("Trial of Agony", "1_3x-4_1", "30", "-40"),
array("Deathmarrow", "1_3x0_1", "30", "0")
);
}
return @vl;
}[/code]

Distance and direction
[code]//@vf - user's location
//@vg - location of target item (card)
//@vw - array of locations
function find_degree(@vf, @vg, @vw){
if(@vf != @vg){
foreach(@vw as @vu){
if(@vu[0] == @vf || @vu[0] == @vg){
if(@vu[0] == @vf){
// u ser location found in array
@vh['me']['x'] = @vu[2];
@vh['me']['y'] = @vu[3];
} else {
//ne xt card location found in array
@vh['card']['x'] = @vu[2];
@vh['card']['y'] = @vu[3];
}
}
}
} else {
foreach(@vw as @vu){
if(@vu[0] == @vf || @vu[0] == @vg){
if(@vu[0] == @vf){
@vh['me']['x'] = @vu[2];
@vh['me']['y'] = @vu[3];
@vh['card']['x'] = @vu[2];
@vh['card']['y'] = @vu[3];
}
}
}
}
if(@vh['me']['x']-@vh['card']['x'] AND @vh['me']['y']-@vh['card']['y']){
@vh['distance'] = sqrt(pow(@vh['me']['x']-@vh['card']['x'],2)+pow(@vh['me']['y']-@vh['card']['y'],2));
@vh['deg'] = compas(@vh['me']['x']-@vh['card']['x'], @vh['me']['y']-@vh['card']['y']);
} else{
@vh['distance'] = max(@vh['me']['x']-@vh['card']['x'], @vh['me']['y']-@vh['card']['y']);
@vh['deg'] = compas(@vh['me']['x']-@vh['card']['x'], @vh['me']['y']-@vh['card']['y']);
}
return @vh;
}

//compass function was copied directly from php.net documentation
function compas(@vx, @vy){
if(@vx==0 AND @vy==0){ return 0; }
return (@vx < 0)
? rad2deg(atan2(@vx,@vy))+360
: rad2deg(atan2(@vx,@vy));
}[/code]

find_degree was never optimized but it worked. For some reason 0 degrees came out as due south when I was expecting it to be east but that was an easy fix.

Of course if you were using this in an item with a locate spell you would have to increase the locations array to cover all map locations. Edited by Laphers

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Forum Statistics

    15,832
    Total Topics
    173,490
    Total Posts
  • Recently Browsing

    No registered users viewing this page.

  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×
×
  • Create New...