Development Forum |
|
|
Malkin Manager
|
4/2/2020 | |
I'm trying to convert helen's toy car cob into C3/DS code, and the REPS isn't working. Does anyone know why, or how to fix this?
inst
new: simp 2 21 1005 "hcar" 2 0 3500
attr 199
bhvr 43
elas 99
accg 1
aero 10
fric 60
perm 60
doif tmvt mopx mopy eq 1
mvsf mopx mopy
endi
scrp 2 21 1005 1
snde "hcr1"
stim writ from 97 1
setv ov00 rand 0 1
pose ov00
doif pose eq 0
reps 10
velo 6 -2
wait 1
repe
else
reps 10
velo -6 -2
wait 1
repe
endi
velo 0 0
endm
scrp 2 21 1005 2
stim writ from 97 1
mesg writ ownr 0
endm
scrp 2 21 1005 3
stim writ from 97 1
mesg writ ownr 0
endm
scrp 2 21 1005 6
snde "drop"
endm
|
My TCR Norns |
Vermidia
|
4/2/2020 | |
I think the collision script activates when the toy is veloed upwards and falls down, interrupting the script. You can try locking the script, so it doesn't get interrupted by the collision script.
Edit: Can confirm the agent does not work normally in C2 aswell. Lock does fix it.
You know...wait...nevermind... wait...no...umm...maybe later... |
Malkin
Manager
|
4/2/2020 | |
Locking the whole of script 1 doesn't seem to make a difference.
My TCR Norns |
Vermidia
|
4/2/2020 | |
Hmm, it worked on my end for C2. The car only moves alittle in my experience, and the fric or accg might be too high and cause it to stop.
You know...wait...nevermind... wait...no...umm...maybe later... |
Moe
|
4/2/2020 | 2 |
So locking it is definitely important because the collision script will interrupt the movement, but I find the way it handles movement to be odd overall. If you're replicating how Helen did it, maybe it wasn't designed with C3/DS's physics in mind? Not sure without seeing the C2 source. That said, this gives me better results:
I adjusted the gravity, elasticity, and aerodynamics. Then I changed the way it handles the movement. Instead of forcing the velocity, I add to the velocity. Gives it smoother movement, though it probably won't handle going uphill very well. Additionally, I gave it a little upwards momentum before each horizontal movement so that it won't immediately be impeded by friction. Finally, I locked that portion of the script so collisions won't interrupt it.
inst
new: simp 2 21 1005 "hcar" 2 0 3500
attr 199
bhvr 43
elas 50
accg 2
aero 5
fric 60
perm 60
doif tmvt mopx mopy eq 1
mvsf mopx mopy
endi
scrp 2 21 1005 1
snde "hcr1"
stim writ from 97 1
setv ov00 rand 0 1
pose ov00
lock
doif pose eq 0
reps 10
addv vely 1
addv velx 6
wait 1
repe
else
reps 10
addv vely 1
addv velx -6
wait 1
repe
endi
unlk
*velo 0 0*
endm |
You might also be interested in how I converted the C2 racecar. This one relies on LOOP instead of the REPS commands. In contrast to Helen's, this one adds downwards velocity to ensure the racecar stays on the ground as it zoom-zooms.
scrp 2 21 50204 1
lock
stim writ from 97 1
*target the person who touched me*
targ from
*get their position*
setv va00 posl
*switch target back to me*
targ ownr
*are they on the left or right of me?*
doif posx gt va00
setv va00 1
else
setv va00 0
endi
setv vely -2
sndl "car1"
*if they're on X side of me, go the other way*
doif va00 eq 0
pose 0
anim [1 2 3 4 255]
loop
wait 1
addv va01 1
setv velx -8
addv vely -2
untl va01 ge 50
pose 0
*otherwise, go the OTHER other way*
else
pose 5
anim [6 7 8 9 255]
loop
wait 1
addv va01 1
setv velx 8
addv vely -2
untl va01 ge 50
pose 5
endi
stpc
unlk
endm
|
|
Malkin
Manager
|
4/3/2020 | |
Thanks, Moe!
My TCR Norns |
|