Yeah! In fact, it's already been created. Now, for the all-new price of $0, you can download software such as Brackets and Notepad++ which makes writing code so much easier! Now, instead of writing code in binary, it's been translated into a text editor with syntax highlighting! It's so easy!
/s
If you can't be bothered to write code yourself, then don't expect people to make code for you for free. People are already making free software called Unitale that allows you to edit it with a script instead of coding the engine from scratch yourself. That's massively generous already. Battle creation will be shit and extremely limited if we make something like that. Lua is probably the best option to go with. If you can't do that, then you're not gonna be making anything with Unitale anytime soon.
http://www.filedropper.com/wizhared -- download the mod (requires 0.2.1a)
Wizhared is a fairly normal enemy that demonstrates animation and some mildly elaborate attacks.
Features:
That's what the documentation is for, I'd also suggest having a look at the PIL, programming in LUA before trying to start.
The second if under the Plead command should be elseif, and you're missing an end for both that function and the if function for the commands themselves. Additionally, currentdialogue is the spoken monster dialogue, and BattleDialog is what's displayed in the text box; you have the two switched right now.
The fixed code should look like this:
-- This handles the commands; all-caps versions of the commands list you have above. function HandleCustomCommand(command) if command == "Cry" then BattleDialog({"Your cry went unheard."}) elseif command == "Threat" then BattleDialog({"Ivy did not react."}) elseif command == "Plead" then if atk == 80 then BattleDialog({"You said you didn't wanna \nfight. Nothing happened."}) elseif atk<=100 then BattleDialog({"You said you didn't wanna \nfight. ATK dropped."}) atk = atk - 5 currentdialogue = {"Hmph."} end end end-- your code goes here-- your code goes here
If you run into errors like this again, it might be a good idea to run your code through an online Lua checker. The Lua demo page usually works for that, or alternatively you could try Ideone for longer scripts (the Lua demo page seems to have a character limit).
You can change your damage by changing the enemy's defense in the monster lua.
def = -100 --More damage!
This is the only way to change damage at the moment, but I think custom attacks and weapons are planned for the far future.
https://stackoverflow.com/questions/12386803/carriage-return-line-feed-and-new-line
I'm guessing this is the issue?
If you use a text editor that recognizes line endings of the file (sublime, vim) you'll be fine.
Oh, you must not know how to implement it into the encounter file. That's alright! Here, I'll explain to you how to do it.
First, find the relevant area of code. The code I've been showing you involves HandleSpare
, so look for that in your encounter file.
Here it is with some of its surrounding code:
function EnemyDialogueEnding() nextwaves = { possible_attacks[math.random(#possible_attacks)] } end
function DefenseEnding() encountertext = RandomEncounterText() end
function HandleSpare() State("ENEMYDIALOGUE") end
Then, take the code example I gave you - let's pretend it's this code:
sparecount = 0 function HandleSpare() sparecount = sparecount + 1 if sparecount == 1 then enemies[1].SetVar('currentdialogue', {"Spare 1"}) elseif sparecount == 2 then enemies[1].SetVar('currentdialogue', {"Spare 2"}) elseif sparecount == 3 then enemies[1].SetVar('currentdialogue', {"Spare 3"}) end State("ENEMYDIALOGUE") end
Finally, replace the first code with this new code.
Now you should have this:
function EnemyDialogueEnding() nextwaves = { possible_attacks[math.random(#possible_attacks)] } end
function DefenseEnding() encountertext = RandomEncounterText() end
sparecount = 0 function HandleSpare() sparecount = sparecount + 1 if sparecount == 1 then enemies[1].SetVar('currentdialogue', {"Spare 1"}) elseif sparecount == 2 then enemies[1].SetVar('currentdialogue', {"Spare 2"}) elseif sparecount == 3 then enemies[1].SetVar('currentdialogue', {"Spare 3"}) end State("ENEMYDIALOGUE") end
In the event that the above explanation did not help, here is a copy of the encounter skeleton with my code in place.
Put a music file in your mod's Audio folder. The file should be a .wav or .ogg file.
If your music is something like "coolmusic.mp3", renaming it to "coolmusic.ogg" will not work. You'll need a program that can convert the file to a different format. (Even if this is obvious to you, I'm bringing it up because it has been a problem in the past! :P)
If you need to change the file's format, I recommend using Audacity.
Just open the music file in Audacity, go to File -> Export Audio, and select the WAV or Ogg option before saving.
Once your music is in the Audio folder, go to the top of your encounter script and look for this line:
-- music = "shine_on_you_crazy_diamond" --Always OGG or WAV. Extension is added automatically. Remove the first two lines for custom music.
Remove the two hyphens at the beginning and rename the music to the music in your Audio folder.
music = "coolmusic" --Always OGG or WAV. Extension is added automatically. Remove the first two lines for custom music.
Try to compare your file with any of the examples.
At the line 8, something wrong happened.
You might also want to look into reading an actual Lua tutorial, as it seems you're having trouble with basic problems.
This is our recommended Lua tutorial: http://lua-users.org/wiki/TutorialDirectory.
The "minimum knowledge" for using Unitale/CYF is covered in the sections "LuaTypesTutorial" through "ScopeTutorial" and you can use this to test code while you read: https://www.lua.org/demo.html.
It takes between an hour or two to get it down, it's really not much compared to other languages with way much more stuff to learn.
By default, there is a command, BattleDialog
, in the ACT command section. This command prints text to the bottom of the screen, and instantly takes you to a state called DIALOGRESULT, where you will see the text you entered.
Your code doesn't do this, it only sets currentdialogue
. You need to either use BattleDialog
to print text to the bottom of the screen as well, or use the State
command to instantly start the enemy's dialogue.
Now that the issue's out of the way:
Already knowing Lua is a requirement for using Unitale/CYF. It's simply impossible to code without it.
I advise for you to check out a tutorial if you can. Our recommend one is this one. If you choose this one, the bare minimum knowledge needed for Unitale/CYF is covered in the sections "LuaTypesTutorial" through "ScopeTutorial". It should only take an hour or two if you're focused, and you can use this to test code while you read.
Good luck, whatever you choose to do!
First, delete the end
on line 28. Then, add an end
on a new line after line 23.
Now, replace lines 38 through 48 with this code:
elseif command == "TALK" then talkcounter = talkcounter + 1 if talkcounter == 0 then BattleDialog {("You tried to talk.\nThe SOUL shivered.")} currentdialogue = ("Give up.") elseif talkcounter == 1 then BattleDialog {("You tried to talk.\nThe SOUL growled.")} currentdialogue = ("I'm tired...\n...of YOU.") end end
if
statement.Every single if
statement needs exactly one end
to close it. The same is true for every time you see function
or for
. Again, see the proper structure for if
statements in the link above.
Thanks! That solved my previous issue, but now when I act it still does the action (if the act is to change one of his stats, it does that), but nothing seems to happen (it just makes the select noise and I can still move the heart), it's still my turn. Check works fine, so that's how I progress- but then once it is the monster's turn, they say the dialogue triggered by the act, then they fight, and thEN the comments triggered by the act show up.
i wanna do a simple intro before the battle (already on the battle scenario)basically the character talks before he battle starts just like sans sayin its a beatiful day outside....) the code i used is here https://hastebin.com/emosipoboz.cs found it on a video i hope you can help me
>SetBubbleOffset
I tried and nothing worked
Im not sure if this is the right place but i put it in Encounter
the code is here
https://hastebin.com/yutofeyava.cs
For some reason, I didn't find the UI folder inside the Sprites folder in "Examples", so I went to look for the files in the Default folder and I found both. The problem is, I didn't understand the second part of what you meant. I didn't understand when you said I need to recognize the characters and replace them in currentdialogue. I opened the ^(monster.xml) file in my text editor and found this:
https://hastebin.com/ocotoliqoz.xml
I didn't find characters like á, ê, í, ô and ú ... Not even in ^(monster.png) I found them.
I noticed in monster.xml some parts where it was written ^(<sprite name = "unnamed_2015_rt">) Does that mean anything?
Thanks
Alright! The waves work now! However, two specific ACT commands cause the game to crash. I have two ACT commands that heal the party, and when I use them, it says that I tried to index a nil value, specifically the part where it lists the healing. Here's the code: https://hastebin.com/zemajuhupi.cpp Thank you for all your help so far!
Alright, I put the empty wave back in. It creates an attack with no visible border, and no bullets to dodge, or at least lose hp to. After that it gives me an error saying that in the encounter script on the 63rd line, which is just an end, at the 12-56 spaces, which are blank, that it is attempting to get the length of a nil value. It also mentions sandboxing, whatever that means. Here's the code: https://hastebin.com/motacalelo.makefile
sorry, here it is
https://hastebin.com/cahaxireyi.rb
aaaaaand about the
CreateSprite
command, the problem is in the
Function Update()
command, even though UNITALE doesn´t detect a problem in the command script, it just doesn´t work :c
First, I'll say that combining files like this will actually make it harder to help you. You see, the error messages give specific line numbers, and if you modify the files themselves, the line with the error will be somewhere else.
Second: The default encounter skeleton actually has issues, and it's possible that is what you are experiencing. Here is a version with its included errors fixed. You have only changed one line in your encounter file, so you may wish to just replace your encounter script with the one I linked, and start over.
Without meaning to, you've accidentally placed HandleSpare inside of DefenseEnding. Here is a better-spaced version of your encounter script to show you what is really going on.
Here is a short guide on Indenting, which is what I did to make your script look neater. It's not required, but it will greatly help you.
Learn Lua. If you have experience in other programming languages such as Java, Python, or, most of all, C/C++, great. Most programming languages have huge similarities, so if you're good with other languages, great. Learning Lua ought to be a breeze. If not, Lua is still pretty easy to pick up.
Also, I do need help myself. I'm still new to Unitale, and I can't figure out what is wrong with this script here. I wish the Unitale waves were all annotated. http://codepad.org/whtbECZT
I tried it, he speaks before attacking but after he attacks he says nothing and goes back to the action select menu. This is what I have:
Encounter.lua: http://codepad.org/gOP3ngQd
Speak.lua (That's how I named the first wave. Yeah, I know, original): http://codepad.org/MbtU3Lrc
And then ACTIONSELECT.lua that just has:
function Update() State("ACTIONSELECT") end
In the page I linked first in my previous reply:
> DON'T use regular Notepad. Recommended editors are <strong>Notepad++</strong> (not related to Notepad) and <strong>Sublime Text 3</strong>.
Down in the bottom, where it says function DefenseEnding all the way past encountertext = RandomEncounterText() to the next end is wrong, there shouldn't be a end right after DefenseEnding. It should read https://hastebin.com/isokowolow.lua
So, two things:
In your encounter file, there are a lot of inconsistencies with where you have placed your end
s. There are a few places where there should be end
s, but they are missing. You probably got the error for missing end
s, so you just put a bunch of them at the end of the file until the error stopped, right? Don't worry, just about everyone does that at first.
You have two of the same function EnteringState
. Because of this, the second one will override the first one. (The duplicate is on lines 84 to 88. Copy the code from it into the first function that starts on line 52.)
So, here's a version of your encounter file with these things fixed. Hopefully this will at least help with the problem (but then again, I'm not really sure what the problem is - saying "it doesn't work" is not enough information).
Yes. Most new users have Lua as their first ever coding language, so you're not alone. The link you sent is actually the last page in the recommended tutorial. You should read them in order, as it starts with the most basic things you need to know. And remember to use the other page linked in the page I sent last comment, which lets you run code in your browser very quickly and easily.
I'll get you started.
To choose something at random, use <code>math.random</code>. The easiest to understand formula to begin with would be something like math.random(1, 3)
. Store it to a variable if you like. But the point is, you check the number output of math.random with an if statement, and execute code based on it.
Judging by your code, you are using CYK. You already know how to heal players in CYK - that's also shown in the "Example" encounter. So, in the same way that you have Player.Heal
, you also have Player.Hurt
. But it takes arguments differently: see Hurt
and self
in "The Entity Object" in CYK's documentation.
The error tells you to go to line 37.
Looking at line 37, you just have a random table of some sort pasted here. Why? It's not being stored to a variable, no functions are being called on it...I assume you just tried to copy and paste or move some code, but this is a "leftover" you forgot to do anything with.
Listen, are you well versed with Lua? It's absolutely required to use this engine. I get the impression you need to brush up on it, so I'll just put the links here.
Here is our recommended Lua tutorial. If you choose to read it, the minimum knowledge required to make a mod is covered in the sections "LuaTypesTutorial" through "ScopeTutorial". If you're focused, it should only take a few hours to get down. You can also use this to test Lua code in your browser while you're learning.
The error tells you to look for an occurence of 'possible_attacks' that's incorrect.
Look at line 30:
function EnemyDialogueEnding() 'possible_attacks'.
It appears to move that you removed all of the comment that was here except for the end part talking about possible_attacks.
You also said you're a beginner with Lua. You must know a bare minimum of knowledge with Lua before you can use this engine.
Here is our recommended Lua tutorial. If you choose to read it, the minimum knowledge required to make a mod is covered in the sections "LuaTypesTutorial" through "ScopeTutorial". If you're focused, it should only take a few hours to get down. You can also use this to test Lua code in your browser while you're learning.
Heads up, you absolutely must know a bare minimum of knowledge in Lua before you can use this engine. Only then can I recommend you look at the documentation and examples and learn from them.
Here is our recommended Lua tutorial. If you choose to read it, the minimum knowledge required to make a mod is covered in the sections "LuaTypesTutorial" through "ScopeTutorial". If you're focused, it should only take a few hours to get down. You can also use this to test Lua code in your browser while you're learning.
In that case, some advice: You absolutely must know the basics of Lua before you can use this engine, there's no getting around it.
Here is our recommended Lua tutorial. If you choose to read it, the minimum knowledge required to make a mod is covered in the sections "LuaTypesTutorial" through "ScopeTutorial". If you're focused, it should only take a few hours to get down. You can also use this to test Lua code in your browser while you're learning.
Just need to ask, how much do you know about Lua? As far as I can tell, you don't seem to have enough knowledge to use the engine, I'm sorry. I can't recommend you continue until you know what's required.
Here is our recommended Lua tutorial. If you choose to read it, the minimum knowledge required to make a mod is covered in the sections "LuaTypesTutorial" through "ScopeTutorial". If you're focused, it should only take a few hours to get down. You can also use this to test Lua code in your browser while you're learning.
Here is our recommended Lua tutorial. If you choose to read it, the minimum knowledge required to make a mod is covered in the sections "LuaTypesTutorial" through "ScopeTutorial". If you're focused, it should only take a few hours to get down. You can also use this to test Lua code in your browser while you're learning.
Set the enemy's defense to a very high number, and all attacks will always miss.
If you say you're Lua, then I have to stop you before you get really deep into your mod, sorry.
Here is our recommended Lua tutorial. If you choose to read it, the minimum knowledge required to make a mod is covered in the sections "LuaTypesTutorial" through "ScopeTutorial". If you're focused, it should only take a few hours to get down. You can also use this to test Lua code in your browser while you're learning.
Hi! First of all, you do have to know Lua, it is a prerequisite. Here is a link to our recommended Lua tutorial. If you choose to read it, please read from "LuaTypesTutorial" to "ScopeTutorial". If you stay focused, it should only take an hour or two. You can also practice Lua here while you read, if you want.
Once you're done with that, I would say to read the documentation's Game Events and Sprites & Animation sections. You would also need the sprites you want to use, but before anything, you'll need Lua knowledge. I wish you well!
Absolutely. The for loop is a very powerful tool when used correctly.
Here's a Lua tutorial on it as well.
And beginners, check out the wave Mods/Examples/Lua/Waves/bullettest_bouncy
for a good example of a for loop in action.
That works, thanks! DOES THIS NOW!
Now how would I check if the other half is hit?
Wave Script:
spawntimer = 0 Player.sprite.Set('splitsoul_l') Player.sprite.color = {0.7, 0.7, 0.7} soulright = CreateProjectile('splitsoul_r',Player.x+16,Player.y) soulright.sprite.color = {0.7, 0.7, 0.7} soulright.SetVar("canHit",false) xdifference = 0
chasingbullet = CreateProjectile('bullet', Arena.width/2, Arena.height/2) chasingbullet.SetVar('xspeed', 0) chasingbullet.SetVar('yspeed', 0) chasingbullet.SetVar('canHit', true)
function Update() spawntimer = spawntimer + 1
if Input.Confirm > 0 and not (Input.Cancel > 0) then xdifference = xdifference + 2 elseif Input.Cancel > 0 and not (Input.Confirm > 0) then if xdifference > 8 then xdifference = xdifference - 2 else xdifference = xdifference end end
if soulright.x < Arena.width/2 - 8 then soulright.MoveTo((Player.x + xdifference),Player.y) else xdifference = xdifference - 5 soulright.MoveTo((Player.x + xdifference),Player.y) end
local xdifference = Player.x - chasingbullet.x local ydifference = Player.y - chasingbullet.y local xspeed = chasingbullet.GetVar('xspeed') / 2 + xdifference / 100 local yspeed = chasingbullet.GetVar('yspeed') / 2 + ydifference / 100 chasingbullet.Move(xspeed, yspeed) chasingbullet.SetVar('xspeed', xspeed) chasingbullet.SetVar('yspeed', yspeed) chasingbullet.sprite.rotation = (xdifference + ydifference)*2 end
function OnHit(bullet) if bullet.GetVar("canHit",true) then Player.Hurt(1,0) else end end
Don't really know why spawntimer is there but still...