Page 6 of 6
Re: Useful scripts repository
Posted: Sun Nov 25, 2012 8:18 am
by Isaac
ExpDevourer wrote:Where and what do you use to edit the scripts? Do you go to the games files, under the lets say *textures* and open the file using Notepad or something? Or is there more to it then that, the explanations here seem fairly simple, but how do you open up the script itself to be modified. Sorry I am very new to scripting, I took maybe a week of schooling for it one time years ago, but I couldn't tell you how I went about it at the time.
Notepad is good; there are a few other apps that are just as good or better. You don't want to use a word processor though; just a basic text editor that doesn't add format codes to the text.
Tip: Don't save the file as [the default] .txt, unless you plan to rename them before use. Notepad allows you to save with a custom file extension (in this case .lua); select the "All Files" 'format' and write the complete file name and extension yourself.
Re: Useful scripts repository
Posted: Mon Nov 26, 2012 1:36 am
by ExpDevourer
Isaac wrote:ExpDevourer wrote:Where and what do you use to edit the scripts? Do you go to the games files, under the lets say *textures* and open the file using Notepad or something? Or is there more to it then that, the explanations here seem fairly simple, but how do you open up the script itself to be modified. Sorry I am very new to scripting, I took maybe a week of schooling for it one time years ago, but I couldn't tell you how I went about it at the time.
Notepad is good; there are a few other apps that are just as good or better. You don't want to use a word processor though; just a basic text editor that doesn't add format codes to the text.
Tip: Don't save the file as [the default] .txt, unless you plan to rename them before use. Notepad allows you to save with a custom file extension (in this case .lua); select the "All Files" 'format' and write the complete file name and extension yourself.
So notepad works then? Good good, I use it quite a bit, so I am very familiar with it. Save as lua or something else then? Ok, where do you paste the scripts you have made to get them to activate correctly, lets say changing wallset wall color, or adding an animation, monsters, interactive object etc.
P.S. Nice Beholder
Reminds me of the old Eye of the Beholder game I used to pull my hair out on.
Re: General scripting issues and questions
Posted: Wed Dec 05, 2012 8:05 pm
by Caelik
Hi guys, scripting newbie here with a quick question. Is there a way to heal party members when they level up? I've been searching around and I did find a command onLevelUp(Champion) but when I try to use it I get a nil value. I've tried setting local values for champions but nothing I try seems to work. Any help would be greatly appreciated.
Re: Useful scripts repository
Posted: Wed Dec 05, 2012 8:14 pm
by Isaac
ExpDevourer wrote:P.S. Nice Beholder
Reminds me of the old Eye of the Beholder game I used to pull my hair out on.
It's one in the same; that is the game sprite from Eye of the Beholder.
Caelik wrote:Hi guys, scripting newbie here with a quick question. Is there a way to heal party members when they level up? I've been searching around and I did find a command onLevelUp(Champion) but when I try to use it I get a nil value. I've tried setting local values for champions but nothing I try seems to work. Any help would be greatly appreciated.
The script for that is party:getChampion(x):levelUp()
Where 'x' is the ordinal of the champion; (1-4).
Make a new project and add a pressure plate, and connect it to a lua object.
Paste the following into the Lua object:
Code: Select all
function lvlUp()
for x = 1,4 do
party:getChampion(x):levelUp()
end
end
Preview it. When you step on the plate all party members should level up.
Re: General scripting issues and questions
Posted: Wed Dec 05, 2012 8:45 pm
by ExpDevourer
Thought that looked familiar
. Also my original question in this thread is no longer valid, I figured all that out, still pulling my hair on other things, but I have the basic concept down now.
Re: Useful scripts repository
Posted: Wed Dec 05, 2012 9:04 pm
by montagneyaya
Isaac wrote:Caelik wrote:Hi guys, scripting newbie here with a quick question. Is there a way to heal party members when they level up? I've been searching around and I did find a command onLevelUp(Champion) but when I try to use it I get a nil value. I've tried setting local values for champions but nothing I try seems to work. Any help would be greatly appreciated.
The script for that is party:getChampion(x):levelUp()
Where 'x' is the ordinal of the champion; (1-4).
Make a new project and add a pressure plate, and connect it to a lua object.
Paste the following into the Lua object:
Code: Select all
function lvlUp()
for x = 1,4 do
party:getChampion(x):levelUp()
end
end
Preview it. When you step on the plate all party members should level up.
Your script is for level up all champion, he will healing a champion on level up (with the hook onLevelUp)
Re: General scripting issues and questions
Posted: Wed Dec 05, 2012 9:33 pm
by montagneyaya
For healing a champion on level up, add in your mod_asset/scripts/object.lua
Code: Select all
defineObject{
name = "party",
class = "Party",
onLevelUp = function (champion)
champion:modifyStat("health", 99999)
end,
editorIcon = 32,
}
Re: General scripting issues and questions
Posted: Wed Dec 05, 2012 11:02 pm
by Caelik
Thank you all for the quick responses. That did the job, thank you! I obviously have much to learn lol.
Re: Useful scripts repository
Posted: Thu Dec 06, 2012 8:49 am
by Isaac
montagneyaya wrote:Your script is for level up all champion, he will healing a champion on level up (with the hook onLevelUp)
Yeah; my script was just demonstrating use of the champion:levelUp(). He had mentioned getting nil from it when he used it.
*Nice script btw.
Re: General scripting issues and questions
Posted: Sat Feb 16, 2013 12:27 pm
by Komag
JKos wrote:Hi and thanks for releasing the beta
I will start with a simple question.
Why doesn't this work? is it a bug or just me?
damageTile(1, dungeon_door_iron_1.x, dungeon_door_iron_1.y, 1, 1, "physical", 2)
it gives following error: attempt to index a nil value. But only if there is a monster on that tile.
full script:
function crushEast()
if (dungeon_door_iron_1:isOpen()) then
dungeon_door_iron_1:close()
damageTile(1, dungeon_door_iron_1.x, dungeon_door_iron_1.y, 1, 1, "physical", 2)
else
dungeon_door_iron_1:open()
end
end
I'm getting this exact bug still, crash to editor with "attempt to index a nil value" if the damage type is "physical" and there is a monster in the square. Was this supposedly fixed ever, or did it slip through the cracks?
It seems pretty important for "physical" damage to be an option for something like this, as I want to have damage without any FX (lightning or fire), without the monster dying with frozen pieces (cold), and without any monster being immune (poison)
(PS the scripting reference still lists "poison" twice and omits "shock")