creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
Patch Plant Problems [Resolved]   
Laura
Tea Queen

Laura
United Kingdom  

 visit Laura's website: CC Chat
  12/20/2014

Does anyone know why my patch plant won't fall off the patch, please? I know I've had it happen before with previous patch plants, but I've completely forgotten how to fix it. ><

* install invisible flag agent
* using my range '14872' so the mistletoe doesn't clash with other patch plants:
new: simp 1 205 14872 "blnk" 0 0 9000

* this is the script that the patch core will trigger when it's time to spawn mistletoe:
setv name "spawn_script" 1000

* sprite image file and frame when the mistletoe is fully grown:
sets name "sprite_file" "mistletoe"
setv name "sprite_pose" 4

* classifiers (family, genus, species):
setv name "prod_fmly" 2
setv name "prod_gnus" 4
setv name "prod_spcs" 14872

* set va00 to targ, enumerate all the instances of the patch core agent
* send a message to that patch core agent that script 1000 is being targetted:
seta va00 targ
enum 1 1 22929
mesg wrt+ targ 1000 va00 0 0
next

* spawn:
scrp 1 205 14872 1000
inst

* create mistletoe:
* 8 in order to import all images
new: simp 2 4 14872 "mistletoe" 8 0 name "patch_plane"

* mistletoe properties:
* attr 80 = mistletoe invisible to creatures so they won't be eaten, and don't want them to suffer physics just yet.
bhvr 33
attr 84
accg 3
perm 60
fric 100
elas 20
aero 1

* move to co-ords sent by the core patch agent:
mvto _p1_ _p2_

setv name "patch_id" mame "patch_id"
tick rand mame "tickfrom" mame "tickto"

* default tick:
doif tick eq 0
tick 300
endi
endm

* timer:
scrp 2 4 14872 9
* add one to our counter
addv ov00 1

* growing and rotting in one
doif ov00 = 2 or ov00 = 4 or ov00 = 6 or ov00 = 8 or ov00 > 22
* rot away
doif pose = 6
kill ownr
else
* grow / start rotting
setv va00 pose
addv va00 1
pose va00
endi
endi

* fall off
doif ov00 = 14 and attr = 67
setv name "patch_id" 0
attr 195
stop
endi

* become visible and carryable
doif ov00 = 11 and attr = 80
attr 67
endi
endm

* pick up mistletoe
scrp 2 4 14872 4
inst
* if it's attr is still 67, you (or a creature) are picking it directly off the plant and need to set it so it doesn't act attached to the patch anymore.
doif attr = 67
attr 195
stim writ from 84 1
* clear the patch_id variable so a new one can spawn:
setv name "patch_id" 0
endi
* increase their sex drive when picked up:
targ from
* sex drive chemical, 0.3 = strength of chemical:
chem 161 0.3
* reward chemical, 0.3 = strength of chemical:
chem 204 0.3
doif gnus eq 1

* urge writ for Norns:
urge writ targ 36 0.3 1 0.3
elif gnus eq 2
* urge writ for Grendels:
urge writ targ 37 0.3 1 0.3
elif gnus eq 3
* urge writ for Ettins:
urge writ targ 38 0.3 1 0.3
else
* urge writ for Geats:
urge writ targ 39 0.3 1 0.3
endi
targ ownr
endm

* simplified collision script for mistletoe:
scrp 2 4 14872 6
lock
sndc "smit"
endm

* vend poisonous berry:
scrp 2 4 14872 1
* "I have pushed good plant"
stim writ from 84 1
* make sure only fully grown 'toes produce berries
doif pose = 4
* save the mistletoe's position
setv va00 posx
setv va01 posy

* berry properties
* bad fruit so non-toxics steer clear
new: simp 2 9 14872 "mistletoe" 1 7 501
* BHVR: eat & pick up
bhvr 48
* ATTR: mousable, suffer collisions & suffer physics
attr 194
elas 10
aero 5
accg 3
perm 100
fric 50
* move to mistletoe coordinates
mvsf va00 va01
endi
endm

* simplified collision script for poisonous berry:
scrp 2 9 14872 6
lock
sndc "smit"
endm

* eat poisonous berry
scrp 2 9 14872 12
sndc "chwp"
* "I have eaten detritus"
stim writ from 81 1
* weak cyanide to benefit toxic creatures
targ from
chem 67 0.2
kill ownr
endm

* remove:
rscr
enum 1 205 14872
kill targ
next
enum 2 4 14872
kill targ
next
enum 2 9 14872
kill targ
next
scrx 2 4 14872 9
scrx 2 4 14872 4
scrx 2 4 14872 6
scrx 2 4 14872 1
scrx 2 9 14872 6
scrx 2 9 14872 12

Thanks for any help! :)

 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  12/20/2014

Have you tried using a function like text compare to compare the code for this with the code for the most recent patch plant you've written from scratch that falls?

It looks like you've set the mistletoe's attr to 80 (invisible, suffer collisions) when you first make it, but the 'test if you need to fall off' is set to 67 (carryable, mouseable, suffer collisions). The 'test if you need to become visible' requires ov00 to be set to 11 and attr to be set to 80.

Perhaps you could test if ov00 gets to 11 by adding in a random tint doif to the timer script?


inst
*red random value between 0 and 255
*you can alter the minimum and maximum to get values in a certain range
setv va00 rand 0 255
*green
setv va01 rand 0 255
*blue
setv va02 rand 0 255
*swap
setv va03 rand 0 255
*rotation
setv va04 rand 0 255
*put the relevant classifier in here
*you can use "targ hots" instead if easier
rtar 2 4 14872
*apply the random values the script has chosen
tint va00 va01 va02 va03 va04
*now output them along with labels
outs "red: "
outv va00
outs " green: "
outv va01
outs " blue: "
outv va02
outs " swap: "
outv va03
outs " rotation: "
outv va04


I'm not so sure that using 'bad fruit' will make non-toxics steer clear of the fruit - the only official example of 'bad fruit' in the game, the yule booze, is as nutritious as a fruit and relieves boredom through alcohol. [nlaugh]


My TCR Norns
 
Laura
Tea Queen

Laura


 visit Laura's website: CC Chat
  12/20/2014

Haha, oops! That was probably wishful thinking on my part. :P I've changed it so the berries are classified as 'detritus' now. Thanks. :)
 


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