ID:163056
 
Hey guys haven't really programmed much before, but I'm trying to write a game that will help me study for my classes. I figure since I tend to get addicted to creating things, and games, and need to study if i combine the things it might really work out well for me.

Anyhow I've gone through a few of the tutorials, I can get my char running around, create mobs that can be attacked, make my map tile types in basic wall/floor types, and a few other snippets of code I've cut and pasted in general.

I was trying to get the skin tutorial to work but had a problem opening the file correctly for some reason.

my code is probably a pretty gruesome hackjob at this point, but here it is:



//This is a test world created by kichimichi in 2007.

mob
being
player //this typepath can be changed, but I always use this one.
Move()
. = ..() //call the parent proc
if(.) //if parent proc is true (move succeeds)
if(src.client) //is actually a player.
for(var/mob/NPC/bug/M in range(12,src))
M.pinged(src) //pings every monster in a range of 12 of the player's new location.
return . //returns the parent proc's

mob
NPC
bug
var
mob/being/player/target //holds the current target, or null if turned off.
chase_range = 6 //set at what range the monster begins pursuit.
move_delay = 10 //moves once per second
attack_delay = 7 //attacks every 0.7 seconds
proc
pinged(var/mob/being/pinger)
if(!src.target) //if the monster isn't distracted already.
if(get_dist(src,pinger)<=src.chase_range) //if the target is close enough to the monster.
if(pinger.client) //if the pinger is a player.
if(pinger in view(src,src.chase_range)) //if the monster can 'see' the player.
src.target = pinger //set the target, so that the monster doesn't chase anybody else.
src.pursue() //commence chase!
return 1
return 0

mob
NPC
bug
proc
pursue()
var/rng = get_dist(src,src.target) //store the distance in a local variable.
if(rng<=src.chase_range&&src.target in view(src,src.chase_range)) //stop chasing if the player is hiding, or has gotten out of range.
if(rng>1)
step_towards(src,src.target) //take one step to the target.
spawn(src.move_delay)
src.pursue() //after X milliseconds, keep chasing.
else
src.attack() //call the attack function. You are going to have to define this.
spawn(src.attack_delay)
src.pursue() //after X milliseconds, keep chasing or attacking.
else //if out of range, or out of view.
src.target = null //give up on target
src.find_target() //try looking for another target.


mob
NPC
bug
proc
find_target()
var/mob/being/player/found //store the next target locally.
var/fdst = src.chase_range+1 //next target's distance (starts higher than potential range for ease of use)
for(var/mob/being/player/tgt in view(src,src.chase_range))
if(tgt.client) //if is a player.
if(get_dist(src,tgt)<fdst) //compare distances to find the closest potential target.
found = tgt
fdst = get_dist(src,tgt)
if(found) //if there is another target.
src.target = found //set next target
src.pursue() //being pursuit!
return 1
return 0 //switch off


var/weather = "The sky is grey with smog, and streaked with the light of passing aircraft moving too fast to see anything but their light trails."

mob/verb/look_up()
usr << weather

mob
icon = 'person.dmi' //make it so all mobs will be created with the person icon
var
HP = 30
wealth = 100
strength = 10
persona = 10
stamina = 10
agility = 10
//define a new variable called HP, with a value of 30
bug //new prototype
icon = 'bug.dmi' //override the parent's icon, which was 'person.dmi'
Login()
icon_state = gender //when a player logs in, get them the right icon state for
..() //the gender of their key. Then call the parent!

proc
DeathCheck()
if (HP <= 0)
world << "[src] dies!"
del(src)
verb
attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You attack [M]!" //send this message to the usr
oview() << "[usr] attacks [M]!" //send this message to everybody else
var/damage = rand(1,10) //assign a random # to a new variable
world << "[damage] damage!" //tell the damage to the world
M:HP -= damage //take away the damage from M
M:DeathCheck() //check for death with a proc

say(msg as text) //what the usr says is passed into "msg" as text
world << "[usr]: [msg]" //the world sees chatroom-like output
verb
psionic_blast(mob/M as mob in oview(1))
usr << "you use your powerful mental abilities to smite your adversary!"
world << "[usr] blasts the [src]!"
var/damage = rand(1,100)
world << "[damage] damage!"
M:HP -= damage
M:DeathCheck()

mob/verb/wink(M as mob)
view() << "[usr] winks at [M]."

mob/verb/poke(M as mob in view(1))
view() << "[usr] pokes [M]!"


obj
gold
icon = 'gold.dmi'
var
amount
verb
get() //obj/gold/verb/get()
set src in view(0) //src must be close
usr << "You pick up [amount] gold."
usr.wealth += amount //add to usr.wealth
del(src) //delete the gold

turf
grass //define a "grass" prototype, which is a kind of turf...
icon = 'grass.dmi' //that has an icon named 'grass.dmi'. In single quotes!
wall
icon = 'wall.dmi'
density = 1
water
icon = 'water.dmi'
density = 1
world //set one of our world's characteristics:
turf = /turf/grass //its default turf is the grass turf.


What I'd like to do is create a combat system that asks the player a quiz question randomly out of a list of questions, gives him a multiple choice prompt and lets his ability resolve if he gets it correct, otherwise it would fizzle. Having the list the questions are drawn from be based on level would be good, and to have the same device be used for other in game actions, (like unlocking a door with the power of his mind ect)
Barring that for now, if I could just get a lead on making a quiz npc that would basically just spit out questions without anything else attatched that would be fine as a start anyhow.
ALso hey I know this probably falls under the forbidden :( dont ask other people to program for you thing ) but hey I'll take any advice and direction i can get, but I'm not gonna be sore that I don't get much of anything, and will continue my study of the program as best I can in any case. I've played with the program for about a day now, just having problems sorting things out atm.

thanx
mike
alot of the junk in there doesn't work yet btw like the npc mob ping chase thing, since my npc's don't move at all on their own atm, and such things but I've been experimenting, and creation is messy.

mike
In response to Kichimichi
I had an FMA game where i had the Alchemy exam and if i can remember the coding for the exam i'll give you some of it, you can change it up and should work ok.

if you have already resovled this then never mind