I need a code that can stops movement of all mobs in 2 spaces from usr then dmges them, for non moving use canmove, also my script works fine its just that it only freezes 1 target dmgs the then goes to other target after other target dies freezes it even tho it's not in 2 spaces from usr and more dmgs then so on, here what i made so far
mob/verb
SixtyFourPalms()
set category = "Jutsu"
set name = "8 Triagrams 64 Palms"
if(usr.using == 0&&usr.canmove==1)
for(var/mob/E in oview(2,usr))
usr.using = 1
var/two = usr.tai*2
var/four = usr.tai*4
var/eight = usr.tai*8
var/sixteen = usr.tai*16
var/thirtytwo = usr.tai*32
var/sixtyfour = usr.tai*64
usr.canmove = 0
E.canmove = 0
flick('palmsoverlay.dmi',usr)
sleep(10)
var/obj/Mid/Midr = new /obj/Mid
var/obj/L/Lr = new /obj/L
var/obj/R/Rr = new /obj/R
var/obj/B/Br = new /obj/B
var/obj/T/Tr = new /obj/T
var/obj/TR/TRr = new /obj/TR
var /obj/BR/BRr = new /obj/BR
var/obj/TL/TLr = new /obj/TL
var/obj/BL/BLr = new /obj/BL
Midr.loc = locate(usr.x,usr.y,usr.z)
Rr.loc = locate(usr.x+1,usr.y,usr.z)
Lr.loc = locate(usr.x-1,usr.y,usr.z)
Br.loc = locate(usr.x,usr.y-1,usr.z)
Tr.loc = locate(usr.x,usr.y+1,usr.z)
TRr.loc = locate(usr.x+1,usr.y+1,usr.z)
TLr.loc = locate(usr.x-1,usr.y+1,usr.z)
BRr.loc = locate(usr.x+1,usr.y-1,usr.z)
BLr.loc = locate(usr.x-1,usr.y-1,usr.z)
view()<<"[usr] says: 8 Triagrams 64 Palms!"
usr.overlays += 'strikes.dmi'
view()<<"[usr] says: 2 Palms!"
view()<<"[E.name] took [two] damage from [usr]'s 64 Palms."
E.hp -= two
Die()
sleep(10)
if(E)
view()<<"[usr] says: 4 Palms!"
view()<<"[E.name] took [four] damage from [usr]'s 64 Palms."
E.hp -= four
Die()
sleep(20)
if(E)
view()<<"[usr] says: 8 Palms!"
view()<<"[E.name] took [eight] damage from [usr]'s 64 Palms."
E.hp -= eight
Die()
sleep(30)
if(E)
view()<<"[usr] says: 16 Palms!"
view()<<"[E.name] took [sixteen] damage from [usr]'s 64 Palms."
E.hp -= sixteen
Die()
sleep(40)
if(E)
view()<<"[usr] says: 32 Palms!"
view()<<"[E.name] took [thirtytwo] damage from [usr]'s 64 Palms."
E.hp -= thirtytwo
Die()
sleep(50)
if(E)
view()<<"[usr] says: 64 Palms!"
view()<<"[E.name] took [sixtyfour] damage from [usr]'s 64 Palms."
E.hp -= sixtyfour
sleep(60)
usr.overlays -= 'strikes.dmi'
E.canmove = 1
usr.using = 0
Die()
else
usr.overlays -= 'strikes.dmi'
usr<<"You end 64 palms because there are no more opponents in range."
del(Tr)
del(Br)
del(Rr)
del(Lr)
del(BRr)
del(BLr)
del(TRr)
del(TLr)
del(Midr)
usr.canmove = 1
usr.using = 0
else
usr.overlays -= 'strikes.dmi'
usr<<"You end 64 palms because there are no more opponents in range."
del(Tr)
del(Br)
del(Rr)
del(Lr)
del(BRr)
del(BLr)
del(TRr)
del(TLr)
del(Midr)
usr.canmove = 1
usr.using = 0
else
usr.overlays -= 'strikes.dmi'
usr<<"You end 64 palms because there are no more opponents in range."
del(Tr)
del(Br)
del(Rr)
del(Lr)
del(BRr)
del(BLr)
del(TRr)
del(TLr)
del(Midr)
usr.canmove = 1
usr.using = 0
else
usr.overlays -= 'strikes.dmi'
usr<<"You end 64 palms because there are no more opponents in range."
del(Tr)
del(Br)
del(Rr)
del(Lr)
del(BRr)
del(BLr)
del(TRr)
del(TLr)
del(Midr)
usr.canmove = 1
usr.using = 0
else
usr.overlays -= 'strikes.dmi'
usr<<"You end 64 palms because there are no more opponents in range."
del(Tr)
del(Br)
del(Rr)
del(Lr)
del(BRr)
del(BLr)
del(TRr)
del(TLr)
del(Midr)
usr.canmove = 1
usr.using = 0
else
usr<<"You can't use this right now!"
like i said just make it that freezes all mobs in area and dmgs them
ID:160343
Sep 28 2008, 2:55 am
|
|
It's doing it that way because you are sleeping inside the for-loop, so it's sleeping once per iteration of the loop.
You need either ... or for(var/mob/E in oview(usr, 2)) I would prefer the first version. |
What you want is an AoE based attack? I'd use something like the below o.O But that's just me.
mob/verb/64Palm(var/mob/M in oview(2,usr)) Or you might use something like the ripped versions' Katon Goukakyuu Jutsu (Great Fireball Technique) only use the entire object tree rather than each individual object... for(mob/M in oview(2,usr)) I don't know if this second bit of coding will work since I just kind of hamster-balled it. |
In response to Loduwijk
|
|
Note it's more beneficial and robust to reuse the same list for the second loop:
var/list/L = oview(usr, 2) |
Do something less ugly, like:
mob/verb I just copy n pasted that huge chunk in the middle, cause I dont want to really compress it for you, so if there is an error in that section say so. But try locating it when making it new to save 8 lines of code. like: var/obj/L/Lr = new(locate(x-1,y,z) And instead of running the chance of messing up and having to restart all of your wrok, use modular programming, that use procs to hold all the if() checks, so you can easily chnage them instead of having to change every attack you have. |
In response to Bakasensei
|
|
I used your example as a template and it's saved me from getting a headache everytime I looked at the old coding I had for the palm techniques x.x!! Thanks so much! :D
|
In response to Kaioken
|
|
i've only neen scripting for like 3 days so where would i put that, also the 1st example of the whole thing didn't put a refrence to E so it didn't work
|
In response to Loduwijk
|
|
i fixed it now it kills all in area and stuff but
my prob is for(var/mob/E in oview(2,usr)) if(E) view()<<"[usr] says: 64 Palms!" view()<<"[E.name] took [sixtyfour] damage from [usr]'s 64 Palms." E.hp -= sixtyfour sleep(60) usr.overlays -= 'strikes.dmi' E.canmove = 1 usr.canmove = 1 usr.using = 0 del(Tr) del(Br) del(Rr) del(Lr) del(BRr) del(BLr) del(TRr) del(TLr) del(Midr) Die() else usr<<"You stop using 64 palms because there are no more targets." usr.canmove = 1 usr.using = 0 usr.overlays -= 'strikes.dmi' del(Tr) del(Br) del(Rr) del(Lr) del(BRr) del(BLr) del(TRr) del(TLr) del(Midr) my problem is that it checks if a mob is in 2 spaces then if E is alive it continues but if mob isn't alive goes to ending it but i can't end because there has to because it only goes to that part if there IS a mob is 2 spaces so help plz i need some1 to make it that it can end :( |
In response to IrunoHatake
|
|
IrunoHatake wrote:
i've only neen scripting for like 3 days This isn't related to the thread as a whole, but the term is "programming", not "scripting". DM isn't a script. |
mob
verb
Clone()
set category = "Jutsu"
set name = "Clone Jutsu"
var/mob/Clones/Clone/C = new/mob/Clones/Clone
var/mob/Clones/Clone/D = new/mob/Clones/Clone
C.name = "[usr]"
D.name = "[usr]"
C.loc = locate(usr.x+1,usr.y,usr.x)
D.loc = locate(usr.x-1,usr.y,usr.x)
C.origin = "[usr]"
D.origin = "[usr]"
C.icon = usr.icon
C.icon_state = usr.icon_state
C.overlays += usr.overlays
D.icon = usr.icon
D.icon_state = usr.icon_state
D.overlays += usr.overlays
this script worked fine yesterday but now it doesn't summon anything any more