ID:151116
 
i want to make a weapon that uses the missle proc that goes some thing like this
obj/gun/verb/shoot(mob/M)
missile(/obj/bullet, usr, M)
how would i make it only fire in a straight line from the way the mob is facing when its fired and have it explode when it hits a dense object/mob/turf?
On 4/4/01 2:49 am Haroki wrote:
i want to make a weapon that uses the missle proc that goes some thing like this
obj/gun/verb/shoot(mob/M)
missile(/obj/bullet, usr, M)
how would i make it only fire in a straight line from the way the mob is facing when its fired and have it explode when it hits a dense object/mob/turf?

Simple. Don't use missile() =).

missile() is designed to be graphical-only. That is, you give it a source and a destination, and then it, automatically and non-interactively, moves a graphic from point A to point B.

You probably would have to use s_missile(). s_missile() is a somewhat improvement over the original missile() in that it allows you to have non- graphical-only projectiles. Unfortunately, what mine makes up for in adaptibility it totally lacks in being an actual missile() replacement. When you want a graphical-only missile, use missile(), it's much better for it, and you are guaranteed that if you overrode Enter() for something it would still display. But if you want any of the neat features that come with s_missile, then by all means use it instead. =)

When you fire a bullet with s_missile(), it would Bump() whatever was in the way (as long as you make the bullet object dense when you create it).

So I'll post the s_missile library to the hub, once I get it updated for this version. Hang tight.

(And remember, to use it, download it from the hub and then add the line

#include <Spuzzum/s_missile>

to your world.)


Hang tight, though (like I said). It's not up just yet. It'll be up by around 7:30 PDT.
When you use missile(), you can make it either track the target or simply go to where the target was at the time the missile was fired. Example:

missile(/obj/bullet,usr,M)     //track M
missile(/obj/bullet,usr,M.loc) //fire straight towards M


That doesn't satisfy your other requirement of wanting it to halt when it hits a dense object. To do that, it sounds like Spuzzum has a better solution.

Keep in mind that the missile() instruction operates entirely on the client. That means much less network overhead/lag than a server-side solution. When making a decision like this, I would ask myself: does it make the game more fun? You can always excuse a departure from reality by some explanation such as the bullet passing over the top of somebody's head.

And you could also do a pre-check of the flight path to see if there are any solid objects and if so, make the first one the target of the missile. The step_to() instruction could help you do that.

--Dan
In response to Dan
You can always excuse a departure from reality by some explanation such as the bullet passing over the top of somebody's head.

Actually, sometimes even not explaining it at all makes it more fun. For example, if you can shoot through a wall, don't give some hairbrained solution that the wall is semi-permeable. Just let it stand, and then players will think that they can shoot over top of wall without actually consciously thinking why.

But that's just me. In fact, I like explaining things, but only if the explanation is physically possible, or makes it sound kinda wacky (depending on the game). =)
In response to Dan
> missile(/obj/bullet,usr,M.loc) //fire straight towards M
>


one problem that im having with this is that the projectile doesnt move to the location its meant to it just appears over the usr then disapears again.How can i fix this.Heres the code that im using with it.

obj/training
name = "Training rifle"
verb/shoot(mob/M in oview())
missile(/obj/bullet, usr, M.loc)
M.dp(5,usr)
usr.points += 1
On 4/4/01 2:49 am Haroki wrote:
i want to make a weapon that uses the missle proc that goes some thing like this
obj/gun/verb/shoot(mob/M)
missile(/obj/bullet, usr, M)
how would i make it only fire in a straight line from the way the mob is facing when its fired and have it explode when it hits a dense object/mob/turf?
I can get you some snippets of the missile code I have for dbz-spar. In DBZ-spar the missiles will expload when they hit things and keep going if the person moves out of the way. They can also be shot off to the side by parring them.
In response to Ebonshadow
On 4/6/01 6:52 pm Ebonshadow wrote:
On 4/4/01 2:49 am Haroki wrote:
i want to make a weapon that uses the missle proc that goes some thing like this
obj/gun/verb/shoot(mob/M)
missile(/obj/bullet, usr, M)
how would i make it only fire in a straight line from the way the mob is facing when its fired and have it explode when it hits a dense object/mob/turf?
I can get you some snippets of the missile code I have for dbz-spar. In DBZ-spar the missiles will expload when they hit things and keep going if the person moves out of the way. They can also be shot off to the side by parring them.
thanks that would be a great help =)
In response to Haroki
missile(/obj/bullet, usr, M.loc)

I'm not sure about this, but try changing usr to usr.loc.