STAC Automated Roving Intelligence Combat Routine -- StARICoR -- version 3.0 Written By Colin Campbell (c) 1990 by Creative Insanity All Rights Reserved Permission hereby given for unrestricted non-commercial use provided there is some reference to the original author (i.e. me!) Introduction ============ This is yet another in a massive list of routines that I have compiled over a few months worth of programming with STAC. I've not put it on this disk in a compiled form for a number of very good reasons: - it forces you to type it in and therefore you learn! - I was too engrossed in programming STAC to do it! - It is easier for you to configure it to your requirements as you type it in! The routine is printed below and will work once you have understood a few of the underlying principles of combat routines in general. The first rule is that you have a lot of typing to do in order to allow the player to fight in a realistic way. The second rule is that nothing ever is as simple as you'd like. A good example of the second rule is the ridiculous way STAC was programmed with respect to Special Routines. For some unknown reason, our friendly programmer (Sean Ellis) decided it would be better not to allow the budding amateur to call a Special Routine from within that same Special Routine. Confused? Here's an example: Special Routine 200 message 8000 ; message 8000 = "This don't work" lf lf ; a few line feeds lf if counter 10 = 4 then special 200 message 8001 ; message 8001 = "Neither does this" return The more astute programmers reading this will find a way around it by using repeat....until commands and things. However, in the following combat routine there is no easy way out of this problem. I have done some head-scratching and come up with a way but it is complicated and limits what is possible. If calling Special Routines from themselves were possible then this combat routine could be 1/4 of its present size! Oh well! Enough moaning and on with the routine.....> High Conditions:- IF SET? 101 THEN SPECIAL 60 } REPEAT } MUST be in a grouped IF SET? 101 THEN RESET 100 SPECIAL 50 } sequence like this! PAUSE 200 } UNTIL RESET? 101 } The above is one part of the solution that gets around the problem mentioned previously. Special Routine 50:- (( COUNTER 38 )+ RANDOM 12 +( RANDOM COUNTER 42 )-( RANDOM COUNTER 44 )) SETCNTR 41 (( COUNTER 33 )+ RANDOM 12 +( RANDOM COUNTER 37)-( RANDOM COUNTER 43 )) SETCNTR 40 IF COUNTER 40 > COUNTER 41 THEN SPECIAL 51 IF RESET? 100 AND COUNTER 40 = COUNTER 41 THEN SPECIAL 55 RETURN IF RESET? 100 THEN 2 -COUNT 34 IF RESET? 100 AND RANDOM 12 < COUNTER 35 THEN INC 34 SPECIAL 54 SPECIAL 52 IF RESET? 100 THEN DEC 34 SPECIAL 53 IF RESET? 100 THEN SPECIAL 52 RETURN I don't expect you'll understand this the first time around but if you print out this file you'll be able to refer to what each counter and marker are and read some sense into the above. If, after 2 months you're still stuck then write to me at the address given at the end of this article. I'll do my best to help you. Special Routine 51:- 2 -COUNT 39 IF RANDOM 12 < COUNTER 35 THEN DEC 39 SPECIAL 57 SPECIAL 52 IF RESET? 100 THEN SPECIAL 56 INC 39 SPECIAL 52 RETURN Special Routine 52:- IF COUNTER 39 <= 0 THEN SPECIAL 58 RESET 101 WAIT IF COUNTER 34 <= 0 THEN SPECIAL 59 DEATH OK SET 100 RETURN Special Routine 53:- ; Deals with hard hits by Monster against Player ; Advisable to offer a number of alternatives for each weapon ; and armour combination by using the MESSAGE ( ) Note: An example of the above message random command.....> If the messages for hard hits against player were 1000,1001,1002 and 1003 then the correct command in the above example would be as follows: MESSAGE ( 999 + RANDOM 4 ) ; DON'T TYPE THIS IN!!!! You'll also need to add extra conditions for each monster you could fight. Something along the lines of: IF {fighting a bat} AND {using a sword} AND {wearing shield 5} THEN MESSAGE ( + RANDOM ) ; DON'T TYPE THIS IN!!!!!!!!! Special Routine 54:- ; Deals with weak hits by Monster against Player ; Advisable to offer a number of alternatives for each weapon ; and armour combination by using the MESSAGE ( ) Special Routine 55:- ; Deals with Unresolved Combat rounds ; Advisable to offer a number of alternatives for each weapon ; and armour combination by using the MESSAGE ( ) Special Routine 56:- ; Deals with Weak Hits against Monster ; Advisable to offer a number of alternatives for each weapon ; and armour combination by using the MESSAGE ( ) Special Routine 57:- ; Deals with Hard Hits against Monster ; Advisable to offer a number of alternatives for each weapon ; and armour combination by using the MESSAGE ( ) Special Routine 58:- ; Deals with the Death of Monsters ; Advisable to offer a number of alternative messages which will ; depend upon the type of monster, weapons used, location of fight ; and any other relevant criteria. Use MESSAGE ( ) to print a random message from ; sequentially numbered messages Special Routine 59:- ; Deals with the Death of The Player,i.e. YOU ; Advisable to offer a number of alternative messages which will ; depend upon the type of monster, weapons used, location of fight ; and any other relevant criteria. Use MESSAGE ( ) to print a random message from ; sequentially numbered messages Special Routine 60:- ; This deals with the start of the fight. Its main purpose is ; to set fight parameters, weapons used (by monsters if they ; carry more than one weapon) before combat begins. ; If there are a lot of different combinations of ; parameters/monsters etc. then it may be advisable to jump to ; other specifically written special conditions. To start the routine simple have the command SET 101 in the expected low/local condition. That's the end of the routine but there now follows a list of what each counter and marker does: Where.... COUNTER 30 - Your Initial Skill level COUNTER 31 - " " Stamina level COUNTER 32 - " " Luck level COUNTER 33 - Your Present Skill level COUNTER 34 - " " Stamina level COUNTER 35 - " " Luck level COUNTER 36 - Weapon presently being wielded (objno) COUNTER 37 - Attack Strength Altered by wielded weapon (+/-) COUNTER 44 - Your Armour level (0 is no armour + is effective armour - is really bad armour) Note: The effectiveness of the Armour will depend upon many factors, not least of which is whether the Player/Monster can actually carry and use it properly. E.g. Ultra-Plasma shield is the best shield available (at +8) but unless you are He-Man you wouldn't be able to use it (it weighs about 400lbs) effectively. If you tried then you would be, in effect, using a -8 shield. Complex, isn't it? COUNTER 38 - Monster's Skill level COUNTER 39 - Monster's Stamina level COUNTER 42 - Monster's Attack Strength Altered by its weapon/s COUNTER 44 - Weapon being wielded by Monster (objno) COUNTER 43 - Monster's Armour level ( 0 is no armour + is effective - is really bad) COUNTER 40 - Your Attack Strength COUNTER 41 - Monster's Attack Strength MARKER 100 - Priority Fall-Through Flag ( reset - off ) ( set - on ) MARKER 101 - Fight in Progress Flag ( reset - no fight ) ( set - fight ) This is the end of the article. If you have any queries or if you wish to shoot me for writing such a complicated routine that you've managed to get to work completely wrong then write to: Colin "Bronco" Campbell 21 Aldbury Mews London N9 9JD If you're the sort of person who demands answers straight away and doesn't bother with writing to people then you can contact me on the following telephone number: (081) 364 3982 However, please limit your calling times to after 7pm on any day of the week except Wednesday, Friday and Sunday. If you've got a modem then you can leave a suitably violent missive on the IOWA system addressed to "ccampbell". IOWA can be contacted on (0883) 744164 - 1200/75 - and (0883) 744044 - 2400/2400. In case you're wondering, IOWA is a great place to spend an evening playing one of 5 multi-user adventure games of excellent quality. And the best thing is it's FREE! Bye!!