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

Better Backgrounds

Bed locators wouldn't be too hard to make (some beds do have them, right?) And the character patch usually extends all the way up to the bed (only not into it) so why do you think we'd have to extend it?
If we do, *that* would be a lot of work (but still doable).
 
CCC: neat! I've already got _some_ of this code done, I'll point it out to you in email. In about 5min, you'll have email...

Inez: Because otherwise we'd need to teleport the character off the bed when he/she wakes up--they wouldn't walk normally because when on the bed they're not on a patch.
 
<!--QuoteBegin-Inez Dias+Jul 11 2005, 09:56 PM--><div class='quotetop'>QUOTE(Inez Dias @ Jul 11 2005, 09:56 PM)</div><div class='quotemain'><!--QuoteEBegin-->If we do, *that* would be a lot of work (but still doable).
<div align="right">[snapback]123043[/snapback]</div><!--QuoteEnd--></div><!--QuoteEEnd-->
Hmm, maybe it would be less work to code the "wake up" routine so that the chr "jumps out of bed" by means of a teleport into the patch. Is there a way of determining the teleportdirection, like "upon waking check where the next reload locator is and teleport 5 ft into that direction" ?
 
I agree that "teleporting out of bed" would be easier, because if the patch extends into the bed characters would walk right into it.
 
CCC: yes, but that's still not a guarantee to be on the patch.
I think it'd be easier just to make "get out of bed" and "in bed" locators for all the locations with beds--with the TOOL it's a pretty simple process: walk up to the bed in the game and record the pchar's position, and then write that up as the out of bed locator.
Also output pchar angle, and via trig get a point 1m further as the inbed locator
 
If you could (via tracefile) generate a list of such locators, (with the model names, if possible), I could make the locator-generation full-automatic...
 
Awesome! What form would be best for you? I can do about anything short of " in traces...
Argh, you're right to bring up keyboard--it'd be great to type in the name for the locator within POTC.
Well, once the bugfixing for b12.x is done I'll see what I can do for keyboard.

Meanwhile, tell me what info you'll want, and I'll write up a little snippet to be put in the console, and anyone can then go walk around and hit F12...
Heh, we'll make an SDK for this thing yet. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />
 
