login

Author Topic: Ask Winter  (Read 51756 times)

Offline fujiwara

  • Master
  • *****
  • Posts: 858
    • View Profile
Re: Ask Winter
« Reply #15 on: June 22, 2007, 11:33:10 PM »
I've gotten to the point with Onin no Ran where I'm ready to start looking at animating some of the scene props (doors and gates, mostly). The operations relating to this seems straight-forward enough, but I have some questions regarding the scene_prop_get_instance. If I have, for example, a scene with 3 identical houses, each with a door prop. I'd like to close two of the doors, say at night, but leave the third one open. How do I know which instance is which? Looking through the operations, it occurs to me that I could use prop_instance_get_position to compare the distance between each of the door instances and some fixed reference point, but what reference to use? An entry point? Another scene prop?

Also, when designing a door that swings, as opposed to one that slides, is it important to model the mesh so that the 'hinge' is on the Y-axis?

Thanks!!!

The horses tend to get their legs caught in the catapult rather than being properly launched.

Offline Winter

  • I am Tek Jansen!
  • Administrator
  • *****
  • Posts: 476
  • MBX Forum owner
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Re: Ask Winter
« Reply #16 on: June 23, 2007, 07:21:14 AM »
I've gotten to the point with Onin no Ran where I'm ready to start looking at animating some of the scene props (doors and gates, mostly). The operations relating to this seems straight-forward enough, but I have some questions regarding the scene_prop_get_instance. If I have, for example, a scene with 3 identical houses, each with a door prop. I'd like to close two of the doors, say at night, but leave the third one open. How do I know which instance is which? Looking through the operations, it occurs to me that I could use prop_instance_get_position to compare the distance between each of the door instances and some fixed reference point, but what reference to use? An entry point? Another scene prop?

Your best bet would be to use Entry Point 0 as a fixed reference point, find out the exact distance between each instance and Entry Point 0, and then manually make condition blocks for each of them based on that exact distance.


Quote
Also, when designing a door that swings, as opposed to one that slides, is it important to model the mesh so that the 'hinge' is on the Y-axis?

Thanks!!!

You should be able to animate it however you like regardless of its original position, since you can move the prop along all 3 axes and rotate left and right. Simply test out what happens during the rotation animation and maybe move the door to the side some distance (the distance between the middle axis of the door model and the doorframe) before rotating it.

Offline fujiwara

  • Master
  • *****
  • Posts: 858
    • View Profile
Re: Ask Winter
« Reply #17 on: June 23, 2007, 06:04:12 PM »
Good call, Winter. Thanks.

Has another quick question: can you explain store_repeat_object and the associated repeat_for_factions, etc?

The horses tend to get their legs caught in the catapult rather than being properly launched.

Highlander

  • Guest
Re: Ask Winter
« Reply #18 on: June 24, 2007, 02:10:17 AM »
I had problems with setting health for troops/agents, so I took a look at the code from Hero&Blade:
  (store_troop_health,":player_agent_hp","trp_player",.2),
  [val_sub,":player_agent_hp",10],
  (troop_set_health,"trp_player",":player_agent_hp"),
Could you explain me what ".2" does?
Some other things:
what are the funktions of "position_get_x", "position_set_x", "position_transform_position_to_parent" and "position_transform_position_to_local"?

Offline Winter

  • I am Tek Jansen!
  • Administrator
  • *****
  • Posts: 476
  • MBX Forum owner
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Re: Ask Winter
« Reply #19 on: June 24, 2007, 01:32:05 PM »
Good call, Winter. Thanks.

Has another quick question: can you explain store_repeat_object and the associated repeat_for_factions, etc?

I would, but I haven't a clue. No examples exist in Native from which I could deduce their function.


I had problems with setting health for troops/agents, so I took a look at the code from Hero&Blade:
  (store_troop_health,":player_agent_hp","trp_player",.2),
  [val_sub,":player_agent_hp",10],
  (troop_set_health,"trp_player",":player_agent_hp"),
Could you explain me what ".2" does?

You'd have to ask Cartread. The number in that field is supposed to be an absolute value, determining the output of the operation, and the only absolutes you should be able to use in that op are 0 and 1.


Quote
Some other things:
what are the funktions of "position_get_x", "position_set_x", "position_transform_position_to_parent" and "position_transform_position_to_local"?

position_get_x stores the X-axis value of the selected position number. It stores only the X value, not the Y or Z values, which is very handy for detailed modification of positions.

Likewise, position_set_x moves the selected position to the input X value.

Transform operations are further 3d locational things that I'll leave to someone else to figure out. Just model a perfect square and put it in-game, get its prop instance and position, use some transform ops on the position, and then use animate to position. Take screens or a movie. It'll be interesting to see.

Offline Hellequin

  • Journeyman
  • ***
  • Posts: 254
    • View Profile
