ID:177667
Aug 13 2002, 6:18 am
|
|
I only ask this because I haven't a clue on how to do so. I will limit myself in asking question so I should hope his is the only thing I need to ask. How would I make a turf that disables your ability to fire and when shot at and hits the turf it goes to pain.dmi then vanishes. This is to prevent people from firing into and out of the respawning area.
|
In response to Lummox JR
|
|
sorry yeh the bullet. the other bullet the laser and the other laser
|
In response to Codesterz
|
|
the bullets are non dense. here I'll show u the code
obj/Weapon var speed damage Standard_Pistol name = "Standard Pistol" icon = 'main.dmi' icon_state = "bullet" speed = 1 damage = 10 client/Center() mob.Fire(mob, mob.dir) mob/proc/Fire(var/mob/ch, var/dir) if(usr.ammo <=0) usr << "You're out of ammunition!!!" return else usr.ammo-=1 var/obj/Weapon/O = new /obj/Weapon/Standard_Pistol O.dir = ch.dir O.loc = ch.loc while(O) step(O, dir) var/turf/Y = get_step(O, O.dir) if(!Y) del(O) break var/turf/X = O.loc if(X.density && X.type != /obj/wall) // Make sure that it isn't water del(O) break for(var/mob/M as mob in X) if(M == ch) continue Damage(M, O.damage) flick(/turf/Overlays/Pain, M) spawn(4) M.overlays -= /turf/Overlays/Pain sleep(O.speed) |
In response to Codesterz
|
|
Codesterz wrote:
sorry yeh the bullet. the other bullet the laser and the other laser What the heck is that last sentence supposed to mean? I can't make heads or tails or the other tails and the other head with the tails and the heads and the head and the tail of it. Lummox JR |
In response to Lummox JR
|
|
yeh the bullet or projectile whatever u want to call it
|
In response to Codesterz
|
|
Please help I would like to host soon.
|
In response to Codesterz
|
|
Codesterz wrote:
while(O) Okay, this proc actually looks pretty good as a starting point. I quoted the key section here because that's where we'll modify it. One thing I noticed: There's no check for wither Y is a wall or not, so bullets will go through walls. I'm not sure if this was intentional. Let's make a change to the atoms: Give them a few new vars and procs: atom Notice how this change works? Each atom determines whether you can fire from there or not, and what happens if you try to shoot a bullet in. To check on whether you can fire or not, you'd have to put this early in the firing proc: var/atom/L=loc And to check on the bullet's progress as it moves: while(O) I changed around your X and Y a bit. In the setup you were using, Y was actually a step ahead of the bullet's next position, and X was the new position itself; a bullet could get deleted prematurely. But do you see how this works? In this proc, the new turf is checked to see if it stops bullets. If it does, the bullet stops there. If it doesn't, it then checks to see if the area stops bullets. And if the bullet's allowed to go in, then it hits every single obj or mob in the turf, but only stops if it hits anything that will stop it. To go back to your question now, you can set up a respawn area with this: area/spawnpoint Lummox JR |
In response to Lummox JR
|
|
Lummox JR If your so good at programming why don't you make more games???
|
In response to Lummox JR
|
|
There is one error I am having...
loading MCU Deathmatch.dme Fire.dm:104:error: Y: expected end of statement MCU Deathmatch.dmb - 1 error, 0 warnings (double-click on an error to jump to it) I have the error being ponted at while(O) var/turf/Y = get_step(O, O.dir) if(!Y) del(O) return O.loc=Y // instead of doing step() earlier L=Y // this is in the same proc, so L should still be defined from above while(L) if(Y.stopbullet) Y.BulletHit(src,O) del(O) L=L.loc var/hits=0 for(var/atom/A in Y) Y.BulletHit(src,O) <------The error is right here if(Y.stopbullet) ++hits if(hits) del(O);break sleep(O.speed |
In response to Codesterz
|
|
Codesterz wrote:
Lummox JR If your so good at programming why don't you make more games??? Partly it's a time issue--also it's a planning one. I haven't been inspired to make the kinds of simple games I'm good at coming up with quick solutions for, because others are already covering that ground. It's easier to write code for a quick projectile system for someone else's game than to write a more in-depth one for my own. The projects I have undertaken tend to focus on different areas, though. Incursion, for example, saw a lot of work in the area of map generation, dealing with all those little icons, and so on. Those kinds of details don't lend themselves well to other projects. My newest project, the one among my stable of ideas most likely to become a full-fledged game, involves smooth movement and physics, which also don't apply to the usual RPG issues like opening doors or managing inventory. However, I may be in a position later to put out a really good library for the physics engine I'm making, so hopefully it will see use in a lot of other games. Modeling the physics has been a slow process and not an easy one, as you can well imagine; I'm not even sure yet how well this game is gonna run, but it's worth the effort to give it all I can, and try to optimze later if possible. So the short answer is, the kinds of code you've seen from me on the forums are good as snippets in other games, but I haven't found a good place to use a lot of those snippets together in a single game of my own, because I've been building very different types of games. Eventually I do plan to make an RPG, a Roguelike of some stripe if I can manage it, but it's not the focus of my attention. I still do, however, experiment with inventory systems and map generators for that project as the mood strikes me. Lummox JR |
In response to Codesterz
|
|
for(var/atom/A in Y) Not sure if this is the specific error it's stopping on, but you're missing a close parenthesis on the last line. Also, why are you cycling through the atoms in Y, assigning the variable A to the atom, and then not using that variable? |
In response to Codesterz
|
|
Codesterz wrote:
for(var/atom/A in Y) Slight mistake on my part in this code. It should read like this: for(var/atom/A in Y) Lummox JR |
In response to Lummox JR
|
|
Lummox still getting same error on it says
loading MCU Deathmatch.dme Fire.dm:256:error: A: expected end of statement MCU Deathmatch.dmb - 1 error, 0 warnings (double-click on an error to jump to it) |
Slight ambiguity here: "...and when shot at and hits the turf it goes to pain.dmi then vanishes." What do you mean by "it"? The bullet?
How you approach this problem depends on how you handle projectiles. Are you using projectiles that have their own movement procs, or are they dense objs relying on the built-in walk() proc and Bump()?
Lummox JR