yes,i cannot make an age system -_-;
can anyone spare any ideas?
maybe if i knew what i should go for,i could code it bettah ^_^
ID:177607
![]() Aug 20 2002, 12:43 pm
|
|
mob/proc/UpAge()
sleep(600) src.age ++ if(src.age < 100) spawn() UpAge() else world << "[src] is old." del(src) mob/proc/Aging() switch(src.age) if(0) src.class = "Newborn" if(1 to 3) src.class = "Toddler" if(4 to 9) src.class = "Kid" if(10 to 12) src.class = "Pre Teen" if(13 to 17) src.class = "Teen" if(18 to 29) src.class = "Young Adult" if(30 to 50) src.class = "Adult" if(51 to 70) src.class = "Senior" else src.class = "Old man" spawn(20) Aging() mob/New() if(client) spawn() Aging() UpAge() ..() mob var age = 0;class = "" Well there's something heheh. |
Depends what you're using for. If you just want something that checks their age in like a statistic, you could give them a birthday variable and have the stat calculate the difference in time between the birthday variable and the current realtime variable. The difference would be their age!
|
Roara wrote:
i need something that can change the icon state,and an 'age' variable Well, for the changing of icon states do this: mob/proc/Aging() Hope that helps alittle. --Lee |
Then what Super16 said is what you want. The concept is pretty simple. Whenever a new mob is created (assuming you want them to age), start a looping proc that adds 1 to their age variable every time it loops. Like this:
<code>mob/var age = 1 mob/New() spawn() Age() mob/proc/Age() while(age) sleep(600) // every minute age++ spawn() AdjustIcon() mob/proc/AdjustIcon() switch(age) if(1 to 15) icon_state = "young" if(15 to 50) icon_state = "adult" if(50 to 99) icon_state = "old"</code> Using that code, if the mob's age variable is greater than 0 by default (when you define the mob), they'll begin aging as soon as they are created. When they New() mob is created, it spawns the Age() proc which will continue to loop unless the mob's age is 0. Every time it loops it will add one to their age and spawn a proc to adjust their icon_state accordingly. Of course, you'll want to setup the AdjustIcon() proc to adjust according to the icon states that you're using, and you'll also want to speed up or slow the aging delay to whatever speed you want. |
i just cant stinkin' do it,i tried 3-4 different ways,including the ones you gave me,and one of my own...
it just wont work! guess that'll be later ^_^ |
Rcet made one