I have made a simple 'Maze game' but there's a bit of code I can't get to work; I want to change the density of the walls by entering a command under the verb 'Cheats'. Everything works except it won't set the density to 0, heres the extract: http://s1343.photobucket.com/user/rexasarus/media/ byond2_zps07887770.jpg.html
Thanks
Also I had the bounds issue the other day, I was using bound_width and all that but I was told it is far easier to just use the syntax: bounds = "x,y to x,y"
The first 'x,y' being the bottom left corner of the bound and the second 'x,y' being the top right, Try it :) |
WAIT!! Don't use that code!! it won't do what you think it will do!!
for(var/turf/wall/T in world)//search for the walls in the world That means that if you enter that cheat then you and all the other players and NPCs can walk through walls!! I belive that this is what you want: mob/var/walk_through_walls=0 With my code the only persons that are able to walk through walls are the players that write the Cheat walls I hope that i helped ,MistY, |
no, he didn't but it wouldn't make sense... Let's imagine that a player writes that cheat ("walls"). Then all the NPCs and players in the game would be able to walk through walls... I mean, a cheat is usually activated for personal benefit, not for everyone's benefit...
|
Oh totally missed that when i wrote it, I assumed with it being a maze game it would be single player.
|
humm yeah...i thought that it would be a multiplayer game but you 2 are probably right...it might be a singleplayer game
|
It is a single player game however, I have thought of adding NPCs and providing I'm a beginner, everything you guys tell me helps so thanks :)
|
Misty in the turf could you not use this instead of a list.
Enter(mob/M) |
Also falcon i told him to put ..() there because if there is no start location, it will return the default action and put them at 1,1,1.
I believe if you didn't overwrite Login() but set mob/icon. You would login at 1,1,1 since you haven't overwritten the default procedure of Login(). Though I understand what you have done with your example. |
humm yes, i belive that you could use that. It is funny because in the DM language (and in many other languages) we can do the same thing in lots of different ways :P
You, as a coder, may prefer to solve the problem that way instead of making a list... Your way will work too :D |
I've broken something :L
---------- mob var wtw = 0 mob Login() loc = locate(/turf/Start) world << "[src] has entered the castle" step_size = 8 density = 0 icon = 'mob1.dmi' icon_state = "Rolling" bounds = "10,10 to 23,23" verb Cheats() var i = input("Enter cheat") as text if(findtext(i,"ghost")==1) usr << "Cheat accepted" src.wtw = 1 else usr << "Cheat failed" obj step_size = 8 Lamp luminosity = 3 icon = 'Lamp.dmi' obj Door icon = 'Finish.dmi' bounds = "1,1 to 32,5" density = 1 turf Wall icon = 'Wall.dmi' opacity = 1 luminosity = 0 Enter(mob/m) if(m.wtw == 1) /turf/Wall density = 0 else density = 1 Floor icon = 'Floor.dmi' luminosity = 0 Start icon = 'Start.dmi' Finish icon = 'Finish.dmi' Entered(mob) world << "Congratulations [usr], you have escaped!" -------------- This bit works: Enter(mob/m) if(m.wtw == 1) /turf/Wall density = 0 But it doesn't set the density to 0 and I have no clue what to do... (and sorry about the code, I don't know how to show an extract in the forums) |
Also just noticed your use of bounds is wrong(Or I think it is, just seen something by kaiocaho). I believe you want to be using bound_x and bound_y. Or the bound_width and bound_height vars. Press F1 in DM to look it up. Kaiochao's post on bounding boxes. http://www.byond.com/forum/?post=1492277#comment8666758
You're also missing ..() in Login(). Most people frown upon the usage of usr in Login as well, so I'd recommend you change that to src.