ok... i want it to do a random roll and if the roll = 5 then i want it to drop some armor. It looks like it should work fine to me but then again i am doing this as a complete newb and only looking at somewhere elses coding once. plz tell me why it wont work.
world
name = "My First Game."
turf = /turf/grass
view = 5
turf
grass
icon = 'person.dmi'
icon_state = "grass"
water
icon = 'person.dmi'
icon_state = "water"
density = 1
mob
Login()
usr.icon_state = input("What Gender?") in list ("Male","Female")
usr.Move(locate(1,1,1))
icon = 'Person.dmi'
kros
icon = 'K_ros.dmi'
Del()
usr.random = rand(1,5)
if usr.random = 5
var/obj/armor/A = new(loc)
A.amount = 1
var/obj/gold/G = new(loc) //create a new obj from the gold blueprint
G.amount = rand(1,100) //set its amount variable randomly
..()
var
//**Random Roll**
random
//**STATUS**
maxhp = 10
hp = 10
str = 5
def = 2
gold = 0
//**Armor**
armor_equipped = 0
weapon_equipped = 0
Stat()
statpanel("Status")
stat("Health", "[num2text(hp,50)]/[num2text(maxhp,50)]")
stat("Strength", "[num2text(str,50)]")
stat("Defense", "[num2text(def,50)]")
stat("Gold", "[num2text(gold,50)]")
verb
Add_Strength(msg as num)
usr.str += msg
Attack(mob/M as mob in oview(1))
var/damage = usr.str - M.def
if(damage <= 0)
usr << "[M] Easily dodges your attack!"
M << "You easily dodge [usr] attack."
else
M.hp -= damage
view() << "[usr] attacks u [M] for [damage] damage!"
M:deathcheck()
proc
deathcheck()
if(src.hp <= 0)
view() << "[src] dies!"
src.hp = "[maxhp]"
del(src)
usr.str += 1
usr.def += 1
obj
sword
icon = 'weapons.dmi'
icon_state = "34"
verb
Get()
set src in oview(1)
usr.contents += src
view() << "[usr] picks up \a [src]"
Drop()
new/obj/sword(usr.loc)
view() << "[usr] drops \a [src]"
del(src)
Equip()
if(usr.weapon_equipped == 0)
usr.str += 2
usr.weapon_equipped = 1
usr << "[usr] equipes a sword."
else
usr << "You are alrdy weilding a sword"
Unequip()
if(usr.weapon_equipped == 1)
usr.str -= 2
usr.weapon_equipped = 0
view() << "[usr] unequips a sword."
else
usr << "You aren't wielding this."
armor
icon = 'Armor.dmi'
icon_state = "126"
var
amount
verb
Get()
set src in oview(1)
usr.contents += src
view() << "[usr] picks up \a [src]"
Drop()
new/obj/armor(usr.loc)
view() << "[usr] drops \a [src]"
del(src)
Equip()
if(usr.armor_equipped == 0)
usr.def += 2
usr.armor_equipped = 1
usr << "[usr] wears some armor."
else
usr << "You are already wearing something."
Unequip()
if(usr.armor_equipped == 1)
usr.def -= 2
usr.armor_equipped = 0
view() << "[usr] takes off some armor."
else
usr << "You aren't wearing this."
gold
icon = 'gold.dmi'
var
amount
verb
Get()
set src in view(1)
usr << "You pick up [amount] gold!"
usr.gold += amount
del(src)
HERE IS THE ERROR IT GIVES
loading tutorial.dme
tutorial.dm:29:error: missing condition
tutorial.dmb - 1 error, 0 warnings (double-click on an error to jump to it)
ID:170657
![]() Dec 29 2004, 2:48 pm
|
|
omg... i hate u, i have been working on that for about 3 hours and u just pop up the answer :(. thanks btw. second how would i add the DM tag? thats the second time i have been told to use it and i havnt the slitest idea wtf it is
|
Sorry about that, I guess we should've been more specific:
The "DM tag" works like any other HTML tag: <DM>Your code here.</DM> Which produces: Your code here. The DM in the tag can be either case, upper or lower. It not only makes code appear in a monospaced font (helps reading) but does basic syntax highlighting. More info can be found through the Posting Help link on the reply page. http://developer.byond.com/forum/ index.cgi?action=forum_help#posting |
test, no help needed
world |
Second: Check up on your usage of src and usr. (I don't think it's valid in Login() and Del(), correct me if I'm wrong.)
And please, if the error occurs on a certain line, highlight said line, and save us some time.
I believe it's this:
if usr.random = 5
if statements work like this:
if(condition to evaluate)
So, try:
if(usr.random == 5)
Notice the double equal sign. One equal sign is for assignment, two is for comparision.