ID:165285
 
Hi, im looking for any AOE(Area of effect) codes as in u do a spell/skill and an area is affected and takes some HP away from any1 in it. I also want a good projectile code which takes away health, i tried editing 1 but its gliched and soent work. Plz help ty
In response to Mecha Destroyer JD
That doesn't help, at all don't be rude.

Post the RIGHT info/Bwicki Page.

...

obj/spells //you should know
icon = 'spells.dmi' //icon
blahblah //spell name
icon_state = "spell icon state" //you know how to use those right?
layer = MOB_LAYER+1 //places it on the screem

mob/players
spells // healing spells (cle is short for cleric, a class that was removed as rise of heroes progressed further along and I redid the character structure.)
verb //verb
Blahblah() //verb name
set category = "Spells" //makes a new section for spells
BlahblaH() //calls the BlahblaH proc

proc/BlahblaH()
if (MP < 20+(blahblahlevel*3))
usr << "Not enough MP"
else
var/testmonsters=0
var/mob/enemies/M
for (M as mob in view(5))
if (istype(M,/mob/enemies))
testmonsters=1
if(testmonsters==1) // making sure that there is atleast 1 monster nearby
MP -= 20+(blahblahlevel*3) // decrement MP by cost

//lots of visual junk =]
missile(/obj/spells/blahblah,usr,locate(usr.x,usr.y+5,usr.z))
missile(/obj/spells/blahblah,usr,locate(usr.x,usr.y-5,usr.z))
missile(/obj/spells/blahblah,usr,locate(usr.x+5,usr.y,usr.z))
missile(/obj/spells/blahblah,usr,locate(usr.x-5,usr.y,usr.z))
missile(/obj/spells/blahblah,usr,locate(usr.x+5,usr.y+5,usr.z))
missile(/obj/spells/blahblah,usr,locate(usr.x-5,usr.y-5,usr.z))
missile(/obj/spells/blahblah,usr,locate(usr.x+5,usr.y-5,usr.z))
missile(/obj/spells/blahblah,usr,locate(usr.x-5,usr.y+5,usr.z))
sleep(2)
missile(/obj/spells/blahblah,locate(usr.x+5,usr.y,usr.z),locate(usr.x+3,usr.y+5,usr.z))
missile(/obj/spells/blahblah,locate(usr.x-5,usr.y,usr.z),locate(usr.x-3,usr.y-5,usr.z))
missile(/obj/spells/blahblah,locate(usr.x,usr.y-5,usr.z),locate(usr.x+5,usr.y-3,usr.z))
missile(/obj/spells/blahblah,locate(usr.x,usr.y+5,usr.z),locate(usr.x-5,usr.y+3,usr.z))
missile(/obj/spells/blahblah,locate(usr.x+1,usr.y-2,usr.z),locate(usr.x+2,usr.y+1,usr.z))
missile(/obj/spells/blahblah,locate(usr.x-2,usr.y-1,usr.z),locate(usr.x+1,usr.y-2,usr.z))
missile(/obj/spells/blahblah,locate(usr.x-1,usr.y+2,usr.z),locate(usr.x-2,usr.y-1,usr.z))
missile(/obj/spells/blahblah,locate(usr.x+2,usr.y+1,usr.z),locate(usr.x-1,usr.y+2,usr.z))
sleep(1)
//for each enemy nearby
for (M as mob in view(5))
if (istype(M,/mob/enemies))


If you know how to code, you can use stuff from that.
In response to Dark Bahamut
The method which Dark Bahamut posted is not the way you want to go. Further, if you're looking for "codes" to plug into a project, you're not going to find any; programs are like animals, and you can't just mix and match them. You can't give a zebra a heart transplant from an aligator, the parts won't match up or work together. If you want area of effect spells in your game, you're going to have to program them yourself.

That being said, people here will be more than willing to help you learn how to program anything for your project. An area of effect spells consists of several parts:
  1. A way for the user to cast the spell
  2. A function which casts the spell
  3. An area to apply the spell to
  4. A way to pick out which targets in that area will be effected
  5. An effect which the spell has on each target in that area
Once you break a problem down into simple steps, like how I've done it above, YOU will be able to program each part with little difficulty.

The difficulty you will encounter will be bacause you don't know enough about programming to make what you now know you need to make. That's where we come in. Try out those steps I've outlined above, if you have any problems, come back here with an example of how you tried to do it.
In response to IainPeregrine
Iain, it doesn't work because A: I forgot to paste all of my spell code, and B: DONT COPY/PASTE SOMETHING THAT BIG!
In response to Dark Bahamut
Dark Bahamut wrote:
Iain, it doesn't work because A: I forgot to paste all of my spell code, and B: DONT COPY/PASTE SOMETHING THAT BIG!

I was actually refering to your "visual junk" area. That should be done with nested for loops, and you should use regular x, y, and z instead of usr.x etc. Usr refers to the person using the verb, and may not always be the correct object when you call it from inside a proc. Even if user was another mob, in this case you'd still want the spell to come from the mob whom that proc belongs to, i.e. src. I told Poal not to use your code example because it will be confusing for him, and he'll end up in a worse state than he normally is.
In response to IainPeregrine
So? Who cares if the code isn't "effient" or whatever, if it works, who cares.
In response to Dark Bahamut
Dark Bahamut wrote:
So? Who cares if the code isn't "effient" or whatever, if it works, who cares.

You say that now, tell you have lots of inefficient code in your game and your game gets so laggy it's becomes unplayable
In response to Dark Bahamut
Dark Bahamut wrote:
So? Who cares if the code isn't "effient" or whatever, if it works, who cares.

If code just plain isn't good, it shouldn't be offered as code help, whether it works or not. This goes triple when helping a newbie. Typically such code only "works" in very limited circumstances anyway, and breaks easily.

Lummox JR
In response to Lummox JR
Well fine, I get bashed when I'm trying to help a newbie by giving him parts of a spell code I made, god FORBID I try to help a newbie >.>
In response to Dark Bahamut
Dark Bahamut wrote:
Well fine, I get bashed when I'm trying to help a newbie by giving him parts of a spell code I made, god FORBID I try to help a newbie >.>

Nobody's suggesting you shouldn't help. It's great that you want to help. But such help should be helpful, so code that teaches bad techniques is counterproductive. It's another thing if you know the code has issues and can warn the person about that, but the attitude that "If it works, it's good enough" is going to lead both you and them the wrong way. That's really all anyone is on about here.

Lummox JR
In response to Lummox JR
Well "if it works, it's good enough" is standard LOGIC.
In response to Dark Bahamut
Dark Bahamut wrote:
Well "if it works, it's good enough" is standard LOGIC.

You have to make things "bulletproof" in programming. Just working like they said isn't good enough. Als to your first post, being rude would be callin him/her a name, which I didn't. And yes it does help AT ALL; it helps the poster get better help in the future.
In response to Dark Bahamut
Dark Bahamut wrote:
Well "if it works, it's good enough" is standard LOGIC.

If you honestly believe that then go ahead and apply it to your work. But as Lummox said, don't teach others that same belief. Because in the future when you may have understood that while your code may work now it may not work in the future, you'll have a dozen developers running around teaching people your old beliefs, which is going to lead to this exact same situation.

Just don't teach others that belief, and we'll all be happy. ;)
In response to Android Data
Getting back on topic here. An easy way to use AOE is when the main target is hit, check for other players (or monsters) around him using view() or oview(). If there are some, deal damage to them too. Of course there are other things to do besides that, like it the spells doesn't hit a mob (or whatever the case may be).