ID:148938
 
How would I set this up to do damage to a player.

obj
bullet
icon = 'main.dmi'
icon_state = "bullet"
density = 1//So it can bump into things
Bump(obj/wall/A)//When it runs into something
if(istype(A,/obj/wall))//If it's a wall.
A.health -= rand(5,15)//Subtracts the wall's health
A.checkdeath()//calls the checkdeath proc
del(src)//no more bullet
else if(istype(A,/obj/bullet))
del(src)
del(A)
else
Codesterz wrote:
How would I set this up to do damage to a player.

obj
bullet
icon = 'main.dmi'
icon_state = "bullet"
density = 1//So it can bump into things
Bump(obj/wall/A)//When it runs into something
if(istype(A,/obj/wall))//If it's a wall.
A.health -= rand(5,15)//Subtracts the wall's health
A.checkdeath()//calls the checkdeath proc
del(src)//no more bullet
else if(istype(A,/obj/bullet))
del(src)
del(A)
else

I would recommend using non-dense bullets, as it is easier to make exceptions to dense objects (E.g. water, trenches). My War_Demo includes all of the code needed to make a damaging projectile, as well as detection of if it strikes a mob.

Hope that helps. :)
In response to Malver
Malver how did u set up your team system.
In response to Codesterz
Codesterz wrote:
Malver how did u set up your team system.

Thanks for the feedback of if the demo helped or not. ;)

As for teams, I used a global list to store the number of people on each team. When a player logs in (Login()), see which team has more players, and deposit then in the team with less players, to even the teams out. As for starting zones, I just made an iconless turf (/turf/Start_Zone) with a unique var indicating what team would spawn to it. When a player died or entered the game, it would search the start zone turfs (2 of them in a map for each team), and spawn them to there. Of course, you would need to set the player's density to 0, then spawn them, or else any players already standing there (who are dense) would cause the player to be flung into a blank screen.

...And that's my team system in a nutshell. >:)
In response to Malver
Your system works. I put it onto mine and it works perfectly. Thanx!!!

*-*CodesterZ*-*