ID:147425
 
Alright I could of sworn I've gotten this to work before but at the moment I'm having problem getting my code to create a new turf when something happens, this is the code -

if(mode == "CTF")
if(src.gotblue == 1)
world<<"[src] has dropped the Dracnid flag"
var/turf/CTF/T = new/turf/CTF/blueflag(src.loc)
T.atorg = 0
if(src.gotred == 1)
world<<"[src] has dropped the Kaotik flag"
var/turf/CTF/T = new/turf/CTF/redflag(src.loc)
T.atorg = 0

What this does is when 'src' dies it checks if the 'src' has the flag (I'm not using contents so it is with variables) if it does it "drops" the flag by creating a new flag in its place, but it is not working. It just won't create a new flag, I believe it is because it is a turf but I don't know. If I can I wish to keep it as variable and not contents, how can I get it to create a turf?

Thanks
//If you want people to be able to "pick up the flags", I would suggest simply using objs instead of turfs:
if(mode == "CTF")
if(src.gotblue == 1)
world<<"[src] has dropped the Dracnid flag"
var/obj/CTF/T = new/obj/CTF/blueflag(src.loc)
T.atorg = 0
if(src.gotred == 1)
world<<"[src] has dropped the Kaotik flag"
var/obj/CTF/T = new/obj/CTF/redflag(src.loc)
T.atorg = 0

//Remember that you will need to recreate these "flags" as objects.
In response to Xallius
I have run into this too, I think the problem is that when you create a turf, it has a null location, and effectively you are trying to move it to a new one, but a turf is not a movable atom. I think you have to use obj like Xallius said. someone correct me if im wrong.
In response to Abra
You're right, and object would be the most logical thing to use, I don't even know why one would think of using a turf. O.o
While I would agree with the suggestions to use objects for this, there is no reason you can't create a new turf at the src's current location. My guess is you are deleting the mob before it gets to this section of the code. Try adding some debugging output to see what is happening. Depending on what type of proc this is, and how it is being called, it is also possible that the proc is checking usr.mode rather than src.mode.
world.log << "Beginning check"
world.log << "mode = [mode], src.mode = [src.mode], usr.mode = [usr.mode]"
if(mode == "CTF")
if(src.gotblue == 1)
world<<"[src] has dropped the Dracnid flag"
world.log << T
var/turf/CTF/T = new/turf/CTF/blueflag(src.loc)
T.atorg = 0
if(src.gotred == 1)
world<<"[src] has dropped the Kaotik flag"
world.log << T
var/turf/CTF/T = new/turf/CTF/redflag(src.loc)
T.atorg = 0
In response to SSJ Radditz
Maybe because the atom he is creating is a truf? O.o
In response to Abra
Wrong, you can create new turfs simply by using new and passing in the turf that is currently where you want it to be.
mob/verb/overturn_grass()
new/turf/dirt(loc)
turf
icon='turf.dmi'
icon_state="grass"
dirt
icon_state="dirt"

The above example could be used by players to create new tiles of dirt at their location, and the grass that was allready there would be deleted since you cannot have more than a single turf to a tile.

Passing in a location at which to create something has nothing to do with the /atom/movable/Move function, and therefor can be done with more than just movable atoms.

Heck, you can even create new areas.
In response to Airjoe
But using a turf wouldn't be of any help with what he's trying to do, thats the point I was getting at.
Ok I tried making it an obj but it didn't work, as I predicted. This is all of the code,

As you've already seen, when a player dies it calls this proc, here it checks if that player has the flag

if(mode == "CTF")
if(src.gotblue == 1)
world<<"[src] has dropped the Dracnid flag"
new/turf/CTF/blueflag(src.loc)
if(src.gotred == 1)
world<<"[src] has dropped the Kaotik flag"
new/turf/CTF/redflag(src.loc)


This is the flag code,

turf/CTF
redflag
name = "Kaotik Flag"
icon_state = "red"
layer = MOB_LAYER+1
Entered(mob/M)
if(istype(M,/mob/usr))
if(M.team == "Dracnid") //Dracnid = blue team
M.gotred = 1 //M has the red flag
M<<"You picked up the enemy's flag! Run Soldier!"
world<<"[M] has picked up the Kaotik flag!"
del(src)
else
if(src.atorg != 1)
world<<"[M] has returned the Kaotik flag!"
for(var/obj/spawnerCTF/O in world) //Checks for the spawner
if(O.z == Level) //if that spawner is on the same map
if(O.whattype == "red")
O.spawning() //spawns a new flag at O.loc
del(src)

I'm not going to put the blue flag here, it is the same code with just the teams switched. Now obviously I have it set so when you enter the location of the flag. I just can't get it to create a new turf
In response to Rifthaven
      if(mode == "CTF")
if(src.gotblue == 1)
world<<"[src] has dropped the Dracnid flag"
new/turf/CTF/blueflag(src)
if(src.gotred == 1)
world<<"[src] has dropped the Kaotik flag"
new/turf/CTF/redflag(src)


Try that. I had a problem similar to this when making a map editor.
In response to Airjoe
Nope, still not working. I think I'll just re-code it and use a different system, thanks for all the help everyone.