ID:171391
 
Hey how i do code so when say everyone who is T=1 dies it reboots?
Use

world.Reboot()
I'm going to guess you mean "How do I make it so when everyone with T=1 dies, the game reboots?"

Basically, you should probably make a proc that checks all the players in the world, checks if their in Team 1 (Thats what T stands for, right?), and then checks if thier NOT dead. If they are not dead, var/A = 1. after all players have been checked, if A is 1, someone is alive. If A is 0, then all players on team 1 are dead and the world should reboot.

this should do the trick:
proc
checkTeamPlayerCount()//You should probably run this in your death proc
var/A = 0
for(var/mob/M in world)//change this to player's mob's path.
if(M.T == 1 && M.dead == 0)
A = 1//sets A to 1
break//no need to check for more players
if(A == 0)//If no player on team1 are alive..
world<<"Team one has been defeated! World will Reboot in 5 seconds!"
spawn(50) world.Reboot()//Reboot after 5 seconds


You may need to tweak that a bit, but I'm pretty sure that will work
In response to DarkCampainger
DarkCampainger wrote:
I'm going to guess you mean "How do I make it so when everyone with T=1 dies, the game reboots?"

Basically, you should probably make a proc that checks all the players in the world, checks if their in Team 1 (Thats what T stands for, right?), and then checks if thier NOT dead. If they are not dead, var/A = 1. after all players have been checked, if A is 1, someone is alive. If A is 0, then all players on team 1 are dead and the world should reboot.

this should do the trick:
> proc
> checkTeamPlayerCount()//You should probably run this in your death proc
> var/A = 0
> for(var/mob/M in world)//change this to player's mob's path.
> if(M.T == 1 && M.dead == 0)
> A = 1//sets A to 1
> break//no need to check for more players
> if(A == 0)//If no player on team1 are alive..
> world<<"Team one has been defeated! World will Reboot in 5 seconds!"
> spawn(50) world.Reboot()//Reboot after 5 seconds
>

You may need to tweak that a bit, but I'm pretty sure that will work

