Alright... I cant seem to figure out how to get the icon to change states. I make a state, and then i put in the programming under my level up proc:
if(src.level==2)
src.icon_state='ssj'
that didnt work even though I checked to make sure that it was there. So instead of trying that, I made different icons for the different levels. That works ok, but I want them to go through a transformation to get to their level and im not sure how to do that.
Here is my code:
//This is a test world started by Tabu34 on 3/15/04 and yet to be completed...
mob
var/level=1
var/exp=0 // experience (total)
var/expNeeded= 15 // experience for the next level
var/maxHP= 20
var/expgained= 3
var/Spawned_By
proc
Look() //name of the proc
var/mob/M //makes the variable M which has to be mob/usr
while(src) //while src is still alive
if(M in oview(5)) //looks for a mob/usr in oview(5)
walk_to(src,M,1,4) //src walks to M until it is within 1 block away, moving 4/10th of a second
if(M in oview(1)) //checks if M is in oview(1), if true it continues
step_towards(src,M) //src step towards M which cause the bump()
else //if M isnt in oview(1)
step_rand(src) //steps randomly on the field
break //breaks out of while loop
else //if M isnt in oview(5)
for(M in view(src)) //for every M that is in view of src
break //breaks out of while loop
sleep(5) //sleeps half a sec before re-doing loop
spawn(2) //waits 2/10 a second before continue to do Look() again
Look() //redoes loop
PDeathCheck()
if (UHP <=0)
world << "Tabu34 dies!"
world << "Tabu34 was killed by [src]"
src.loc = locate(1,1,1)//restarts
src.UHP = src.maxUHP//resets health
InjuredCheck()
if (HP <=15)
icon = 'bugcut.dmi'
else
icon = 'bug.dmi'
LevelUp(mob/M)
if(src.exp >= src.expNeeded)
src <<"You Leveled Up!!"
src.level++
src.maxUHP+=rand(1,4)
src.UHP=src.maxUHP
src.expNeeded *= 2
src.exp = 0
if(src.level==2)
src.icon='ssj.dmi'
if(src.level==3)
src.icon='ssj2.dmi'
if(src.level==4)
src.icon='ssj3.dmi'
if(src.level==5)
src.icon='ssj4.dmi'
if(src.level==6)
src.icon='ssj5.dmi'
DeathCheck(mob/M as mob) //checks to see if an attack is deadly
if(HP <= 0) //if the defender's HP is low enough...
world << "[src] dies!" //do the death messaging
world << "[src] was killed by [M]!"
world << "[M] gains [expgained] experience!"
M.exp+= 3 //adds exp points
M.LevelUp()
del(src)
mob
icon = 'person.dmi' //makes it so all mobs will be created with the person icon
var
HP = 30 //declares a new variable called HP, with a value of 30
wealth = 0 //total money
UHP = 40 //new var Hp for user
maxHp = 30 //max hp for bug
maxUHP = 40 //max hp for user
strength = 3//change to the amount you want the player to have
defense = 2//same here
number = 1
Del()
var/obj/gold/G = new(loc) //create a new obj from the gold blueprint
G.amount = rand(1,100) //set its amount variable randomly
..() //call the parent
Login()
loc = locate(/turf/start)
world << "[usr] had logged into Testworld!"
bug
icon = 'bug.dmi'
name = "bug"
strength = 5
defense = 3
var/mob/bug/
Bump(mob/M)
if(istype(M,/mob/))
attackb(M)
proc/attackb(mob/U)
var/damage = rand(1,strength)
UHP -= damage
U <<"You are being attacked by [src.name]!"
src.exp += rand(1,5)
src.LevelUp()
PDeathCheck()
verb
attack(mob/G as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You attack [G]!" //send this message to the usr
oview() << "[usr] attacks [G]!" //send this message to everybody else
var/damage = rand(1,10) //assign a random # to a new variable
usr << "[damage] damage!" //tell the damage to the world
G.HP -= damage //take away the damage from M
G.InjuredCheck() //check for injuries w/ proc
G.DeathCheck(src) //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
obj
gold //define a "gold" prototype, which is a kind of obj
icon = 'gold.dmi' //set the default icon
var
amount //declare a new variable called "amount"
verb
get() //obj/gold/verb/get()
set src in view(1) //src must be close
usr << "You pick up [amount] gold."
usr.wealth += amount //add to usr.wealth
del(src) //delete the gold
obj
tree
icon = 'tree.dmi'
density = 1
obj
bug //You can't see spawn points on the map because they have no image. The game maker can when making a map though :P
var/My_Spawned //This is a var that means "The mob that this spawnpoint spawned."
New()
spawn()
SpawnCycle()
proc/SpawnCycle()
if(My_Spawned == null) //If this is not defined...
sleep(100)
var/E = new /mob/bug (src.loc) //Make a new stickman as a variable, so we can edit the newly created stickman after this is defined.
My_Spawned = E //This links M to the spawn point.
E:Spawned_By = src //This is so when a mob dies, the Death() proc can easily find the spawn point that spawned it, and set that spawn point's My_Spawned var to null.
spawn(10)
SpawnCycle()
turf
grass //defines a "grass" prototype, which is a kind of turf...
icon = 'grass.dmi' //and has an icon named 'grass.dmi'. In single quotes!
start
icon = 'start.dmi'
world //we set one of our world's characteristics:
turf = /turf/grass //its default turf is the grass turf.
mob/Stat() //Call the Stat proc that updates the stat window every Tenth of a second...
stat("[src]'s Stats:",src.desc) //Place in the stat panel, the word Stats:, and the srcs description.
stat(" HP: ","[UHP]/[maxUHP]" ) //It makes it easier to read if you put a bunch of spaces like that.
stat(" Gold: ","[wealth]")
stat(" Experience: ","[exp]/[expNeeded]")
stat(" Level: ","[level]")
stat(" Strength: ","[strength]")
stat(" Defense: ","[defense]")
//END OF CODE
I know that my look proc is unused but i just didnt get around to deleting it yet :P
Please Help!!
~Tabu34
~"I don't suppose we could talk about this...Guess not!"
James Bond Everything or Nothing Level "An Old Friend"
1
2
ID:147540
Apr 7 2004, 3:32 am
|
|
In response to Koshigia
|
|
I think i figured out the problem thx to u. I was using single quotes not double for the states. Ill tell u if it works!
~edit It works, and there are no errors!! But... I dont know how to make it flick to an icon state before it goes to the next level. Like this i want my character to get 15 exp points that makes him level up to level 2 i want it to change to icon state trans for one cycle then show the ssj state |
There's a big problem in your code now that (probably) has nothing to do with the current bug. You're using usr in several procs without even realizing it, by using view() and related procs without correctly using src as the point of reference. All the built-in procs such as view(), range(), oview(), etc. all have usr as their frame of reference by default. This is going to cause you subtle bugs until you change it.
Lummox JR |
In response to Lummox JR
|
|
ummm... ok, im not getting erreors,but ok...
could u answer my latest post(besides this one) |
In response to Tabu34
|
|
usually you wouldnt get errors maybe runtime errors
|
In response to N1ghtW1ng
|
|
nope
now will ya help with the problem at hand this post: 253379 |
In response to Tabu34
|
|
look up flick in dm reference
|
In response to N1ghtW1ng
|
|
i cant seem to find it
ne clues to where it is?? |
In response to Tabu34
|
|
press the dm reference all the way on the left in the frame thing...or F1 in Dreammaker and if ur on the byond site press cntrl F and type in Flick if u in dreammaker jus type flick in the top
|
In response to N1ghtW1ng
|
|
ya i found it right after i posted
ill post if i have ne more problems -----Edit Yep found a problem! When i level up it works fine, but when i kill an enemy, it runs level up proc and runs the transformation animation again!! Here is my code: //This is a test world started by Tabu34 on 3/15/04 and yet to be completed... mob var/level=1 var/exp=0 // experience (total) var/expNeeded= 15 // experience for the next level var/maxHP= 20 var/expgained= 3 var/Spawned_By proc Look() //name of the proc var/mob/M //makes the variable M which has to be mob/usr while(src) //while src is still alive if(M in oview(5)) //looks for a mob/usr in oview(5) walk_to(src,M,1,4) //src walks to M until it is within 1 block away, moving 4/10th of a second if(M in oview(1)) //checks if M is in oview(1), if true it continues step_towards(src,M) //src step towards M which cause the bump() else //if M isnt in oview(1) step_rand(src) //steps randomly on the field break //breaks out of while loop else //if M isnt in oview(5) for(M in view(src)) //for every M that is in view of src break //breaks out of while loop sleep(5) //sleeps half a sec before re-doing loop spawn(2) //waits 2/10 a second before continue to do Look() again Look() //redoes loop PDeathCheck() if (UHP <=0) world << "Tabu34 dies!" world << "Tabu34 was killed by [src]" src.loc = locate(1,1,1)//restarts src.UHP = src.maxUHP//resets health InjuredCheck() if (HP <=15) icon = 'bugcut.dmi' else icon = 'bug.dmi' LevelUp(mob/M) if(src.exp >= src.expNeeded) src <<"You Leveled Up!!" src.level++ src.maxUHP+=rand(1,4) src.UHP=src.maxUHP src.expNeeded *= 2 src.exp = 0 src.strength+=1 src.defense+=1 if(src.level==2) flick("trans",src) src.icon_state="ssj" if(src.level==3) flick("ssj2trans",src) src.icon_state="ssj2" if(src.level==4) flick("ssj3trans",src) src.icon_state="ssj3" if(src.level==5) flick("ssj4trans",src) src.icon_state="ssj4" if(src.level==6) flick("ssj5trans",src) src.icon_state="ssj5" if(src.level==7) flick("ssj6trans",src) src.icon_state="ssj6" if(src.level==8) flick("ssj7trans",src) src.icon_state="ssj7" if(src.level==9) flick("ssj8trans",src) src.icon_state="ssj8" if(src.level==10) flick("ssj9trans",src) src.icon_state="ssj9" if(src.level==11) flick("ssj10trans",src) src.icon_state="ssj10" if(src.level==12) flick("ssjholytrans",src) src.icon_state="ssjholy" if(src.level>=13) flick("ssjmopartrans",src) src.icon_state="ssjmopar" DeathCheck(mob/M as mob) //checks to see if an attack is deadly if(HP <= 0) //if the defender's HP is low enough... world << "[src] dies!" //do the death messaging world << "[src] was killed by [M]!" world << "[M] gains [expgained] experience!" M.exp+= 3 //adds exp points M.LevelUp() del(src) mob icon = 'person.dmi' //makes it so all mobs will be created with the person icon var HP = 30 //declares a new variable called HP, with a value of 30 wealth = 0 //total money UHP = 40 //new var Hp for user maxHp = 30 //max hp for bug maxUHP = 40 //max hp for user strength = 3//change to the amount you want the player to have defense = 2//same here number = 1 Del() var/obj/gold/G = new(loc) //create a new obj from the gold blueprint G.amount = rand(1,100) //set its amount variable randomly ..() //call the parent Login() loc = locate(/turf/start) world << "[usr] had logged into Testworld!" bug icon = 'bug.dmi' name = "bug" strength = 5 defense = 3 var/mob/bug/ Bump(mob/M) if(istype(M,/mob/)) attackb(M) proc/attackb(mob/U) var/damage = rand(1,strength) UHP -= damage U <<"You are being attacked by [src.name]!" src.exp += rand(1,5) src.LevelUp() PDeathCheck() verb attack(mob/G as mob in oview(1)) //attack a mob within 1 tile of you usr << "You attack [G]!" //send this message to the usr oview() << "[usr] attacks [G]!" //send this message to everybody else var/damage = 3*strength //assign a random # to a new variable usr << "[damage] damage!" //tell the damage to the world G.HP -= damage //take away the damage from M G.InjuredCheck() //check for injuries w/ proc G.DeathCheck(src) //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 obj gold //define a "gold" prototype, which is a kind of obj icon = 'gold.dmi' //set the default icon var amount //declare a new variable called "amount" verb get() //obj/gold/verb/get() set src in view(1) //src must be close usr << "You pick up [amount] gold." usr.wealth += amount //add to usr.wealth del(src) //delete the gold obj tree icon = 'tree.dmi' density = 1 obj bug //You can't see spawn points on the map because they have no image. The game maker can when making a map though :P var/My_Spawned //This is a var that means "The mob that this spawnpoint spawned." New() spawn() SpawnCycle() proc/SpawnCycle() if(My_Spawned == null) //If this is not defined... sleep(100) var/E = new /mob/bug (src.loc) //Make a new stickman as a variable, so we can edit the newly created stickman after this is defined. My_Spawned = E //This links M to the spawn point. E:Spawned_By = src //This is so when a mob dies, the Death() proc can easily find the spawn point that spawned it, and set that spawn point's My_Spawned var to null. spawn(10) SpawnCycle() turf grass //defines a "grass" prototype, which is a kind of turf... icon = 'grass.dmi' //and has an icon named 'grass.dmi'. In single quotes! start icon = 'start.dmi' world //we set one of our world's characteristics: turf = /turf/grass //its default turf is the grass turf. mob/Stat() //Call the Stat proc that updates the stat window every Tenth of a second... stat("[src]'s Stats:",src.desc) //Place in the stat panel, the word Stats:, and the srcs description. stat(" HP: ","[UHP]/[maxUHP]" ) //It makes it easier to read if you put a bunch of spaces like that. stat(" Gold: ","[wealth]") stat(" Experience: ","[exp]/[expNeeded]") stat(" Level: ","[level]") stat(" Strength: ","[strength]") stat(" Defense: ","[defense]") //END OF CODE yes i know im using mopar's vegeta, but ill give him credit and he wont mind. PLEASE HELP |
In response to Tabu34
|
|
alrite no problem jus before you post that your having problems again jus read it again slowly
|
In response to Tabu34
|
|
You really do still need to fix the view() thing.
Lummox JR |
In response to Lummox JR
|
|
ok, was it in the Look() proc? If it was, i deleted it just now because it wasn't being used. If it was somewhere else, please tell me where!
And again, my other problem still stands... Whenever i kill an enemy at any level other then 1, the transformation icon state replays! |
In response to Tabu34
|
|
Tabu34 wrote:
Yep found a problem! When ever the levelcheck proc runs, the way that it is coded, the transformation will always take place. To make it so it only happens when a person levels up, just indent everything under 'src.defense+=1' once more, so that the rest of the if statements line up with it. |
In response to Lazyboy
|
|
thank you! I knew that it had to do with indenting but i didnt know what it was!!
|
In response to N1ghtW1ng
|
|
Alright... Now that i have transformations down...I want it so that after each level, it will add your transformation to a list. Then you can click the (yet to be created) transform verb. And when they are transformed, they get a(yet to be created) revert verb. I also have another problem. I dont know how to add another stat panel that wont overlap the current one. I have one called Stats, and i want another 1 called Credits. A point in the right direction or some code that i could try would be nice!!
Here is my code incase you want to see it: //This is a test world started by Tabu34 on 3/15/04 and yet to be completed... |
In response to Tabu34
|
|
why dont you try it in stead of posting everything you want
|
In response to N1ghtW1ng
|
|
well sorry
i dont know where to start i was asking for either (1) A link to a tutorial or demo or (2)someone to give me an idea of where to start oneither problem i wasnt asking for u to do it for me |
In response to Tabu34
|
|
Well, instead of posting your ENTIRE project on the forums, it'd probably be best to ask this is Newbie Central, then once you've got an idea of how to do it, but still not sure how to piece it together, then come back here.
|
1
2
Let's suppose you have an icon with two states, "1" and "2". We'll call this icon 'basic_icon.dmi'.
First, here's are object that will be using the icon. We will also set the default icon_state as well.
Notice that the icon variable is referencing a file, marked with (')s, and the icon_state variable is referencing a text string, marked with (")s.
It is possible to change icon_states with a procedure. Here's a simple example.
I hope this helps you.
-Koshigia