ID:164053
 
Ok how would you code in Pregnancy for a byond game?
you have to put in the sex code and accidentally delete the condom code. maybe add a loop or two

hiead
In response to Hiead
Hahhah!
Stork delivery is a new feature in BYOND 4.0, so wait a little while (9 months) and you won't have to worry about implementing pregnancy yourself.
In response to Koil
Yes the Pregnancy coding... i need that too, i dont know how to do it so i gave up on it, it would be in several of my games... babies... heh never going to have one of my own

they cost too much and i love the peace and quiet of living alone.... sweet silence except for the clicks of my mouse and keyboard and the blaring of my music while i play my PS1-2 & XBOX
Gamemaster123 wrote:
Ok how would you code in Pregnancy for a byond game?

Read this: http://bwicki.byond.com/ByondBwicki.dmb?TheCode
In response to Flame Sage
nice one ^__^
In response to Flame Sage
Flame Sage wrote:
Gamemaster123 wrote:
Ok how would you code in Pregnancy for a byond game?

Read this: http://bwicki.byond.com/ByondBwicki.dmb?TheCode

TheCode wrote:
"Can anyone give me the battle code?" (Replace battle with GM, teleport, saving, DBZ , racing games, Mystic Journey, Seika, Battle of Evermore, MMORPG/RPG or anything else)

GM123 didn't ask for the Pregnancy code, s/he asked how you would code it.

I'm going to use Harvest Moon 64 as an example. Now, you'd need to define a /mob/ variable that keeps track of how happy your wife is (note: for the wife's mob, not the players mob) and another mob variable that says her current state of pregnancy. Now, add an item that a wife would like (ex: flowers). Now, have a global (as in /var/, not /datum/var/global/) variable that keeps track of the current day. Whenever it changes, check if the wife's happiness is -1.

If it is:
If the player has given his wife 1 or more of that item, her happiness variable increases by one and if the happiness variable is set to 30, set her pregnancy variable to however many days are left until she gives birth; if the player hasn't, her happiness value is set to zero (this example assumes that happiness is only used for the pregnancy code).

If it isn't:
Decrease the pregancy variable by 1. If the pregnancy variable is zero, call the wife's birth() proc (you asked for the pregnancy code, not the birth code :P) and set happiness to zero.

And that's how I would code pregnancy. Obviously there are many different ways to do this, vut this gets you only a teen rating :P. Come to think of it, maybe it was because of the <s>achol</s> <s>alcohol</s> wine and beer and stuff. :P

I hope this has helped. Because it sure hasn't helped my understanding of how to spell a certain word starting with an "a". :P
In response to Guy Hendricks
Guy Hendricks wrote:
GM123 didn't ask for the Pregnancy code, s/he asked how you would code it.

Might as well have, as it amounted to pretty much the same thing. Unless we are actually told what is wanted, as far as we know there are a million different things that the original poster could be talking about.

I'm going to use Harvest Moon 64 as an example.

Why would you do that?

Now, you'd need to define a /mob/ variable that keeps track of how happy your wife is (note: for the wife's mob, not the players mob) and another mob variable that says her current state of pregnancy. Now, add an item that a wife would like (ex: flowers). Now, have a global (as in /var/, not /datum/var/global/) variable that keeps track of the current day. Whenever it changes, check if the wife's happiness is -1.

Now I really wonder why you would use Harvest Moon as an example. If all you have to do to become pregnant and give birth is to make people happy, I would have dozens of children, the child my wife actually is carrying would have been here a long time ago, and heck, even I would be pregnant.

Unless the original poster did not even know what was wanted his/herself and is going to adopt your idea because it is liked, I would be willing to bet, based on the fact that there are thousands of ways to "code pregnancy", that what you gave is not what is wanted; the odds are 100:1 against you.

Of course, it is great that you tried to help, and what you did was good as was your intentions, but "the Code" is what was asked for regardless of whether or not the word "the" was used.

mob/proc/pregnancy()
sleep(10000)
new /mob(loc)

mob/proc/pregnancy()
sleep(10000)
new type(loc)

mob/proc/pregnancy()
sleep(10000)
new /mob/baby(loc)

mob/proc/pregnancy()
pregnant += src
dueDate = today + 270
mob/proc/pregnancyCheck()
if(dueDate-today < 100 && prob((100-(dueDate-today))/2))
birth()
return 1
proc/newDay()
...
pregnancyCheck()
...
proc/pregnancyCheck()
for(var/mob/M in pregnant)
if(M.pregnancyCheck())
pregnant.Remove(M)

proc/year()
//this function gets called every in-game year
for(var/mob/M)
if(prob(1)) M.birth()

mob
var/married
verb/propose(mob/M in oview(1))
if(married || M.married) return
var/answer = alert(M, "Marry me?", "[name]", "Yes","No")
src << answer
if(answer == "Yes")
married = M
M.married = src
verb/procreate()
if(!married) return
var/answer = alert(M, "Have my child?","[name]", "Yes","No")
src << answer
if(answer == "Yes")
new /mob(M.loc)

//a spoof on Harvest Moon
mob/wife
var/mob/husband
var/pregnancy = 0
verb/get()
set src in oview(1)
if(husband)
usr << "I'm taken."
return
husband = usr
usr.husband = src
Move(usr)
verb/feed()
set src in oview(1)
if(usr == husband)
var/obj/food/food = locate() in usr
if(food)
del(food)
pregnancy += 1
if(pregnancy >= 50)
new /mob(loc)
pregnancy = 0
mob/verb/dropWife()
var/mob/wife/wife = locate() in contents
if(wife) wife.loc = loc


And I could go on and on like that, and a lot of the scenarios can get way out there, especially depending on the setting of the game.