In response to Ssj4justdale
Alright awesome. One more quick question.

Just tested everything out, and it all works. The only issue is if a player is standing on a tile as it turns to lava they don't die like the code suggests. They just float ontop of the lava. Tips?

turf/lava
icon='turfs.dmi'
icon_state="lava"
name = "Lava"
Entered()

world << 'WilhelmScream.ogg'
usr.icon_state="death"
world <<"[usr] has died."
usr.icon_state="ghost"
usr.loc=locate(7,15,1)
alert("You can now spectate the remaining living players.")


Also maybe help me with spectating too upon death?
In response to Manio
If I'm not mistaken, Entered() would only be called if the player moved. You'll have to have to check for mobs (players) in the turf's contents variables as it's changed to lava.
In response to Koshigia
How would one accomplish this?
Call a proc that does the check whenever it changes.
Dale, you do realize that DM doesn't require block statements or semicolons right? I know a lot of people with Java knowledge tend to do it as habit, but I wanted to point out that it's not necessary.

Anyway...

        do
sleep(lava_time*600);
var/newLocation=pick(.);
new/turf/lava(newLocation);
for(var/mob/M in newLocation) // searches the new location for players occupying the turf
if(M.client) // makes sure that the mob is a client, not necessary if there are no NPCs in your game, but it's always handy to have a failsafe
M.death() // sends the player to the death() proc
. -= newLocation;


mob/player/proc/death()
// insert the death code from your previous Entered() proc here
In response to Unwanted4Murder
So, like this?
var{lava_time=0.09;} //time modifier. 0.5 = 30 seconds.
proc //defines that a procedure/function will be amde
{
generateLava(center, radius) //the procedure with args "center" and "radius"
{
if(!center||!radius){return;} //if the center and/or radius is not defined, it wont run.
.=list(); //lets create a list to store the tiles in the radius
for(var/turf/floor/a in oview(center,radius)) //collects the information within the radius blocks of center
{
.+=locate(a.x,a.y,a.z); //stores that location to the list
}
do //now lets execute this
{
sleep(lava_time*9); //have a delay - waits lava_time minutes
var/newLocation=pick(.); //lets pick a random location from the list
new/turf/lava(newLocation);
for(var/mob/M in newLocation)
if(M.client)
M.death()
//lets create the lava tile and put it at the new location
. -= newLocation; //removes the location from the list so it can't be reused.
}
while(length(.)); //as long as the list has stuff stored in it, the above functions would run.
}
}

turf
{
floor; //turf/floor
{
icon='floor.dmi'; //sets the icon for /turf/floor
}
lava; //turf/lava
{
icon='lava.dmi'; //sets the icon for /turf/lava
}
}




turf/lava
icon='turfs.dmi'
icon_state="lava"
name = "Lava"
mob/player/proc/death()

world << 'WilhelmScream.ogg'
usr.icon_state="death"
world <<"[usr] has died."
usr.icon_state="ghost"
usr.loc=locate(7,15,1)
alert("You can now spectate the remaining living players.")


If so, these errors keep popping.

loading The Floor Is Always Lava.dme
objects.dm:20:error: M.client: undefined var
objects.dm:21:error: M.death: undefined var
objects.dm:20:warning: if: if statement has no effect
The Floor Is Always Lava.dmb - 2 errors, 1 warning
In response to Manio
you have a little syntax error here.

...
for(var/mob/M in newLocation)
if(M.client)
M.death()
...


should look like this:

...
for(var/mob/M in newLocation)
if(M.client)
M.death()
...
In response to Koshigia
Did just that and now it's giving me the inconsistent indentation error for bottom two lines of code.
Here is your finalized code for your complete game, practically haha.

var{lava_time=0.09;} //time modifier. 0.5 = 30 seconds.

