Magnificent Ornk Swimmin' Salmon Posted September 2, 2006 Share Posted September 2, 2006 Make creatures only move in one compass direction? I want to have all my creatures in group x only move to the west. If something is in their way, then try NW then SW, and if nothing is possible there, then to fidget and say "Hurry, get out of my way." I would do a cutscene, but I think it would be more fun to have the party be able to move about. They will be trying to get east. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted September 2, 2006 Share Posted September 2, 2006 Yes, you could do it, but it would be a good deal of work. I would do it by giving them a creature script that checks the terrain and floor to the west, and if the space is clear, uses relocate_character to actually do the move. Some thing like this: Code: variables dir,do_move,n,x,y;beginstate WHATEVER_STATE_1; dir = 1; //west set_state_continue(WHATEVER_STATE_2);break;beginstate WHATEVER_STATE_2; if((dir < 1) || (dir > 3)){ <complain> end(); } do_move = 1; //find the coordinates of the new location to try if(dir == 1){//west x = char_loc_x(ME) - 1; y = char_loc_y(ME); } else if(dir == 2){//NW x = char_loc_x(ME) - 1; y = char_loc_y(ME) - 1; } else if(dir == 3){//SW x = char_loc_x(ME) - 1; y = char_loc_y(ME) + 1; } //test if the terrain will allow stepping there n = get_terrain(x,y); if(<terrain cannot be stepped on>) do_move = 0; //test if the floor will allow stepping there n = get_floor(x,y); if(<floor cannot be stepped on>) do_move = 0; //make sure no one else is standing there n = char_on_loc(x,y); if(n != -1) do_move = 0; if(do_move == 1){ //if we can move, do it if(dir == 1) set_character_facing(ME,2); else if(dir == 2) set_character_facing(ME,1); else if(dir == 3) set_character_facing(ME,3); relocate_character(ME,x,y); } else{ //otherwise try the next direction dir = dir + 1; set_state_continue(WHATEVER_STATE_2); }break; (Note that this is mostly Avernum script but some pseudocode that needs to be replaced, mainly the state numbers and checking for whether a floor or terrain can be stepped on, which will require checking if the terrain is between 125 and 136, for instance, since these terrains are all boulders, and so on, and likewise for floors. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Fort Posted September 2, 2006 Share Posted September 2, 2006 The above script will be complex to implement because of all the general possibilities it must consider. Since you are the designer, I think you could make the map and script specific to each other and things would be much easier for you. For instance, if the only one narrow corridor or path to go from A to B, then the creature with the script will always move in the cardinal direction toward B because if it were blocked the pathfinding engine would tell it to stop. You can check for this halting and display your message then. That example is pretty restrictive, but I think you get the idea. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.