ID:158453
 
I need an attack which creates a turf....but how can i define the location of the created turf? (Actually i just need something what activates when a mob enters it,and deactivates when mob exits)

var/turf/Ice/A = new /turf/Ice/
If you are not going to modify that new object, do not make it an object:
new/path(location)  //  no variable use
var/path/X = new(location) // will create /path
var/path/X = new /path (location)


Remember, replacing turfs at runtime will result with the previous turf being deleted.

As for activation/deactivation, look up Entered() and Exited().
In response to GhostAnime
runtime error: bad loc
proc name: Hail (/mob/verb/Hail)
source file: verbs.dm,6524
usr: Guest-2449684958 (/mob/player)
src: Guest-2449684958 (/mob/player)
call stack:
Guest-2449684958 (/mob/player): Hail()

mob//Attacks
verb
Hail()
set category = "Attacks"
set name = "Hail"
if(usr.HailPP <= 0)
usr << "You are out of PP for this move"
return
if(usr.firing >= 1)
return
if(usr.rest >= 1)
return
usr.HailPP -= 1
view() << "[usr] uses Hail"
var/turf/Hail/A = new /turf/Hail (usr.loc)
var/turf/Hail/B = new /turf/Hail (usr.x,usr.y-1,usr.z)
var/turf/Hail/C = new /turf/Hail (usr.x-1,usr.y,usr.z)
var/turf/Hail/D = new /turf/Hail (usr.x-1,usr.y-1,usr.z)
var/turf/Hail/E = new /turf/Hail (usr.x+1,usr.y,usr.z)
var/turf/Hail/F = new /turf/Hail (usr.x,usr.y+1,usr.z)
var/turf/Hail/G = new /turf/Hail (usr.x+1,usr.y+1,usr.z)
var/turf/Hail/H = new /turf/Hail (usr.x+1,usr.y-1,usr.z)
var/turf/Hail/I = new /turf/Hail (usr.x-1,usr.y+1,usr.z)
var/turf/Hail/J = new /turf/Hail (usr.x+2,usr.y,usr.z)
var/turf/Hail/K = new /turf/Hail (usr.x-2,usr.y,usr.z)
var/turf/Hail/L = new /turf/Hail (usr.x,usr.y+2,usr.z)
var/turf/Hail/N = new /turf/Hail (usr.x,usr.y-2,usr.z)
spawn(300)
del(A)
del(B)
del(C)
del(D)
del(E)
del(F)
del(G)
del(H)
del(I)
del(J)
del(K)
del(L)
del(N)

Well...it creates one....but....it doesn't help....cause replacing a turf...is no no,i just need something that will be there for a while and activate upon Entered() and deactivate upon Exited()
In response to Destrojer
anyone?
In response to Destrojer
Oh god, that is so fugly!

Lets break it apart:
       if(usr.firing >= 1)
return
if(usr.rest >= 1)
return


Do most people forget about ||? Also, you should look up boolean tricks in the DM forum:
if(usr.firing || usr.rest)  //  if firing/rest is TRUE [any value except 0, "" or null]
return


... oh god, the next several hundred lines (exaggeration, I know) is horrible ... you forgot about locate()! You are sending 3 separate arguments instead of 1!! Alternatively, you could have looped through block() and had a few lines in there:
for(x in block(...))
new/turf/X(x)
spawn(300)
del(X)


MOST IMPORTANTLY you did not heed my warning. As soon as those new turfs are deleted, there will be just black spots remaining. I recommend hail being an /obj, with you introducing the custom procedure StepOn() [See [link]]
In response to GhostAnime
Note that, in what you linked, SteppedOn() is what you'd want to use, not StepOn().
In response to Garthor
Ummm....i need a little help with block.

mob//Attacks
verb
Hail()
set category = "Attacks"
set name = "Hail"
if(usr.HailPP <= 0)
usr << "You are out of PP for this move"
return
if(usr.firing >= 1)
return
if(usr.rest >= 1)
return
usr.HailPP -= 1
view() << "[usr] uses Hail"
for(x in block(locate(usr.x-4,usr.y-4,usr.z),locate(usr.x+4,usr.y+4,usr.z)))
var/obj/Hails/X = new/obj/Hails(x)
spawn(300)
del(X)


It sends me to a black screen and doesn't create the obj-s
In response to Destrojer
You need to define something specific for the for() loop to loop through. Just telling it to loop through "x" is like telling it to loop through nothing or everything. Since you want turfs, you want to define the argument as a typepath of turf.

for(var/turf/x in block(blah,blah))


EDIT
Oh wait, since "x" (in your case) has a null value, it's looping through all the null values in that block.

EDIT2
Also, some advice.
var/obj/objects/o = new /obj/o(loc)
//is the same as...
var/obj/objects/o = new(loc)
//...and
new/obj/objects(loc)

The only reason you should use one of the first two methods is when you want to edit the newly created atom's variables after its creation process.