proc //defines that a procedure/function will be amde
{
generateLava(center, radius) //the procedure with args "center" and "radius"
{
if(!center||!radius){return;} //if the center and/or radius is not defined, it wont run.
.=list(); //lets create a list to store the tiles in the radius
for(var/turf/floor/a in oview(center,radius)) //collects the information within the radius blocks of center
{
.+=locate(a.x,a.y,a.z); //stores that location to the list
}
.+=center;
do //now lets execute this
{
sleep(lava_time*600); //have a delay - waits lava_time minutes
var/newLocation=pick(.); //lets pick a random location from the list
new/turf/lava(newLocation); //lets create the lava tile and put it at the new location
. -= newLocation; //removes the location from the list so it can't be reused.
for(var/mob/P in newLocation)
{
if(!P.spectating)
{
lavaDeath(P);
}
}

}
while(length(.)); //as long as the list has stuff stored in it, the above functions would run.
}
}


turf
{
lava
{
Entered()
{
lavaDeath(usr);
}
}
floor
{
}
}

proc
{
lavaDeath(mob/player)
{
if(!player){return;}
if(player.spectating){return;}
world << 'WilhelmScream.ogg';
player.icon_state="death";
world <<"[player] has died.";
player.icon_state="ghost";
player.loc=locate(7,15,1);
player.spectating=1;
alert(player,"You can now spectate the remaining living players.");
}
}

mob
{
var
{
spectating = 0;
}
}


Modify to your liking.
In response to Unwanted4Murder
Yeah I know, I just have the tendency to do it because I keep alternating between PHP, C# and Java, so yeah just a force of habit haha.
In response to Ssj4justdale
The only issue is now lava shows up as black tiles.
-.- well you do need to define its icon, icon_state and such.

I'm just too lazy to read what your values where.

I've taken care of the complicated part, which wasn't so complicated.

Just define these values and you are fine.
In response to Ssj4justdale
Nevermind, got it all fixed. Thanks for all the help.
No problem.
Now, what about after all the players die on the server? I'm trying to mess about making it reboot once they all die.

proc
{
lavaDeath(mob/player)
{
if(!player){return;}
if(player.spectating){return;}
world << 'WilhelmScream.ogg';
player.icon_state="death";
world <<"[player] has died.";
alldead+=1
player.icon_state="ghost";
player.loc=locate(7,15,1);
player.spectating=1;
alert(player,"You can now spectate the remaining living players.");


}
}


alldead is the var that I'm messing with, but I imagine it's going to have to be a bit more indepth than that.
proc
{
checkReboot()
{
var/all_dead=1;
for(var/mob/P in world)
{
if(!P.spectating){all_dead=0;break;}
}
if(all_dead)
{
//what happens if everybody is dead.
world<<"Everybody has died, rebooting game.";
world.Reboot();
//although you can do all this without a reboot but whatever you prefer I guess.
}
}
}


proc
{
lavaDeath(mob/player)
{
if(!player){return;}
if(player.spectating){return;}
world << 'WilhelmScream.ogg';
player.icon_state="death";
world <<"[player] has died.";
player.icon_state="ghost";
player.loc=locate(7,15,1);
player.spectating=1;
checkReboot();
alert(player,"You can now spectate the remaining living players.");


}
}
In response to Ssj4justdale
Alright cool, it worked. I know this is a hassle, but it's seriously the last time I'll pester you. But, perhaps make it so the "game"/lava doesn't start until either the Host presses a verb, or after like a 30 second countdown if the host is AWOL?

Again, pretty much the last time and then I can get on with finishing it myself.
var/game_started=0
world/New()
{
..();
spawn()
{
do
{
sleep(10);
}
while(players<8&&!game_started);
}
if(game_started){return;}
world<<"Starting the game in 30 seconds!";
spawn(300) //number / 10 = seconds.
{
if(game_started){return;}
world<<"Beginning game!";
generateLava(center, radius);
}
}

mob
{
host
{
verb
{
Start_Game()
{
if(game_started){return;}
game_started=1
world<<"Game starting in 5 seconds!";
spawn(50){world<<"Game Started!";generateLava(center, radius);}
}
}
}
}

client
{
New()
{
..();
if(address==world.address||!address)
{
src.mob.verbs+=new/mob/host/verb/Start_Game;
}
}
}


Code has not been tested. Best of luck.
Alright, configured it a bit and got it to work. Thanks pal.
No problem.
Page: 1 2