Re: Ask Winter
« Reply #20 on: July 03, 2007, 05:00:52 PM »
I worked with those position operators a lot when doing the potion code for Schattenlander.  See the Schattenlander thread - I'm planning to release it publically (unplanned synchronicity with Yoshi).  You can see most of these operators in use there.

For instance:

The weirdest, but incredibly useful, one is position_transform_to_local; this generates a "local position" which is based on the position & axes of a reference position. 

For instance, if my hero were standing at position 1 = (100,0,1), facing (his facing = his +Y object-axis, IIRC) along the global -X axis, and an apple were located at global position 2 = (200, 50, 5), then the local position obtained by transforming the apple's position local-relative-to the player's position would be worked out as:
- The local +Y axis is the global -X axis, displacement of the apple in these terms is -100;
- The local +X is axis is (think about the positioning here) the global +Y axis, displacement of the apple in these terms is +50;
- Their Z axes are the same, so displacement of the apple is +4.
You'd obtain a special result position, position #3, with coordinates (50,-100,4).  It would also have a facing: whatever facing the apple prop had, within the frame of the player.

You *could* in theory work with this as a real position (global pos (50,-100,4), that facing); as far as I can tell, that would be legal, although it would 98% of the time produce gibberish in-game.  However, more likely is that you want to do some local operations within the "frame" dictated by that relative-to-this base position.  For instance, I want the apple to fly 10m (1000 units) in the direction the player is facing.  Without the position_transform_to_local operation, this would have required a whole bunch of getting-of-rotations and so forth, just to figure out what "the direction the player is facing" meant to the apple.  But with this new, local, position, it's easy.  One position_move_y of the result position (NOT the apple's original position) by 1000 units would give it coordinates of (50, 900, 4).  Still meaningless...

...until we then apply the reverse transform, position_transform_position_to_parent.  This turns the now-modified relative position, plus the reference position, into a final position in global terms.  This is a new position, call it position #4; the coordinates would be, um, (-800, 50, 5).  Now we animate the apple prop to move to this position, and it flies 10m in the direction the player was facing... without us ever needing to actually know any of those explicit coordinates I wrote out in this example.

The key is that the local position, position #3, is operating not using the global definitions of X,Y,Z, and facing angles, but the ones based on the object axes of the "parent position" you used in the transform_to_local.  Transforming (or simply assigning) the X,Y,Z, or angles of the local position all work within this frame of reference.  Then you make it relevant to the game by reversing the transform again, using the same parent position*.

* Under certain circumstances you could conceivably use a different parent position for the return.  F'rinstance, a spell which teleported an object found near-and-in-front-of the player, to the exact same relative position with respect to someone else instead, would use the player as the original reference position, do nothing to the local position, then reinterpret it using the target person's position as the parent.  Then animate the prop in question with time=0 to the new position.

Cheers!

PS: For your amusement, this is all very much the thought processes that go into working in General Relativity.  What I described above is exactly how one works a GR problem - work with "geometric and true" quantities as long as you can (for instance, distance_between_positions does not require knowing any X, Y, Z, or facing angles explicitly), then when that's not enough, find a useful frame of reference where the coordinates will be as simple as possible (such as our +1000 in Y, +0 in X and Z), then come back out to the "unframed" viewpoint as soon as you've generated some useful truth within the frame.

Offline fujiwara

  • Master
  • *****
  • Posts: 858
    • View Profile
Re: Ask Winter
« Reply #21 on: July 05, 2007, 07:34:35 AM »
Excellent work, Hellequin. And kudos to Armagan for coming up with it.

The horses tend to get their legs caught in the catapult rather than being properly launched.

khakhan

  • Guest
Re: Ask Winter
« Reply #22 on: October 23, 2007, 01:46:23 PM »
Hey Just the kinda thread I was looking for... I have a question for ya winter..

