ID:159162
 
Im working on a sap move, where your in area of range your health gets drained to 70%. Its magic basically and im trying to make it 5 squares wide in diameter But im having trouble coding it so can someone help me? The problem is the attack itself i have the range, the problem is somewhere within the proc
area/sap
Entered(mob/M)
if(ismob(M))
M.health = M.health*0.7

Though I doubt that's quite what you're after.

Seriously now, you are going to have to explain what the problem is. If you have no code and just don't even know where to begin, then you need to explain what you're trying to accomplish. From what you've said there, my example could technically fit the description even though it's not what you want, or so I'm assuming.
Why, sure. It's all in all pretty simple however (though I have to say you weren't too detailed), so if you're having a lot of trouble in it you'll want to learn some about the language first.
Let's break it down. Use the DM Reference to look up stuff if you don't know them already.
1) When someone uses his Sap Move™, loop through the Area of Range. (Use: for(), range())
2) For each mob in that Area of Range, set his health to 70% of his maximum health, assuming that's what you want. (Use operators: /, *, =)
-But what if his health is already at 70%, or below?
Account for this case somehow.
In response to Kaioken
mob
verb
use_sap()
for(var/mob/M in oview(4,src)) //takes the mobs from oview (basically all but you in a 4x4 radius
if(M.client) //only takes the actual players out of all of the mobs
while(M in oview(4,src)) //starts up a loop that only ends when M (the player) leaves the 4x4 radius
if(M.Health==M.MaxHealth/0.7) //checks to see if the health is already at the 70% amount and if so it doesn't respond
return //that is it not responding
else //if their health was not effected yet..
M.Health=M.MaxHealth/0.7 //drops the health to 0.7 of the max, meaning 70%
sleep(20) //two seconds until it goes back to the top and starts all over again


In theory that could/would/should work and fulfill your wants, it is not tested so let me know..

Added in comments, hope it I corrected my wrongness.
In response to VolksBlade
VolksBlade wrote:
In theory that could/would/should work and fulfill your wants

Let me tell you then; it will 'work', but not quite as desired (the code is quite solid, but will not end up executing as you probably though it would). It's mostly the fault of the presence of while().

it is not tested so let me know..

Even putting that aside, you shouldn't really reply to a question exclusively with a code-throw; you may have helped the person by doing his work for him, but you in retrospect you ultimately haven't helped him because he wouldn't have learned so much about how to do it on his own. IMO you should've at least commented the code or included a small explanation in the post.
In response to Kaioken
Good point, I am sorry, when I was first learning I had some people giving me code and I became dependent on it and started kinda demanding code, then they was like, "we see you are not learning anything from this so.. go read this *links to DM Guide and Reference*" I learned a lot from them doing that and I had forgotten.. thanks, and sorry again.
In response to VolksBlade
Not quite what i was looking for but when i seen your code i knew what was wrong but that was just an outline of what i did thanks tho :P
In response to IDWMno
So in a way I helped you figure it out?
In response to VolksBlade
Yea
In response to IDWMno
IDWMno wrote:
Yea

Awesome, glad I could help =)