Irish_Ninja -> RE: How do you make a game? (6/25/2007 20:23:50)
|
Yeah, I agree... But I'm going to risk trying. I'm just going to ask everybody there on how. I've actually figured out a lot, just not specific things that I need to know: how to make skills and execute them, how to link skills to other people, etc. mob var saved_x saved_y saved_z Write(savefile/F) saved_x = x saved_y = y saved_z = z ..() //store variables Read(savefile/F) ..() //restore variables Move(locate(saved_x,saved_y,saved_z)) mob/Write(savefile/F) //store coordinates F << x F << y F << z //store variables ..() mob/Read(savefile/F) var {saved_x; saved_y; saved_z} //load coordinates F >> saved_x F >> saved_y F >> saved_z //restore variables ..() //restore coordinates Move(locate(saved_x,saved_y,saved_z)) mob/Write(savefile/F) F["name"] << name F["gender"] << gender F["icon"] << icon mob/Read(savefile/F) F["name"] >> name F["gender"] >> gender F["icon"] >> icon mob/Write(savefile/F) F["name"] << "Dan" F["gender"] << "male" client/New() var/savefile/F = new(ckey) F >> usr return ..() client/Del() var/savefile/F = new(ckey) F << usr del(usr) mob Login() var/savefile/F = client.Import() if(F) Read(F) //restore properties ..() proc/SavePlayer() var/savefile/F = new() Write(F) //save properties client.Export(F) mob/proc/GotoMars() var/savefile/F = new() F << src if(!world.Export("dm.edu:2001#player",F)) usr << "Mars is not correctly aligned at the moment." return usr << link("dm.edu:2001") world/Topic(T) if(T == "player") //download and open savefile var/savefile/F = new(Import()) //load mob var/mob/M F >> M return 1 mob/verb/export(Addr as text) usr << "Export([Addr]) == \..." usr << world.Export(Addr) world/Topic(T,Addr) world.log << "Topic([T]) from address [Addr]." return 1 mob/Write(savefile/F) var/V for(V in vars) if(issaved(vars[V])) if(initial(vars[V]) == vars[V]) F.dir.Remove(V) //just in case else F[V] << vars[V] //write variable mob/Read(savefile/F) var/V for(V in vars) if(issaved(vars[V])) if(V in F.dir) F[V] >> vars[V] //read variable proc/Weather() for() world << "The sun rises in the east." sleep(500) world << "The noon day sun rises high in the sky." sleep(500) world << "The sun sinks low in the west." sleep(1000) area/sickroom //how long to wait before clean cycle var/const/alarm = 100 //moment when countdown started var/start_time = 0 Enter(var/mob/entrant) if(!start_time) start_time = world.time spawn(alarm) for(entrant in src) entrant << "The disinfectant hits you. Aaahhhh!" del entrant start_time = 0 //ready for another round var/time_left = (alarm - (world.time - start_time))/10 entrant << "In [time_left] second\s this room will be disinfected." entrant << "Have a nice day!" return 1 area/room Exit() . = ..() if(. && usr) spawn src << "[usr] leaves." mob/verb/smile(M as mob|null) if(!M) //no target mob specified usr << "You smile." oview() << "[usr] smiles." else usr << "You smile at [M]." M << "[usr] smiles at you." oview() - M << "[usr] smiles at [M]." mob/Login() if(!loc) //new player loc = locate(world.maxx/2,world.maxy/2,1) mob/Login() if(!loc) loc = locate("start") proc/LocateInLevel(Type,zLevel) var/SW = locate(1,1,zLevel) var/NE = locate(world.maxx,world.maxy,zLevel) return locate(Type) in block(SW,NE) turf/downstairs verb/use() var/dest = LocateInLevel(/turf/upstairs,z+1) usr.Move(dest) turf/upstairs verb/use() var/dest = LocateInLevel(/turf/downstairs,z-1) usr.Move(dest) mob var/mob/enemy proc/Swing() if(get_dist(src,enemy) > 1) return //do the damage... mob/guard/New() ..() spawn for() //spawn an infinite loop if(!step(src,dir)) dir = turn(dir,180) sleep(30) //three seconds mob/verb/follow(mob/M) walk_to(src,M,get_dist(src,M),30) mob/verb/flee(mob/M) walk_away(src,M,5,30) mob var/wander New() if(wander) walk_rand(src) ..() mob/var wealth as num strength in 1 to 100 //defaults to "as num" alignment in list("good","bad","neutral") background as text mob/rat verb/tell(msg as text) set src in oview() if(findtext(msg,"cheese")) view() << "[src] looks at [usr] hopefully." walk_to(src,usr) proc/SortTextList(lst[]) var/i var/j for(i=1,i<=lst.len,i++) for(j=i+1,j<=lst.len,j++) if(sorttext(lst,lst[j]) == -1) //swap positions var/tmp = lst lst = lst[j] lst[j] = tmp mob/verb/who() var/lst[0] var/mob/M var/N for(M) if(M.client) lst += M.name SortTextList(lst) for(N in lst) usr << N mob/Login() . = ..() usr << {" <CENTER><BIG> The Great BYOND </BIG></CENTER> Welcome, [usr]. I am glad you could join us. <SPAN CLASS=system> Please refrain from scribbling on the walls. </SPAN> "} obj/weapon var/power clipboard power = "1d4" calculator power = "2d6" verb/swing(mob/trg in view(1)) var/damage = roll(power) view() << "[usr] hits [trg] with \a [src] for [damage] point\s!" obj/fortune_cookie verb/eat() usr << "The message inside says:" usr << pick ( "Never trust an undead doctor.", "Only trust undead lawyers.", prob(25) "The throne marks the way.", prob(10) "The wall behind the throne is an illusion!" ) del(src) mob/verb/list_files() shell("dir > dir.txt") usr << browse("dir.txt") And there's something I've come up with, it works so far, but I need a map still, mine won't show up...
|
|
|
|