ID:147166
 
This is a small code i typed up for a game I am making, and
I need some help with it. At the moment, it just places a death flower anywere on the map, dense or not. Can someone please tell me how to ajust this so that it can only place the death flowers in view of the mob using the verb, and also to have it not spawn on any dense turfs? heres the code:
mob/Succubus/verb/Death_Flower()
set category = "Skills"
var/rand_x = rand(1,50)
var/rand_y = rand(1,50)
var/rand_z = rand(1,1)
var/Randomlocate = locate(rand_x,rand_y,rand_z)
new/turf/dflower(locate(Randomlocate))
usr << "You create a death flower at a random location on the map!"

turf/dflower
icon = 'dflower.dmi'
icon_state = "flower"
Reinhartstar wrote:
This is a small code i typed up for a game I am making, and
I need some help with it. At the moment, it just places a death flower anywere on the map, dense or not. Can someone please tell me how to ajust this so that it can only place the death flowers in view of the mob using the verb, and also to have it not spawn on any dense turfs? heres the code:
> 
> mob/Succubus/verb/Death_Flower()
> set category = "Skills"
> var/rand_x = rand(1,50)
> var/rand_y = rand(1,50)
> var/rand_z = rand(1,1)
> var/Randomlocate = locate(rand_x,rand_y,rand_z)
> new/turf/dflower(locate(Randomlocate))
> usr << "You create a death flower at a random location on the map!"
>
> turf/dflower
> icon = 'dflower.dmi'
> icon_state = "flower"
>
>
>


Try this, I dunno if it'll work but its worth a try.

mob/verb/blah()
if(Randomlocate.loc == density)
return 0
In response to ZLegend
ZLegend wrote:
Try this, I dunno if it'll work but its worth a try.

> mob/verb/blah()
> if(Randomlocate.loc == density)
> return 0


Unfortunately simply checking a turf's density or an area's density won't work. What if there's a dense mob or obj there?

A while() loop that tries to Move() whatever it is into different spots until it succeeds might work. It could also lag a bit.
In response to Jon88
Jon88 wrote:
ZLegend wrote:
Try this, I dunno if it'll work but its worth a try.

> > mob/verb/blah()
> > if(Randomlocate.loc == density)
> > return 0

Unfortunately simply checking a turf's density or an area's density won't work. What if there's a dense mob or obj there?

A while() loop that tries to Move() whatever it is into different spots until it succeeds might work. It could also lag a bit.
Frankly i need something that will cause minimum lag. The stuff im using already makes enough lag. Also i noticed no one explained anything about the view() part. i need someone to help wit that part of it to. =)