ID:163082
 
Hello again,

Im stumped on these ones, The First One is i wanted to make it so when i clicked on a turf an item appeared and that turf you clicked on disappears i did this but i dont want this to happen all the time i want there to be a random chance of getting that item, can u help me heres the code.

    M1
icon='Mountins.dmi'
icon_state="1"
density= 1
Click()
..()
new/obj/stone(src.loc)
del(src)



Also i want it so you have to be standing next to this turf for it to disappear so u cant click it quite far away. The code is above for both.

Thank you for reading this.
I'm not exactly sure what you want but maybe this will help.
turf
M1
icon='Mountins.dmi'
icon_state="1"
density=1
name="Mountain"
verb/Hit()
set src in oview(1) /// only get the verb if its in range.
set category="Actions"
if(prob(50)) // 50% chance of success
new/obj/stone(src.loc)
usr<<"A stone fell out of the [src]!"
else
usr<<"YOU FAILED!"
return
obj
stone
icon=''
icon_state=""
density=1
name="Stone"
verb/Check()
set src in oview(1)
set category="Actions"
if(prob(50))
usr<<"This stone is a rare one"
// stuff here
else
usr<<"This is just a normal worthless stone"
In response to Scizzees
I want it so when u click it u mine it and that turf disapears in its place is a item "Stone" and u can only mine it if your near it. soz i couldnt understand it i just raed through my bad
In response to Chrislee123
Scizzees code:
turf
M1
icon='Mountins.dmi'
icon_state="1"
density=1
name="Mountain"
verb/Hit()
set src in oview(1) /// only get the verb if its in range.
set category="Actions"
if(prob(50)) // 50% chance of success
new/obj/stone(src.loc)
usr<<"A stone fell out of the [src]!"
else
usr<<"YOU FAILED!"
return
obj
stone
icon=''
icon_state=""
density=1
name="Stone"
verb/Check()
set src in oview(1)
set category="Actions"
if(prob(50))
usr<<"This stone is a rare one"
// stuff here
else
usr<<"This is just a normal worthless stone"


"set src in oview(1)" ->You only get the verb from 1 space away fron the location.

Also if the icon for the stone is a state in the dmi file for the mountain then all you have to do is change the state and the turf will change it's image. Upon picking up the stone change the state again to go back to the mountain.
Here are the changes to be made do the above code:
    M1
icon='Mountins.dmi'
icon_state="1"

goes to
    M1
icon='Mountins.dmi'
icon_state="mountain face"

Then
            set category="Actions"
if(prob(50)) // 50% chance of success
new/obj/stone(src.loc)
usr<<"A stone fell out of the [src]!"

goes to
            set category="Actions"
if(prob(50)) // 50% chance of success
icon_state="stone"
new/obj/stone(src.loc)
usr<<"A stone fell out of the [src]!"
In response to Chrislee123
Chrislee123 wrote:
I want it so when u click it u mine it and that turf disapears in its place is a item "Stone" and u can only mine it if your near it. soz i couldnt understand it i just raed through my bad


Ah, So its a mining system you want.
Im guessing you have played Cow RP Remasterd?
Where this sort of thing is possible.

Heres my small version of it, Although i came up with 5 errors on compile, It could be because of i do not have the icons and such.
Mes round with the code a bit to get it working in your game
turf
M1
icon='Mountins.dmi'
icon_state="1"
density=1
name="Mountain"
verb
Mine()
set src in oview(1) /// If you are next to the Mountain you have the Verb.
var/random = rand(1,3)
if(random == 1)
new/obj/stone(src.loc)
usr << "You mined a Stone from this rock!"
del(src)
if(random == 2)
new/obj/gold(src.loc)//If you have gold, You could get gold from the rock too!, but not both!
usr << "You mined some Gold from this rock!"
del(src)
if(random == 3)
usr << "Nothing here."
del(src)
In response to BEVAN
wait everyone is giving me verbs i want it so wen u click it and it only works if your next to it
In response to BEVAN
mob/var
random


turf/Mountain
icon='Stone.dmi'
density=1
Click()
if(get_dist(usr,src) <= 1)//makes it so you have to be within one tile from the mountain to mine
usr.random=rand(1,5)///this declears the chance of getting there are 5 you can change it to have a harder chance of getting stuff
if(usr.random==1)
usr<<"You mine for a stone is Silver!!!"
var/obj/Stone/S = new/obj/Stone
S.loc=usr.loc
if(usr.random==2)
usr<<"You mine for a stone is Gold"
var/obj/Nugget/S = new/obj/Nugget
S.loc=usr.loc
if(usr.random>=3)
usr<<"You mine and found some dirt bleh is worthless"

else
return


obj/Stone
icon='Stone.dmi'
icon_state="1"

obj/Nugget
icon='Stone.dmi'
icon_state="2"