Easygoing Eyebeast Thralni Posted August 28, 2008 Share Posted August 28, 2008 Got a problem here... I have a monster in my scenario, that should be constantly trying to follow the party, and it does that, that's all working right. But, it should not be doing that as fast as it does it now. problem is this: I want it to only take two steps, yet now it's taking a lot more, three or even four. In the datacscript I made sure the ap bonus of this monster is -2 (Hoping that the normal amount of ap is 4). So, i need a way to solve this. I've been thinking of ways, but maybe you guys can come up with better stuff. My idea was a variable gradually decreasing: Code: int action;action = 2;//monster follows partyaction = action - 1;// the monster takes a step, and action decreases. Then when it has reached 0:if (action == 0) {action = 2;end_combat_turn(); // (or whatever the call's name was) This bit of code is rather ppor in appearnce, I know. That's because I was too lazy to take the actual script and put these bits in the correct spots. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 28, 2008 Share Posted August 28, 2008 That sounds about like what I would have suggested trying, so are you asking because you're not sure if it will work, or because it didn't work? If the former is the case, then I'd say try it, as it seems like your best shot, unless someone else has a better idea. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Thralni Posted August 28, 2008 Author Share Posted August 28, 2008 I'm mainly asking because I wanted to know what guys like you would have done, and not waste again a few hours on things that won't work anyway. So, I'll try this and come back when I tested it. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Nioca Posted August 28, 2008 Share Posted August 28, 2008 Unfortunately, negative AP bonuses don't work. The monster will still have four AP. That said, the above script should work. Out of curiosity, how do you plan to reduce action with each step? Quote Link to comment Share on other sites More sharing options...
Kyshakk Koan Smoo Posted August 28, 2008 Share Posted August 28, 2008 Um... There is a deduct_ap call. Just use that in the creature's script. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 28, 2008 Share Posted August 28, 2008 Nioca: "action = action - 1;" 'action' is Thralni's variable which is used to stop the creature script from running when it's run enough. Smoo makes a good point: It may work better to just deduct extra AP before letting the creature move. One extra AP deducted each time would hopefully halve the creature's speed. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Nioca Posted August 28, 2008 Share Posted August 28, 2008 Originally Posted By: Niemand Nioca: "action = action - 1;" 'action' is Thralni's variable which is used to stop the creature script from running when it's run enough. Yeah, I know that. I mean, not having seen the creature's action itself, how exactly will it get reduced? It appears to be after the whole string of action, but it could lead to problems if the code can make the monster take more than one step in a single run. Assuming, of course, that you don't decide to do as Smoo suggested. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted August 28, 2008 Share Posted August 28, 2008 I'd go with Smoo's idea. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Thralni Posted August 28, 2008 Author Share Posted August 28, 2008 Christ, your right Smoo! Completely forgot about that. I shall use that, and if it works, hooray. Otherwise, I'll just use what I showed in this thread. Nioca: actually, what I figured later, is that I should start at 0, then add 1 every time the monster takes a step, and when it reaches 2, set it back to 0 and end the turn. I'll try Smoo's suggestion first, though. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 28, 2008 Share Posted August 28, 2008 Nioca: Thralni's method is elegant in that it doesn't need to know or alter the AP, as long as the movement call only takes one step at a time and the game's creature script driver works by calling the creature script repeatedly until the creature is out of AP. Smoo's idea, on the other hand, is nice because it relies less on the details of how Jeff programmed the game to run creature scripts. EDIT: I did a little testing, and it appears that in combat mode the game does keep running a creature's script until it uses up its AP, and furthermore calling do_attack() only causes the creature to take one step at a time if the creature decided to walk. Negative cr_ap_bonus values definitely do not work, I tried a bonus of -2 on a soldier, and it started its turn with 8 AP, not 2. Go figure. For the curious, my testing method was to make a duplicate of basicnpc, in which I replaced every do_attack() call with this block: Code: clear_buffer();append_string("Current AP: ");append_number(my_ap());get_buffer_text(str);print_str(str);do_attack(); Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Thralni Posted August 28, 2008 Author Share Posted August 28, 2008 Niemand: 8 AP. Wow. And yeah, I gues you're right about my method... Thanks I started doubting now abotu what method to use. I think I'll just use Smoo' method, and if I see it doesn't work as expected, I'll do what I suggested earlier. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Thralni Posted August 29, 2008 Author Share Posted August 29, 2008 In the end I used the method I suggested. I also wanted to monsters that took only three steps, and that couldn't have been done neatly with deduct_ap. I realize I could have given them an extra 2 ap with the datascript, but I voted aginst that. Anyway, it works as I wanted now, and that's the important thing. 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.