hmmm i can copy and paste :(
In response to Dalga Productions
hmmm don't work

    proc
DeathCheck(mob/M in world)
if(src.HP <= 0)
icon_state = "Dead"
src.canmove=0
src.dead = 1
world <<"<b><font color = red>Info:<font color = black>[usr] was killed by [src]!"
if(Terr == src)
if(src.HP <= 0)
icon_state = "Dead"
src.canmove=0
src.dead = 1
world <<"<b><font color = red>Info:<font color = black>[usr] was killed by [src]!"
src.T = 1
proc
checkteam()
var/A = 0
for(var/mob/M in world)
if(M.T == 1 && M.dead == 0)
A = 1
break
if(A == 0)
world << "The Game is over"
spawn(50)
world.Reboot()
In response to CrazyFighter
It should work...
In response to Dalga Productions
Dalga Productions wrote:
It should work...

doesent
In response to Dalga Productions
T means terrorist?
In response to DarkCampainger
yeah and i had CT for Counter-Terriots i really need for my cs game
In response to CrazyFighter
mob
proc
DeathCheck(mob/M in world)
if(M.HP <= 0)
M.icon_state = "Dead"
M.canmove=0
M.dead = 1
world <<"<b><font color = red>Info:<font color = black>[M] was killed by [usr]!"
checkteam()

proc
checkteam()
var/A = 0
for(var/mob/M in world)
if(M.T == 1 && M.dead == 0)
A = 1
break
if(A == 0)
world << "The Game is over"
spawn(50)
world.Reboot()


I think thats right... I changed some things in the death proc.
In response to DarkCampainger
DarkCampainger wrote:
> mob
> proc
> DeathCheck(mob/M in world)
> if(M.HP <= 0)
> M.icon_state = "Dead"
> M.canmove=0
> M.dead = 1
> world <<"<b><font color = red>Info:<font color = black>[M] was killed by [usr]!"
> checkteam()
>
> proc
> checkteam()
> var/A = 0
> for(var/mob/M in world)
> if(M.T == 1 && M.dead == 0)
> A = 1
> break
> if(A == 0)
> world << "The Game is over"
> spawn(50)
> world.Reboot()
>

I think thats right... I changed some things in the death proc.

works but when they day it says CrazyFighter was killed by 0!
In response to CrazyFighter
CrazyFighter wrote:
DarkCampainger wrote:
> > mob
> > proc
> > DeathCheck(mob/M in world)
> > if(M.HP <= 0)
> > M.icon_state = "Dead"
> > M.canmove=0
> > M.dead = 1
> > world <<"<b><font color = red>Info:<font color = black>[M] was killed by [usr]!"
> > checkteam()
> >
> > proc
> > checkteam()
> > var/A = 0
> > for(var/mob/M in world)
> > if(M.T == 1 && M.dead == 0)
> > A = 1
> > break
> > if(A == 0)
> > world << "The Game is over"
> > spawn(50)
> > world.Reboot()
> >

I think thats right... I changed some things in the death proc.
No Put usr in proc, ungh! - Lummox Jr


--Goz
In response to CrazyFighter
can I see where the death proc is called?
In response to DarkCampainger
DarkCampainger wrote:
can I see where the death proc is called?

The simple problem that was pointed out here: [link]. You also are telling him to use user in procs which is a no-no. I'd suggest reading up on http://www.byondscape.com/ascape.dmb/LummoxJR.2002-1104/
before helping people with procs because you give them wrong information.


--Goz
In response to Goz
I left usr there because I didn't know where it was called and what var represented the person who shot M.
In response to DarkCampainger
DarkCampainger wrote:
can I see where the death proc is called?

what you mean?
In response to CrazyFighter
where do you call death() when a player takes damage. I'm guessing it's in the bullet's Bump()code.
In response to DarkCampainger
DarkCampainger wrote:
where do you call death() when a player takes damage. I'm guessing it's in the bullet's Bump()code.

yeah

            Shoot()
set category = "Weapons"
if(src.Ammo <= 1)
src << "Not enough Ammo to fire."
return // stop the verb
src.Ammo -= 1
icon_state = "Shooting"
var/obj/A = new /obj/Bullet (src.loc)
A.dir = src.dir
walk(A,A.dir,1)
sleep(5)
icon_state = ""
del(A)
In response to CrazyFighter
CrazyFighter wrote:
DarkCampainger wrote:
where do you call death() when a player takes damage. I'm guessing it's in the bullet's Bump()code.

yeah
            Shoot()
set category = "Weapons"
if(src.Ammo <= 1)
src << "Not enough Ammo to fire."
return // stop the verb
src.Ammo -= 1
flick("Shooting",src)///Use this, it works much better for the way your using it
var/obj/A = new /obj/Bullet (src.loc)
A.dir = src.dir
walk(A,A.dir,1)
sleep(5)
del(A)//if you delete A after .5 seconds it would have traveled only 5 squares. Are you sure you want that??


ummm... thats not so great. As you have it right now, the bullet only lasts for .5 seconds and theres a better way to do the icon_state with flick()

I also don't see where death() is called. Could you post the lines where death() is actually called?

In response to DarkCampainger
DarkCampainger wrote:
CrazyFighter wrote:
DarkCampainger wrote:
where do you call death() when a player takes damage. I'm guessing it's in the bullet's Bump()code.

yeah
>           Shoot()
> set category = "Weapons"
> if(src.Ammo <= 1)
> src << "Not enough Ammo to fire."
> return // stop the verb
> src.Ammo -= 1
> flick("Shooting",src)///Use this, it works much better for the way your using it
> var/obj/A = new /obj/Bullet (src.loc)
> A.dir = src.dir
> walk(A,A.dir,1)
> sleep(5)
> del(A)//if you delete A after .5 seconds it would have traveled only 5 squares. Are you sure you want that??
>

ummm... thats not so great. As you have it right now, the bullet only lasts for .5 seconds and theres a better way to do the icon_state with flick()

I also don't see where death() is called. Could you post the lines where death() is actually called?


woops sorry got wrong part

obj
density = 1 // all of the objs have the density of one.
icon = 'Bullet.dmi' // all of the objs have the icon of Swords.dmi
Bullet
Bump(mob/M) // when it bumps something
if(ismob(M)) // if it is a player
flick("Shot",M)
M.HP -= 10 // HP is deducted by 10
M.HPRefresh()
M.DeathCheck(M) // deathcheck

del(src) // deletes the src because if it doesnt, it would do attacks more
Page: 1 2