Sticks and stones

Posted by Garaelb on Sun 20 Jul 2003 09:57 PM — 16 posts, 65,176 views.

#0
will break my bones but bows and arrows are better.

So here I am trying to figure out how to make missile weapons that actually work.

using the Area Editor(tm) - can someone walk me thru it in a step by step process. A ranger without a bow is like a dog without teeth. And what am I to do with all my goblin archers who right now just slap the characters with their bows instead of shooting them with arrows.

And then also how to use a bow as a player and as a mob.

garaelb
USA #1
Unless SMAUG has code support for ranged combat (I'm pretty sure it doesn't) the closest you will be able to get is either writing a new damage noun into the combat routine to simulate the use of arrows, (far more complicated) writing a combat subroutine to handle bow-type weapons and have it use its own set of damage nouns, or (more complicated still) actually code in range weapon support for combat across multiple rooms. The last option is going to be very involved and very complicated and is usually disregarded due to the returns for the effort involved. The only mud I've personally seen with functional ranged combat is a highly modified circle mud but I'm pretty sure they won't give ya their code since it's still a moderately viable site.
#2
according to the help file in the stock game -
Quote:
help fire
FIRE
Syntax: fire <direction> target

This command is for use with bows and arrows. You must have the weapon
type missileweapons, a bow wielded and a quiver or arrows in your inventory.
**This will damage another player and should be used with caution **
*** For smaug release.. use wooden bow and flint from newdark***


and

Quote:
help missile
MISSILE
Missile weapons have the unique ability to fire at one's opponent
from a distance. In order to be successful, the attacker must have a
weapon missile wielded (Only certain weapons are able to be missile wielded)
and must have an appropriate ammunition in inventory.

Example: To use a bow and arrow, one must have a bow missile wielded and
have an arrow in inventory.

See help fire and help fletch


but nothing to tell you how to make them (bows and arrows) in the Area Editor
USA #3
Well, given that info, I'd check the code behind the fire function, I'd guess its do_fire but you may have to check the command table to get the proper function. In that function will be the itemtype and other info necessary to make whatever code there is for ranged combat actually work.
#4
well I don't use a version of SMAUG that I can re-compile so code modifications are kinda mute. Just need to know how to make them and use them in conjunction with the AREA EDITOR
USA #5
You dont have to be able to compile the code to have it for reference. I personally don't use smaug or the area editor Nick offers so I cant really help ya there, but if ya download the smaug source, do a search on the directory you unzip it to for "fire" and do_fire you should find the files in which the code behind the fire mechanic is written. Check the specific function for which item type it checks for then flag your newly created obj as such in the area editor, assuming it supports the flags in the first place.
Australia Forum Administrator #6
Quote:

Just need to know how to make them and use them in conjunction with the AREA EDITOR


This is really an Area Editor question, right? It really belongs in the Area Editor section to get the maximum response, otherwise people think you are asking a general question about SMAUG.

Anyway, what is the problem exactly? I am looking at newdark.are in the Area Editor, by searching for "arrow" I see an example arrow, type "projectile", flags "Take Hold Missile". That seems a good start.

I also see "a wooden bow", type "crossbow", flags "Take Missile".

You could duplicate those, or make similar ones from scratch. So what is the question exactly? How to duplicate one? How to make one? You have made one and it doesn't work?
#7
My appologies Nick for the misplaced topic.

Well I made a bow and I made an arrow and I made a quiver but I can't seem to get mobs to use the bow and arrows correctly nor can I use them as a player. All I seem to be able to do with the bow is use it as a club, and the arrows are worthless. LOL

Also can there be 'thrown' missle weapons or only launched ones? I just get a little confused with it sometimes. I vewy vewy swow sometimes. eheheheeh...

garaelb
Australia Forum Administrator #8
You are taking me out of my area a bit here. :)

The Area Editor will set flags and object types, however I'm not always sure how the server will interpret those.

I haven't done arrows or throwing weapons, perhaps someone else here can help.
USA #9
Ya know, it really is amazing how useful a reference source code can be sometimes. After a very quick search thru the 1.4a source available here I found this comment in the middle of the ranged combat system:


/*
 * letsee, if they're high enough.. attack back with fireballs
 * long distance or maybe some minions... go herne! heh..
 *
 * For now, just always miss if not in same room  -Thoric
 */