Actually, since there are only a limited number of houses, I'd not want to do the locator making in a regular game. Best have some console code to put you right into one of the houses, where you make the locator, then change the code to be teleported into a different house.
(If that's not too complicated - but if I recall correctly there was some reload_character_into_location command? If it's not possible per code to find a location with a specific model (or just change the model) I can look into locations_init to see where each model is used and make a list where we need to go.)
Locator names I would not input manually (there's a different thing I want the keyboard for), to keep them systematic we could just name them "mh1_bed" and "mh1_getup" for the house model mh1, etc.

What format to write locators in - well easiest for me would be the same the tool puts out via the "locators / write to text file" menu (if you don't have it at hand I can send you an example), because I already have the code to read that. But having the model name and then the coordinates for both locators as three float numbers, seperated by blanks or commas would do just as well.

Make an SDK? We're way into it. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
Heh, I wasn't complete. Yeah, that's how I'd load the locations too.
(There's Reload(), but probably better for our use is Quest_DoReloadToLocation() or whatever, and pass a "" questcase.)
Yeah, that takes the ID's; but with the console, it's not so hard to grep for each model name and then reload to a locID using it.

OK, I'll do them in that format then (I can dump some via the tool, no worries).

And re: SDK, again I was incomplete...we do indeed have much SDK, I meant more an SDK integrated into the game, i.e. walk around in the game and edit things.
(Your tool _is_ the SDK <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />)
 
"Bed" and "Getup" locators would of course be a nice solution. Inez, would it help you if we post a list of locatorcoords? Or can you see them with some tool anyway?
 
CCC,
Nathan's made a nice thingy to generate the coords right from the game, and I'm writing a utility so you can put the locators into the gm files with one click. It's almost done, but do do some testing I'd need the code to actually move a character to the locator (to see if the orientation is right). Given a hundred years, I could probably figure it out mysef, but as you two can most likely do it from memory, I'd be thankful if one of you could give me that code.
It'll then be only a matter of half an hour to make the locators for all locations that have beds.

Get ready for some sneaking ! Looking very much forward to your mod.
 
ChangeCharacterAddressGroup() will teleport a character to a given location, group, and locator.
(You can use ChangeCharacterAddress() if the group won't change; but one of the bed locs is goto and the other is reload, so you need the former...)
Try
ChangeCharacterAddressGroup(CharacterFromID("Roger Murray"), pchar.location, "goto", "upfrombed");
or whatever the group and locator you want is.
 
You may also find this useful:
LAi_SetActorTypeNoGroup(chr);
LAi_ActorSetLayMode(chr);

where chr is whatever character you've teleported in.
That will make the character lie down (or at least it should).
 
Guess it's not yet working - the citizens prefer to sleep *under* the bed:
<img src="http://home.arcor.de/swigard/Pictures/Locators.gif" border="0" class="linked-image" />
They must be really scared ...
Nathan, I've messed up your trigonometry some more, but it's not getting better
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/blush.gif" style="vertical-align:middle" emoid=":eek:ops" border="0" alt="blush.gif" />.
 
*Bursts out laughing*

Sorry. "Couldn't resist, mate." (in Captain Jack Sparrow voice) <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
 
Apart from y, one problem is, the axes for the outofbed locator mustn't depend on whether pchar is facing front or back.
And if the head of the bed is on the left, do I need to press F12 facing front, then turn and press it again to get the ba variable set right? Or what is ba anyway?
 
The outofbed locator's axis is pi radians away from when you first press F12.
If you want the body on the bed to face right, press F12 twice; if left, press F12, turn around, press F12 again.

ba is (current angle == angle on last press of f12); bx and bz are the same but for the X and Z coords.

Heh. Actually, you don't need to turn all the way backwards; just turning some should be enough (I never actually use the new angle, just check whether it's == old angle.)
 
Here's my latest rev of the code:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->bool DoLocWrite(float magForward, float magUp)
{
    ref pchar = GetMainCharacter();
    int numdigits = 5;
 
    if(FindLoadedLocation() == -1) return false; //if not in loc mode, return
    float x, y, z, ay, xx, xz, zx, zz;
    GetCharacterPos(pchar, &x, &y, &z); // get pos
    GetCharacterAy(pchar, &ay); // get angle
    if(!CheckAttribute(pchar, "locwrite"))
    {
 Logit("Locator coordinate writing (LOCWRITE). This assumes the bed will have the head to your right.");
 Logit("If this is the case, press F12 again now. If this is not the case--the head is to your left--turn around first and then press F12 again.");
 Logit("If you don't want to write this position as the locators, move somewhere else before hitting F12 and it will clear.");
 pchar.locwrite = true;
 pchar.locwrite.x = x;
 pchar.locwrite.z = z;
 pchar.locwrite.ay = ay;
 return false;
    }
    else
    {
 float lx, lz, lay, firstay, seconday, side;
 lx = stf(pchar.locwrite.x);
 lz = stf(pchar.locwrite.z);
 lay = stf(pchar.locwrite.ay);
 DeleteAttribute(&pchar, "locwrite");
 
 bool bx, bz, ba;
 bx = false; bz = false; ba = false;
 /*if(lx * 0.999 <= x && lx * 1.001 >= x) bx = true;
 if(lz * 0.999 <= z && lz * 1.001 >= z) bz = true;*/
 if(lx == x) bx = true;
 if(lz == z) bz = true;
 if(clampangle(lay) * 0.999 <= clampangle(ay) && clampangle(lay) * 1.001 >= clampangle(ay)) ba = true;
 if(bx && bz)
 {
     if(ba) { seconday = lay + PId2}
     else { seconday = lay - PId2;}
     
 }
 else
 {
     logit("LOCWRITE: Positions not the same, clearing...");
     //trace("old pchar pos: " + lx + ", "+ lz +"; new pos " + x + ", " + z);
     return false;
 }
 ref loc = &Locations[FindLoadedLocation()];
 string locname = "locatormodel: Resource\\models\\" + loc.filespath.models + "\\" + loc.models.always.locators + ".gm";
 // angle components
 xx = sin(lay+PI);
 zz = xx;
 xz = cos(lay+PI);
 zx = -1.0 * xz;
 
 trace(locname);
 trace("goto,upfrombed,"+floattostring(xx, numdigits)+",0,"+floattostring(xz, numdigits)+",0,1,0,"+floattostring(zx, numdigits)+",0,"+floattostring(zz, numdigits)+","+floattostring(x, numdigits)+","+floattostring(y, numdigits)+","+floattostring(z, numdigits)+",1,0,0,0,0,0,0,0,0,");

 // change for bed
 z += cos(lay) * magForward;
 x += sin(lay) * magForward;
 y += magUp;

 xx = sin(seconday);
 zz = xx;
 xz = cos(seconday);
 zx = -1.0 * xz;
     
 trace("reload,onbed,"+floattostring(xx, numdigits)+",0,"+floattostring(xz, numdigits)+",0,1,0,"+floattostring(zx, numdigits)+",0,"+floattostring(zz, numdigits)+","+floattostring(x, numdigits)+","+floattostring(y, numdigits)+","+floattostring(z, numdigits)+",1,0,0,0,0,0,0,0,0,");
 logit("LOCWRITE: Writing complete. The head of the bed was to your " + stringret(ba, "right", "left"));
 
 //TeleportCharacterToPos(pchar, x, y, z); // move char
     //GetCharacterPos(pchar, &x, &y, &z);
     //Logit("Pos After: (" + x + ", " + y + ", " + z + ")");
 return true;
    }
}<!--c2--></div><!--ec2-->
With correct locator names and with magF and magU as args.
 
Back
Top