Question about script command

modmaker

First time out of the vault
How can I set rotation of critter, who isn't self_obj?
I mean I have (it's only stupid example!!!):

Code:
//...
#define critter1 create_object_sid(PID_CRITTER1,22222,0,-1)

procedure map_enter_p_proc
begin
   //here I need to set rotation of critter1 to 3 (example)
end
//...

Thanks for every useful help.
 
This is just an example...
Code:
if( ( tile_num( self_obj ) == 28471 ) and ( self_cur_rot != 2 ) ) then begin
         animate_rotation(2);
end
I never managed to change dude_obj rotation via script...
I think you can change a critter rotation via the script of another critter... Take a look at ECBDYGRD.ssl in the random encounter folder. This critter script has many other critters do stuff.
Cheers.
 
You can change the rotation of any critter with the anim command:

anim(pointer_obj,ANIMATE_ROTATION,rotation);

Example: if you want to change the rotation of the dude so that he faces the script's object, write this:

Code:
anim(dude_obj,ANIMATE_ROTATION,rotation_to_tile(tile_num(dude_obj),tile_num(self_obj)));
 
Hi, Agrajag. This is good to know, but the piece of code didn't work for me. I tinkered with it some more and I ended with a piece of code:
Code:
variable dude_facing;

dude_facing:=2;

set_local_var(LVAR_Herebefore,1);
  if (sequence == 1) then begin
      if (animated == 0) then begin
         animated := 1;
         game_ui_disable;
         reg_anim_clear(dude_obj);
         reg_anim_begin();
         animate_move_obj_to_tile(dude_obj, DUDE_WATCH_TILE, ANIMATE_RUN);      
         anim(dude_obj,ANIMATE_ROTATION,dude_facing);
         reg_anim_end();
      end

The thing is used for a small cutscene. Dude tryes to talk with a critter, he/she goes to a particular hex and then should face the critter. I only manage to either get dude moving (this is the case of my present code) or get the rotation I want. What's the mistake I'm making? Thanks for your hint :D .
 
Hi there, Sirren :). Well, as far as I know (although I could be wrong - I haven't really tested it that much), you can't animate the dude if the game interface is disabled (the game_ui_disable). I could be wrong though (actually, I hope I'm wrong), but when I last tried to do it, the dude's animations didn't work when the game was disabled (but other critters did animate). Enabling the game made the dude animateable.

In your example, does the dude animate at all (does he rune away like he should)?

You say that the dude either runs to a tile without facing the critter, or he faces the critter without running to the tile. I think that's because you have the animations right next to each other - it sounds as if the last animation you trigger superseeds all the others for that critter. Try using the functions that start with "reg_anim" instead - they're listed in commands.doc. Alternatively, I suppose you could make a timed event to wait until the running is done (or make a new variable is_running, set it to true, and then check if the PC is on the correct tile in the critter_p_proc and if is_running is true, you set it to false and animates the dude so that he faces the right tile). Using the reg_anim functions shouldn't make the animations superseed each other though (and I'm slightly surprised that the animate_move_obj_to_tile and anim seems to be doing that), so the animations would finish before the next one starts.

Hmm, if the animations for the dude works even if the game is disabled, that might be because you didn't use the reg_anim functions - interesting. This calls for an immediate discussion (or at least some testing, hehe)
 
Back
Top