• ✨ ARCHIVE MODE ✨
    The forum has now been set to read-only mode, no new posts, resources, replies etc will not be possible.
    We recommend you join our Discord server to get real-time response: Discord Invite Link

[0.28.2]Moves that still don't work properly

Status
Not open for further replies.

snoe

Active Member
also curious, what language is the coding in?
i know java(as much help as that'll do)
and my terms are stuck with methods and classes
so at least knowing what the language is would help me learn
 

DracoHouston

Kolben Developer
Contributor
little primer for LUA

lua is a fully featured programming language, run through an interpreter (as in, its not compiled, and you can literally enter LUA code into the interpreter at runtime to do stuff) it has variables, functions, types and so on

however, it is a dynamically typed language, variables don't have types, the values do. a variable can therefore be anything you want it to be.

there is a system for data organisation called tables, you won't need them in most cases, for an example of tables used like a dynamic array, see attacks/normal/conversion.lua's special attack

to declare a variable you go name = value like
T = "Hello World"
will declare a global variable called T. this could then be accessed anywhere in the code, or via the interpreter at runtime, to make something more disposable you declare a local variable.
local T = "Hello, errrr, just this script i guess? hi!"
that will make a variable called T you can acccess in that scope. the scope in programming is where you are in the code. if you declare a local inside an if statement like this
Code:
T = "hello world"
if T == "hi" then
    local Y = "i'm only local to this if"
end
--the following will then not work and create an error message in your log.dat saying Y doesn't exist
T = Y
anyway, you can have numbers, text, booleans (true or false), functions etc as variables. you'll mostly deal with numbers, bools, and text (strings)

you declare a global function with
Code:
function functionname(arguments)
    -- function body
    --optionally you can return a value
    return true
end
if your function returns a value you can use it like
Code:
function SomeAttackSpecialDelegate()
    local result = Attacks_TryToFlinch(30, "target")
    if result == true then
        Attacks_SetStore("Flinched!")
    end
end
-- these functions i'm calling aren't real btw this is just an example
function SomeAttackHitAnimation()
    AnimationSequenceBegin()
    if Attacks_Store == "Flinched!" then
        Attacks_DoFlinchAnimation("target", 7.0)
    end
    Attacks_placeholderattackanimation(0.0)
    AnimationSequenceEnd()
end
ok so operators are
+, -, *, / math operators, add, subtract, multiply, divide
= make this variable equal to (sets a variable)
comparisons (returns true or false)
== is this variable equal to?
~= not equal
< less than
> greater than
<= >= less than or equal to, greater than or equal to
.. concatenate strings (join them together)
# unary, can be used to find the length of a table (how many things are in it). again, see conversion for an example

there are also standard functions the language comes with, i use math library mostly. the most useful functions with regards to attack scripting are
math.random() - called with no arguments it returns a number between 0.0 and 1.0
math.random(min, max) with 2 whole numbers passed into it it will return a random number ranging from min to max
math.ceil(number) will make a floating point number (one with a decimal point) into a whole number by rounding UP
math.floor(number) does the same thing but rounds DOWN

there are 2 very useful flow control statements you can use with attack scripts

if condition then
end

and

for var=start, end, step do
end

the if statement is simple, if this is true then do everything between this line and its 'end'

please note that end is scoped like local variables, you can chain things that end with end :p like
Code:
-- a bunch of stupid nonsense
function blah()
    local i = 0
   if i == 0 then
       for i = 0, 10, 1 do
            i = i
       end
    end
end
examples on how to use both statements above

also to make a comment you type 2 dashes. this can go anywhere in the code, everything after a double dash won't be read at all, and only be there to make the script more human readable
 

DracoHouston

Kolben Developer
Contributor
also curious, what language is the coding in?
i know java(as much help as that'll do)
and my terms are stuck with methods and classes
so at least knowing what the language is would help me learn
LUA, the same scripting language that powers WoW UI mods and garrys mod mods :> it pwns
 

Darkfire

Administrator
Administrator
P3D Developer
REMINDER
this is just for attacks(and abilities?)
not for everything else.....
everything else is designed by nilllzz
 

snoe

Active Member
also curious, what language is the coding in?
i know java(as much help as that'll do)
and my terms are stuck with methods and classes
so at least knowing what the language is would help me learn
LUA, the same scripting language that powers WoW UI mods and garrys mod mods :> it pwns
So by what I read, functions are akin to java methods. And basically all the fundamentals like conditionals(if-then-else, booleans) while and for loops. And operands all work the same. But there's no typing for variables such as int, double, etc. that singular fact punches holes in everything I've learned D:

Jk but seriously it'd be like learning a new form of the same language, almost
 

DracoHouston

Kolben Developer
Contributor
REMINDER
this is just for attacks(and abilities?)
not for everything else.....
everything else is designed by nilllzz
we're having difficulty phasing out the NPC scripting engine entirely but in time we're going to offer a LUA solution to scripting in the maps, where your script has a update tick and you check for conditions in there and execute the correct command for the time. it'll require more work but allow much more complex scripts, but also allow multiple scripts to be going. i havent worked on this much because other things are still hard coded and we need them to be moddable
 

DracoHouston

Kolben Developer
Contributor
LUA, the same scripting language that powers WoW UI mods and garrys mod mods :> it pwns
So by what I read, functions are akin to java methods. And basically all the fundamentals like conditionals(if-then-else, booleans) while and for loops. And operands all work the same. But there's no typing for variables such as int, double, etc. that singular fact punches holes in everything I've learned D:

Jk but seriously it'd be like learning a new form of the same language, almost
you'll find a lot of languages are alike and when you learn the fundamentals of your first language its easier to grasp everywhere else

LUA is strange because it doesn't have classes, but it has tables, and varaibles can be anything, you can load a table with stuff using table constructors and even do inheritance.
 

snoe

Active Member
REMINDER
this is just for attacks(and abilities?)
not for everything else.....
everything else is designed by nilllzz
we're having difficulty phasing out the NPC scripting engine entirely but in time we're going to offer a LUA solution to scripting in the maps, where your script has a update tick and you check for conditions in there and execute the correct command for the time. it'll require more work but allow much more complex scripts, but also allow multiple scripts to be going. i havent worked on this much because other things are still hard coded and we need them to be moddable
So your basically gutting out the old coding while trying to maintain the framework and putting in the brand spanking new LUA?

Or are you going to totally revamp the whole game from LUA?
 

snoe

Active Member
So by what I read, functions are akin to java methods. And basically all the fundamentals like conditionals(if-then-else, booleans) while and for loops. And operands all work the same. But there's no typing for variables such as int, double, etc. that singular fact punches holes in everything I've learned D:

Jk but seriously it'd be like learning a new form of the same language, almost
you'll find a lot of languages are alike and when you learn the fundamentals of your first language its easier to grasp everywhere else

LUA is strange because it doesn't have classes, but it has tables, and varaibles can be anything, you can load a table with stuff using table constructors and even do inheritance.
Also LUA replaces brackets with "end" and I find that interesting.it seems harder organization and scope wise figuring out how many "end"s to put into a function. Of course enough time can train people to acclimate
 

DracoHouston

Kolben Developer
Contributor
we're having difficulty phasing out the NPC scripting engine entirely but in time we're going to offer a LUA solution to scripting in the maps, where your script has a update tick and you check for conditions in there and execute the correct command for the time. it'll require more work but allow much more complex scripts, but also allow multiple scripts to be going. i havent worked on this much because other things are still hard coded and we need them to be moddable
So your basically gutting out the old coding while trying to maintain the framework and putting in the brand spanking new LUA?

Or are you going to totally revamp the whole game from LUA?
well theres a problem with just plain going to LUA right now, when i started trying it soon found that calling a bunch of stuff to make things happen would execute them all immediately. you can't do blocking within the script because the game calls the stuff sequentially and waits for the interpreter to say its run out of stuff to execute, so pausing the script to wait would lock the game up, yikes!

i came up with 2 solutions, 1 a bandaid, the other a more permanent one.

the first was to make it so you declare you're making a blocking sequence, then call a bunch of stuff to set things up, then you say the sequence is fully set up and it goes to the old scripting engine and Just Works. the big issue with that was i had only made a cleaner looking way to do the old scripts and it really didn't add any value to it other than better syntax. it also retained the faults of the old scripting engine, which couldn't nest Options:when:endwhen's well at all.

the second idea i had was just to let the modder make their own version of the old scripting engine. the way the old system works is its fed the script as a bunch of strings (1 for each line, in the order they are read) and it goes through reading these lines and decides what to do at any particular time.

when you go
@Text:blah blah
its telling the game bring up a text box with this and WAIT for the player to dismiss it, then move on. its not something i can adequately give people with a simple call to Text() or something. so the LUA version of this would be like (and i forget the function names and dont have my IDE open so dont quote me on these function names)
Code:
RegisterScriptHandler("SOME_SCRIPT_HANDLER")
Text("blah blah")
LockInput()
function SOME_SCRIPT_HANDLER()
    if WaitingForInput == false then
        UnregisterScriptHandler("SOME_SCRIPT_HANDLER")
        UnlockInput()
    end
end
using this i made a sequence of text boxes and pokemon view boxes that waited for input

but the real cool thing about using LUA is it doesn't have to wait for input, stuff like move commands wait to finish before continuing with the script in the old system, in this one everything is inherently not blocking. i want to have scripts moving the pillar in sprout tower, scripts moving platforms around in a recreation of the hg/ss gyms someone might do, lots of stuff it can be used for

but for now my goals mostly
attacks need to all be possible
better animation stuff (what we have now is soooooo hard, needs particle systems!)
items as scripts
abilities as scripts (they are already but theyre placeholders because abilities don't do anything yet so there was nothing to give interfaces for lol)
UI screens as scripts
also hard coded UI screens being in the same system as the LUA ones so LUA ones can mod our screens.... FROM CONTENT PACKS


other possibilies down the track
- types set up by a script file so mods can change the type relationships, the most obvious use for this would be a gen 1 mod
- natures, so you can change how the natures affect growth and so on. or make it so you have 1 nature that does nothing for a gen 1 mod. give all pokemon an ability that does nothing (not hard right now hahaha) and take out dark and steel and change the species data and attacks to fit the 1st gen versions, remove all the gen 2+ attacks, bam, gen 1. only ish would be i dont know if i can let people get rid of special attack and special defense to make it just 'special' lol but thats pretty minor
 

DracoHouston

Kolben Developer
Contributor
you'll find a lot of languages are alike and when you learn the fundamentals of your first language its easier to grasp everywhere else

LUA is strange because it doesn't have classes, but it has tables, and varaibles can be anything, you can load a table with stuff using table constructors and even do inheritance.
Also LUA replaces brackets with "end" and I find that interesting.it seems harder organization and scope wise figuring out how many "end"s to put into a function. Of course enough time can train people to acclimate
use whitespace :) a tab, 2 spaces or 4 spaces, whatever suits you

you cant use whitespace in the npc scripts atm and it makes even the most simple script look like spaghetti
 

Darkfire

Administrator
Administrator
P3D Developer
I would def rather stay with the current weird scripting if we have to do all that
I mean it would probably be good practice for me but still.....I am lazy.....
Changing type stuff would be cool...I got some requests to make a Pokemon Brown remake and I am quite willing but I would need to be able to change A LOT of stuff including types....

Do natures, and EVs currently work properly. I am pretty sure EVs do but I might as well check
 

DracoHouston

Kolben Developer
Contributor
I would def rather stay with the current weird scripting if we have to do all that
I mean it would probably be good practice for me but still.....I am lazy.....
Changing type stuff would be cool...I got some requests to make a Pokemon Brown remake and I am quite willing but I would need to be able to change A LOT of stuff including types....

Do natures, and EVs currently work properly. I am pretty sure EVs do but I might as well check
yes thats all working. a few patches back pokemon were not giving you the EV yields on defeat so EVs didnt grow, even as they were applied to stat growth, lol. made me not even bother playing for ages. thats been fixed for about a month though

and yes i'm well aware that it is a lot of boilerplate to set up a LUA script, which is why i advised nils that we might wanna have them work side by side, perhaps a better version of my 1st idea for LUA scripting could fill that niche. there has to be a simple way to do a little sequence for NPCs, for sure. but it's really hard describing everything as that kind of script, so in time you'll have both systems probably.
 
Status
Not open for further replies.
Top