|
Development Forum |
 |
| Plant won't Decay (C3/DS) - Resolved | |
|
 Air Guitarist
kezune
    

|
12/8/2013 | |
So I'm working on a plant that grows, lives a little while, makes seeds and then dies.
The plant grows, lives and pops seeds out well enough but I can't seem to get it to start decaying properly. I was following this Wiki Tutorial.
Here's one error it throws:
Runtime error in agent 2 4 15330 script 2 4 15330 9 unique id 2305
Invalid TARG
... ie loop subv va00 1 {@}pose va00 wait rand 40 80 untl ... |
And another.:
Runtime error in agent 2 4 15330 script 2 4 15330 9 unique id 2025
Pose change failed - new pose 7 on part 0 which has base 0
... ie loop subv va00 1 {@}pose va00 wait rand 40 80 untl ... |
And here's the .cos, top to bottom.
inst
*Install
new: simp 2 4 15330 "Sparkleseed" 14 0 rand 200 5000
BHVR 32
ATTR 198
perm 40
emit 7 1
accg 3
elas 20
fric 40
setv ov10 rand 200 1000
mvsf game "CreatorX" game "CreatorY"
velo rand 10 25 rand 0 -10
TICK 60
endm
*Timer
scrp 2 4 15330 9
Tick 0
gsub grow
gsub live
gsub seed
gsub die
subr grow
setv va00 pose
reps 8
wait rand 40 80
addv va00 1
pose va00
repe
retn
subr live
loop
doif ov10 ne 100
setv va01 ov10
subv va01 1
setv ov10 va01
endi
wait 1
untl ov10 = 100
retn
subr seed
setv va10 posx
setv va11 posy
snde "pop4"
reps rand 2 5
new: simp 2 3 15331 "Sparkle_seed" 1 0 1000
attr 195
bhvr 48
elas 10
aero 2
accg 0.2
mvsf va10 va11
velo rand -10 10 rand -10 0
tick 1
repe
wait rand 40 90
retn
subr die
loop
setv va00 pose
subv va00 1
pose va00
wait rand 40 80
untl pose = 0
setv va20 256
loop
subv va20 50
alph va20 1
wait 7
untl va20 <= 6
kill ownr
retn
endm
scrp 2 3 15331 12
snde "chwp"
stim writ from 77 1
kill ownr
endm
scrp 2 3 15331 9
wait rand 40 80
setv va00 posx
setv va01 posy
new: simp 2 4 15330 "Sparkleseed" 14 0 rand 200 6000
bhvr 32
attr 196
perm 40
emit 7 1
accg 3
elas 20
fric 40
aero 2
setv ov10 rand 200 1000
mvsf va00 va01
tick 1
kill ownr
endm |
Updated Rehosting Policy[/title] |
 Prodigal Sock
Ghosthande
    

|
12/8/2013 | |
"Invalid TARG" tends to be caused by one of two things: either the script is targeting the wrong agent when it gets to that part of the code, or the agent it's trying to target has been killed before it gets there. Since it looks like the plant is supposed to be targeting itself, I doubt the problem is that the "targ" has been killed (because the script would have simply stopped running). So it's probably trying to target something else by mistake.
I suspect the problem is that there is no "TARG OWNR" line after it creates a seed... without being "redirected" back to itself, it's probably trying to apply that block of script to the seed. This might actually be the cause for both of the errors you've encountered.
 |
 Air Guitarist
kezune
    

|
12/8/2013 | |
Thank you for the advice! (And thank you, too, Liam!) Adding targ ownr to the subroutine worked fabulously. 
Updated Rehosting Policy[/title] |

Malkin
     Manager

|
12/8/2013 | |
Where did you put the TARG OWNR? It sounds like the tutorial needs fixing.
My TCR Norns |
 Air Guitarist
kezune
    

|
12/8/2013 | |
Right here.
subr die
targ ownr <--
loop |
Updated Rehosting Policy[/title] |

Malkin
     Manager

|
12/8/2013 | |
Thanks, I've edited the page to add in the code and a brief explanation of that line. 
My TCR Norns |
 Prodigal Sock
Ghosthande
    

|
12/9/2013 | 1 |
Just for future reference, it's generally best if "TARG OWNR" comes right after the block that creates one seed. When it appears after all the seeds are created (like right now), that means that actually, each seed is creating the next seed, intead of the plant creating all of them, because the plant isn't being retargeted between seeds. This won't affect the location where the subsequent seeds are created in this script, since you specify POSX and POSY before looping through seeds, but under some circumstances it can still cause errors.
 |