In essence as cool as the idea behind ranged combat might be, they never got past the "take a shot at someone in the same room and turn yer bow into an overpriced club" stage with it, kinda what I suspected all along. Meanwhile, if anyone wants to do any work on that particular feature for their mud, the functions are in skills.c and that particular comment is in the ranged_got_target function.
USA #10
If I may be so bold, you forgot the following, Meerclar:


    if ( IS_NPC(victim) && xIS_SET(victim->act, ACT_SENTINEL)
    &&   ch->in_room != victim->in_room )
    {
	/*
	 * letsee, if they're high enough.. attack back with fireballs
	 * long distance or maybe some minions... go herne! heh..
	 *
	 * For now, just always miss if not in same room  -Thoric
	 */


So, actually, you always miss if you're attacking a sentinel mob not in your room. That makes sense, since the sentinel will never move, and it would be unfair to let players whack away without danger... In fact, right after the sentinel check:


    if ( number_percent() > 50 || (projectile && weapon
    &&   can_use_skill(ch, number_percent(), gsn_missile_weapons)) )
    {
	if ( projectile )
	    global_retcode = projectile_hit(ch, victim, weapon, projectile, dist );
	else
	    global_retcode = spell_attack( dt, ch->level, ch, victim );
    }


... which is where you actually roll to see if you hit the target. Also notice that if there is no projectile, it does a spell_attack - which implies that there is probably support for ranged spells.

I'm pretty sure that pseudo-ranged combat is completely implemented. It's kind of funky, sure, but it's there.


Getting mobs to use ranged weapons correctly is going to be a toughie, since you need to manually enter a fire command. You need to say: fire east fred. From skills.c:

/*
 * Fire <direction> <target>
 *
 * Fire a projectile from a missile weapon (bow, crossbow, etc)
 *
 * Design by Thoric, coding by Thoric and Tricops.
 *
 * Support code (see projectile_hit(), quiver support, other changes to
 * fight.c, etc by Thoric.
 */


So, a mob would have to know how to "type in" that command. That's the tricky part.

As for doing it as a player, I'm not sure why it doesn't work. If you're in "normal fighting", yes, you'll be whacking with your bow like it was a club, but if you use the fire command there's no reason why it shouldn't work.
Amended on Mon 21 Jul 2003 02:47 PM by David Haley
#11
thanks gang - this will certainly help in the understanding of missile weapons as they relate to SMAUG.

So as a final recap -
Bows on mobs are as useless as screen doors on submarines.

players with missile weapons can use the ranged attacks but only on mobs that are not SENTINALS

esentially after a shot with the bow and arrow the bow becomes a poormans club - possibly to counteract that the game host might consider making the bow with club damage in addition to its missile damage - and make the arrow more lethal on its one shot by giving it high damage points.

lastly - some hotshot codemaster could really gain a lot of brownie points if they designed a code snippit that made ranged weapons work and serve a functional purpose in the game LOTS OF BROWNIE POINTS. :-)

USA #12
See, thats what I get for trying to read someone elses code at 330 in the blazin mornin when Im gettin ready to go to bed. At least I left the file ref so it was easy to find :) Anyway, there's also the consideration of room crowding when dealing with missile combat.... too many ppl/mobs in the room and ya can't fire. As for mobs, there was a subsection dealing with em somewhere in that routine but for the moment I'm just too lazy to go find it again. I would think archer mobs could be brutally effective with a creative mprog though.
#13
Code projectiles as mobiles speedwalking to a mobile and magic arrows as mobiles tracking a mobile, except the problem David Haley points out of having the projectile have to enter the command "kill <target>". Also some players players might stylistically object to seeing the message: "<projectile> has arrived. <projectile> leaves <direction>."
#14
Wifidi said:

Code projectiles as mobiles speedwalking to a mobile and magic arrows as mobiles tracking a mobile, except the problem David Haley points out of having the projectile have to enter the command "kill <target>". Also some players players might stylistically object to seeing the message: "<projectile> has arrived. <projectile> leaves <direction>."

Sorry for the typo's. Causing a 1 or low hitpoint projectile-name mobile to speedwalk and attack, or track and attack, might be achievable via non-echo'ed charm orders, though I have no idea how to code something like that. The thought of being able to get out of the way in time is exciting and the thought of being tracked is terrifying. Another problem is not making the target appear to be fighting against a normal projectile, while fighting against a magic or poisoned projectile might come off appropriately.
#15
I find this to be a very fascinating topic. I actually really like the idea of making projectiles turn into mobiles and i think from an rp perspective would give a little bit of realism to being chased by an evil wizard's fireball and have to quickly provide a defense against it before it hit you. I'm all about adding action into muds when i can, something to get the blood flowing.