creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
Critter hatching from moved egg?   
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  7/28/2013

Let's say I have a critter egg agent.

I want to make it so that the Hand can pick it up (using the mouseable ATTR) and place it elsewhere, and that the critter egg will hatch in the new location, and the critter will appear in the 'elsewhere' position, not where the egg initially appeared.

When should I set the position commands so that when the egg hatches, the critter will appear in the same location as the egg most recently was?

I've had this problem before with the Prate, and the code for that is below:

*The Egg timer script! :D
scrp 2 18 10855 9
setv va00 0

doif ov01 >= 5
kill ownr
endi

rnge 500
esee 2 15 10854
addv va00 1
next
esee 2 18 10855
addv va01 1
next

doif va00 >= 5
gsub dorm
else
gsub hatch
endi

subr hatch
setv va06 posl
setv va07 post
frat 20
anim [0 1 2 3]
over
wait rand 50 200
pose 5
new: simp 2 15 10854 "prate" 25 0 4100
bhvr 57
attr 199
elas 5
accg 1
perm 100
rnge 200
setv ov02 400
setv ov05 0
setv ov00 0
setv ov45 0
setv ov46 0
doif tmvt va06 va07 eq 1
mvto va06 va07
else
mvsf va06 va07
endi
tick 1
wait rand 100 300
kill ownr
retn

subr dorm
wait rand 50 300
addv ov01 1
retn

endm


As far as I can see, this code for my new agent will have the same problem - can anyone please suggest any tweaks to make it re-register its new location?


***********
*EGG TIMER*
***********
scrp 2 18 10854 9
**If you've been hanging around for a bit
doif ov00 ge 5
**go die now
gsub diee
**if it's not afternoon or night time
elif time ne 3 or time ne 4
**go be dormant for a bit
gsub dorm
**if your egg is fresh and it's afternoon or night time
else
**go hatch
gsub hatch

endi

**die subroutine
subr diee

kill ownr

retn

**dormancy subroutine
subr dorm

wait rand 50 700

addv ov00 1

doif time = 3 or time = 4

gsub hatch

elif ov00 ge 5

gsub diee

endi

retn

**hatch subroutine
subr hatch
rnge 200
setv va66 0
esee 2 13 10854
addv va66 1
next
doif va66 le 30 and fall = 0
**set the place you're going to hatch from
setv va00 posl
setv va01 post
inst
new: simp 2 13 10854 "albianglowworm" 12 0 name "patch_plane"
attr 198
bhvr 57
elas 4
perm 60
accg 2
aero 2
fric 50
emit 1 0.001
mvsf va00 va01
***movement counter
setv va20 rand 1 2
doif va20 = 1
setv ov00 51
*both need a tick to start the timer
tick 1
else
setv ov00 0
*both need a tick to start the timer
tick 1
endi
**the egg should be destroyed now
targ ownr
kill ownr
endi
retn

endm


My TCR Norns
 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  7/30/2013  1

Ok, so I've been pointed to the gnarler egg as an example of a critter egg that you can move around (thanks!):

***********egg timer
scrp 2 18 18 9
doif carr ne null
tick 300
stop
endi
doif pose eq 9
kill ownr
endi
base 0
anim [0 1 2 3 4 5 6 7 8]
over
inst
attr 0
*if facing left
doif ov10 eq 0
setv va99 -1
else
setv va99 1
endi
setv va00 posl
setv va01 post
new: simp 2 15 22 "gnarl" 88 88 4100
attr 198
clac 0
fric 10
elas 30
perm 80
accg 2
setv ov05 0
tick 8
doif tmvt va00 va01 eq 1
mvto va00 va01
else
mvsf va00 va01
endi
***OV02 is energy level
setv ov02 rand 20 50
**bioenergy
setv ov61 75
setv ov10 va99

targ ownr
pose 9
wait 300
kill ownr
endm


So I'm seeing that if the egg is being carried, the egg waits for a tick of 300. Then I assume the egg dies if it's in its 'hatched' position, or grows if it's not in its 'hatched' position, and I'm not sure what va99 represents. Then the 'being carried' doif ends. Immediately after that, the position is set, and the egg vends the baby gnarler. :)


My TCR Norns
 


downloads
cobs
adoptions
creaturelink
metarooms
breeds
 
gallery
art
wallpaper
screenshots
graphics
promos
sprites
dev
hack shack
script reservations
dev resources
active projects
dev forum
 
community
links
advice
chat
polls
resources
creatchi
 
forum
bookmarks
general
news
help
development
strangeo
survivor
mycaves
log in
register
lost pw
0 online
creatures caves is your #1 resource for the creatures artificial life game series: creatures, creatures 2, creatures 3, docking station, and the upcoming creatures family.

contact    help    privacy policy    terms & conditions    rules    donate    wiki