I'm looking into making pack horses... They would have there own inventory capacity, the horse's would be in the players inventory (when clicked on in the inventory screen would have its own inventory window pop up - or something like that.
Be purchasable thru the horse merch.
Be limited to weight they can carry, (eg.  old pack horse - 1000(animal weight) x .15 = max load (150), heavy/stubborn pack horse - 1000(animal weight) x .25 = max load (250), pack horse - 1000(animal weight) x .2 = max load (200).
Now would it be easier to make the pack horse from a chest and just have the pack horse model?  or make a horse and add inventory to it?
["zendar_chest???","pack_horse", [("sumpter_horse", (0)].........   OR,
["sumpter_horse","pack_horse", [("sumpter_horse", (0)].........  if this way how do i assign inventory that the player can access via inventory window?

If that is confusing let me know and i will try to explain more..
My apologies in advance and thanks.. 

Offline Winter

  • I am Tek Jansen!
  • Administrator
  • *****
  • Posts: 476
  • MBX Forum owner
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Re: Ask Winter
« Reply #23 on: October 23, 2007, 01:54:55 PM »
Hey Just the kinda thread I was looking for... I have a question for ya winter..

I'm looking into making pack horses... They would have there own inventory capacity, the horse's would be in the players inventory (when clicked on in the inventory screen would have its own inventory window pop up - or something like that.
Be purchasable thru the horse merch.
Be limited to weight they can carry, (eg.  old pack horse - 1000(animal weight) x .15 = max load (150), heavy/stubborn pack horse - 1000(animal weight) x .25 = max load (250), pack horse - 1000(animal weight) x .2 = max load (200).
Now would it be easier to make the pack horse from a chest and just have the pack horse model?  or make a horse and add inventory to it?
["zendar_chest???","pack_horse", [("sumpter_horse", (0)].........   OR,
["sumpter_horse","pack_horse", [("sumpter_horse", (0)].........  if this way how do i assign inventory that the player can access via inventory window?

If that is confusing let me know and i will try to explain more..
My apologies in advance and thanks.. 

It's not a question of what would be easier. It's more a question of whether or not it can be done at all, because it's certainly not possible the way you describe it. There are no triggers in the inventory screen that could be modified to produce extra behaviour on mouseclick of an inventory item.

With an alternate trigger, such as a dialogue entry or game menu, it would be a possible but very ugly hack. And the horse couldn't be rideable or it would lose all its inventory if it ever went lame.

khakhan

  • Guest
Re: Ask Winter
« Reply #24 on: October 23, 2007, 02:57:53 PM »
hmmm.. yeah the horse in this case was never meant to be rideable.. just an inventory item acts only like a "chest".  Maybe show up in map mode behind your player (attached caravan grafx behind player horse??)

what about if the pack horse added directly too your inventory mangament skill?  and incorporated a encumberance modifier?

 

Offline Winter

  • I am Tek Jansen!
  • Administrator
  • *****
  • Posts: 476
  • MBX Forum owner
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Re: Ask Winter
« Reply #25 on: October 24, 2007, 01:56:21 AM »
what about if the pack horse added directly too your inventory mangament skill?  and incorporated a encumberance modifier?

That would be a lot easier to do, although an encumbrance modifier wouldn't really be feasible.

Just create a simple trigger with a timer of 0 or 0.1. Make it raise the player's inventory management skill by the number of pack horses he has in current inventory, minus the number of pack horses he had the last time the trigger checked it (store this in a troop slot on the player or in a global var). This should raise and lower the inventory management skill appropriately.

Highlander

  • Guest
Re: Ask Winter
« Reply #26 on: October 24, 2007, 05:41:59 AM »
Is there an easy way to tell if an agent is riding a horse?

Offline Winter

  • I am Tek Jansen!
  • Administrator
  • *****
  • Posts: 476
  • MBX Forum owner
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Re: Ask Winter
« Reply #27 on: October 24, 2007, 06:18:03 AM »
Is there an easy way to tell if an agent is riding a horse?

Yes. It's done in the new Native code, like so:

                   (agent_get_horse, ":horse_agent", <agent>),
                   (ge, ":horse_agent", 0),

Inukshuk

  • Guest
Re: Ask Winter
« Reply #28 on: October 25, 2007, 07:32:59 AM »
I posted a problem in the "strange never before seen assertion errors thread", and to be honest, we all seem a bit confused. I followed parts 1 and 2 of the official documentation for the module system, but after I compile, and click "Start new game" in the main menu, I get this assertion failure. It even happens If you don't change any of the files in the module system (apart from, of course, the directory in module_info.py).

Microsoft Visual C++ Runtime Library                       X
------------------------------------------------------------------
Assertion failed!

Program: C:\Program Files\Mount&Blade\mount&blade.exe
File: e:\develop\mb\program\src\troop.h
Line: 1169

Expression: rgl_between(skill_level,0,(skills[skill_no].max_level + 1))

For information on how your program can cause assertion
failure, see the Visual C++ documentation on asserts

(Press Retry to debug the application - JIT must be enabled)

  Abort                       Retry                      Ignore


We came up with lots of possibilities in that thread, but we still haven't found a solution. Would it be ok if you could quickly drop in on the thread and see if you could throw some light on anything?

This is the thread: http://mbx.streetofeyes.com/index.php/topic,792.0.html

My first post is towards the end of page 1, and we keep going from there.

Offline Fisheye

  • Blues Brother
  • Moderator
  • *****
  • Posts: 427
  • My scalp's so bright, I gotta wear shades.
    • View Profile
Re: Ask Winter
« Reply #29 on: October 25, 2007, 08:51:37 AM »
Too much rubbish on that thread to read.

I've had this error countless times. It's just a misplaced or missing comma.