Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Pages: 1 2 3 [4]  All

Author Topic: have a 3d char walking and running  (Read 19787 times)

0 Members and 1 Guest are viewing this topic.

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: have a 3d char walking and running
« Reply #45 on: July 11, 2007, 10:29:51 AM »

The Talk() method plays the "talk" animation in channel 0. If I understand it correctly, you need to premanently change the actor's pose. In that case perhaps the most effective way would be to set the idle and talk animations to the kneeling pose instead of using PlayAnim.

Code: WME Script
  1. actor.TalkAnimName = "kneel"; // or whatever the animation is called
  2. actor.IdleAnimName = "kneel";
  3.  

You can set them back once the character stands up again.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: have a 3d char walking and running
« Reply #46 on: July 11, 2007, 10:33:17 AM »

thanks thats it !!!

jbw

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • View Profile
Re: have a 3d char walking and running
« Reply #47 on: July 25, 2007, 03:22:22 AM »

I believe jbw mentioned he developed some debugging script for setting the light position interactively. But I don't know if he's able to share it with the community.

It is no very big secret (and please don't expect too much).

I have started my adventure of adventures from the "wme_demo_3d" example, so:
 - my script system is still similar to it
 - you can apply my code to it and quickly see results

1. All my interactive debug extensions are called from infinite loop of game_daemon.script by:
Code: [Select]
  if (Game.DebugMode) Game.debugkeys();
This is deliberately limited to debug mode only.

2. The main code is placed in the game.script:
Code: [Select]
method debugkeys()
{
  var shift = Keyboard.IsKeyDown(VK_SHIFT); //-- it is smarter to check it once
  //-- some stupid actions on some stupid keys, like:
  if (Keyboard.IsKeyDown("0")) Game.QuitGame(); //-- exit without annoying dialogues ;-)
  //-- and more, and more, and finally:
  var max = 300; //-- reasonably big limit
  var mod = max+max; //-- our numbers will be changed in circular manner with "modulo"
  var inc = 10; //-- increment by tenths is precise enough
  var chg = false; //-- no changes so far
  if (shift) inc = mod-inc; //-- [Shift] key forces decrementing instead of incrementing
  if (Keyboard.IsKeyDown("x") && (shlx != null)) { shlx = ((shlx+max+inc)%mod)-max; chg = true; }
  if (Keyboard.IsKeyDown("y") && (shly != null)) { shly = ((shly+inc)%mod); chg = true; }
  if (Keyboard.IsKeyDown("z") && (shlz != null)) { shlz = ((shlz+max+inc)%mod)-max; chg = true; }
  if (chg) //-- we have changed something
  {
    actor.SetLightPosition(shlx, shly, shlz);
    Game.Msg("shadow casting light:"+shlx+","+shly+","+shlz);
  }
}
Keys 'x', 'y', 'z' leads to change light position toward X, Y or Z axis respectively (with 'Shift' in reverse direction).
Note that this is not 'click', but rather 'depress' handler, so values will be changed continously as long as we hold the key.
For X and Z the range -300..290 was good for me, and Y - 0..590 (negative Y makes no sense).
Checking for 'null' prevents unwanted action before initialization (see below).

3. Globals are placed in base.inc:
Code: [Select]
global shlx;
global shly;
global shlz;
and initialized for each scene in scene.script:
Code: [Select]
if (Scene.shlpos == null) //-- no scene's custom property named 'shlpos'?
{
  shlx = -40; shly = 200; shlz = -40; //-- default for 'trinity'
}
else //-- get shadow light position from custom property
{
  var tmp = new String(Scene.shlpos); tmp = tmp.Split();
  shlx = ToInt(tmp[0]);
  shly = ToInt(tmp[1]);
  shlz = ToInt(tmp[2]);
}
actor.SetLightPosition(shlx, shly, shlz);

Current light position shows itself in debug message area on the screen - we can read it using eyes and keep it by pen-and-paper method ;-)
Catched numbers can be coded permanently as the 'shlpos' property of scene in the form of comma separated list.

I'm sorry for the extended delay, but I'm not reading posts here much frequently. If somebody wishes to get rapid answer please ask me by e-mail.
Logged

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: have a 3d char walking and running
« Reply #48 on: July 25, 2007, 08:30:02 AM »

thanks for sharing this very useful script !!
it makes light placement much more comfortable !!!
greets
stucki
Pages: 1 2 3 [4]  All
 

Page created in 0.072 seconds with 24 queries.