#lua npc code not working
120 messages · Page 1 of 1 (latest)
this is the code
i have read the articles but i still dont really understand what im doing wrong
function onBegin()
summonTheo()
moveTheo(4*8, 0) -- move theo 4 tiles right
end
Thanks a lot
If I need anymore help can I ask on this thread?
it still doesnt work
i know im doing something wrong
is the onbegin at the end
like this?
yea
ah position
you need to give the position to summonTheo
give it a vector2(..., ...)
like the x and y coordinates
yes
how do i see them in lonn
do you have celestetas installed
id advise you do
ok 1 moment
then press left ctrl twice in-game to see your current position
and other stuff
initially its a bit confusing to navigate but its rather intuitive
(you can drag the menu around by holding left ctrl and dragging the menu with your mouse)
so do i put the posion of where my lua cutscene trigger is?
it can be wherever
oh ok
...no
uh
you don't change the definition
o
you change the call
ooh
summonTheo(vector2(211,144))
dude that works
what would i of done without you
also
moveTheo(4*8, 0)
if i want him to move more
do i do moveTheo(10*20, 0)
why am i asking i can just try it
the units are in pixels
there's 8 pixels in a tile
hence the 4*8
this moves theo right 4 tiles
yes
ok
similarly if you put it in the y coordinate
+y is down, -y is up
thatll be a bit complicated
open vanilla's Sprites.xml that can be found in content/graphics
then look for a line that resembles granny
yes
like the one of granny laughing
i think i found granny
<granny path="characters/oldlady/" start="idle">
still nothing
so you edit the GFX.SpriteBank:Create line from theo to granny
is it granny or oldlady?
granny
oh alr
we go by the xml name
yea it works
if i want to play her laught do i do
granny.laughAnim = "laugh"
that seems to break the code though
laughAnim does not exist on the NPC class
put shortly: this is a nono
do you want her to laugh as her idle animation
how do i see the NPC class
decompiling the game
you can but it's more involved
do i have to change the idle anim of hers after i use it
nno i dont think so
you can just say("abc") then theo.Sprite:Play("laugh")
(the npc is still labeled theo in lua)
does it not?
no
huh
maybe its a diffrent sprite
i'm on phone and id need to look at the decompilation
and even then this sounds kinda complicated
oh its alr then
i did find a problem though
if i skip the cutscene theo will be walking in place instead of sitting down
because you interrupted the cutscene while it's doing its thing
you need to tell it what to do if the cutscene ends and was skipped
i hate that youre just giving me the code
i want to be able to do this on my own but its so hard 