~Basic Scripting and Editor Help(Easy Scripting Updated!)
Posted: Sat Oct 18, 2014 6:31 am
Basic Scripting
Easy methods:
I noticed that the coding seemed to be pretty complicated so I decided to turn it into an easy scripting!
From What I know I've come up with this. Go to your Dungeon in dungeon editor and copy paste this into a new script_entity:
then name it game.
Here are some new methods:
Disable Enable Party:
Champion gain exp
Get Champion Enabled:
Get champion:
Sets Xp Gain(Currently Disabled do to lack of scripting knowledge in LOG2):
Easily Set Up the outdoors levels: (Half working, you still have to place down a forest_heightmap):
Add items to an alcove or possibly something else:
Editor Help
Hidden Pressure Plate
floor_trigger
How to make forests, and beaches
Forests
To make a forest shift + left click or right click with forest floor 1 to place down that tile all over the dungeon easily,
Then find the entity forest_day_sky and place it any were on the dungeon doesn't matter where, and find the forest_hightmap and place it
any were as well doesn't matter were again. and your done! To add forest walls just place down the forest_wall tile!
Beaches
To make a beach shift + left click or right click with the beach floor to place down that tile all over the dungeon easily,
Then find the entity forest_day_sky and place it any were on the dungeon doesn't matter where, and find the forest_hightmap and place it
any were as well doesn't matter were again. Then find the beach_ocean entity and place it down somewhere in the map and your pretty much done! (Warning the beach_ocean goes really far but will not cover the whole map unless you make it be at the complete left of the dungeon and make it face west!)
Beach_Oceans only go were ever there facing so if its facing south it will only be south. Another thing about oceans is they take up the entire map of south/north/east/west from the entity start point.
Example:
Lets say you made a beach_ocean at the middle of the map and it was facing south then the ocean would cover half the map on the south side.
Water
To make simple water just add water, well its not that simple what you really do is place your water tiles were you want them to be, then browse your assets for swamp_water or water_surface or water_surface_unerground and in saying that your pretty much done.
Terrain Height
To change the terrain height all you do is go to the little tab called Layerwhen your editing tiles,and change it to height map and that will only be there if you've added the forest
height map, then change the height to whatever and click on a tile then reload/start your dungeon and you'll see that tile is higher or lower.
Handling Tiles
Handling tiles can be a little confusing at times or the first time you open the editor, To use tiles correct they're actually pretty simple, simple select a tile out of your many tiles and if your using forest or beach or anything special look back up at how to make beaches and forests they'll help you a lot, but basically you select your tile and and you see you have the little choosing thing don't touch that it might be a little confusing but I don't think you'd really want to touch it anyway , what the LMB and RMB mean are Left Mouse Button and Right Mouse Button so if you left click on a tile in the tile browser you set the Left Mouse Button to that tile if you right click on a tile in the browser you set the Right Mouse Button to that tile.
Now the Floor and Ceil Floor Will mean how high or low the floor is Ceil will mean how high or low the ceiling will be. And so you simply place your tiles after setting your tile settings at the top and your done!
Non-consumable key?
More Info Coming soon when more is found out!
Want to see a little dungeon I'm working on that has lots of examples?
Download: https://dl.dropboxusercontent.com/u/278 ... 20hand.zip
This dungeon has some things that currently don't work such as bosses, and damaging entities!
Video Tutorials: (By Skuggasveinn)
Skuggasveinn:
Have anything I missed or don't know post it as a comment!
Easy methods:
I noticed that the coding seemed to be pretty complicated so I decided to turn it into an easy scripting!
From What I know I've come up with this. Go to your Dungeon in dungeon editor and copy paste this into a new script_entity:
Code: Select all
-- Easy Commands:
-- Version: 0.2
--
-- Easy commands is a complicated proccess of code turned into easier commands but probly less control, it also makes
-- commands shorter and less bunchy. To use easy commands follow the instructions below!
--
--
-- Instructions:
--
-- Simply name this script_entity to game and make sure all of this script is copy pasted into that script_entity,
-- thats it!
--
--
-- Commands:
--
-- Enable/disabled Champions: game.script.champEnabled(champion, bool)
--
-- Get if a champion is enabled/disabled: game.script.getEnabled(champion)
--
-- Get Champion: game.script.champ(champion)
--
-- Give exp to a champion: game.script.gainExp(champion, amount)
--
-- Easily set up the outdoors dungeon area: game.script.setUpOutDoors(level) (Currently bugged you will have to place a forest_heightmap
--
-- DISABLED::::Set the Xp gain for the champions: game.script.setXpGain(percentage) (In the percentage there is no need for a % sign)
--
-- Add Item to an alcove or possibly something else: game.script.addItem(entity, item)
playing = true
fighting = false
function champEnabled(champion, bool)
-- This bit of coding is checking to see what the player set the method parematers to because for champions to enable disabled
-- You can't simply say return party.part:getChampion(champion):setEnabled(bool) it won't work that way :D.
if champion == 1 then
if bool == false then
return party.party:getChampion(1):setEnabled(false)
end
if bool == true then
return party.party:getChampion(1):setEnabled(true)
end
end
if champion == 2 then
if bool == false then
return party.party:getChampion(2):setEnabled(false)
end
if bool == true then
return party.party:getChampion(2):setEnabled(true)
end
end
if champion == 3 then
if bool == false then
return party.party:getChampion(3):setEnabled(false)
end
if bool == true then
return party.party:getChampion(3):setEnabled(true)
end
end
if champion == 4 then
if bool == false then
return party.party:getChampion(4):setEnabled(false)
end
if bool == true then
return party.party:getChampion(4):setEnabled(true)
end
end
end
function gainExp(champion, amount)
return party.party:getChampion(champion):gainExp(amount)
end
function champ(champion)
return party.party:getChampion(champion)
end
function getEnabled(champion)
return party.party:getChampion(champion):getEnabled()
end
function setUpOutDoors(level)
return spawn("forest_day_sky",level,1,0,0,0,"forest_day_sky_1") and spawn("forest_heightmap",level,2,0,0,0,"forest_heightmap")
end
function setXpGain(percent)
-- This checks to see if the party is dead
while party.party.getHealth() == 0 do
playing = false
end
-- This is just making sure that the party is still alive
while playing == true do
playing = true
end
-- This checks to see what percentage was put and then sets the gain Xp
if percent == 10 then
-- This makes sure the player is still alive
while playing == true do
-- Sets the Xp Gain
end
end
end
function addItem(entity, item)
return entity.surface:addItem(item)
end
Here are some new methods:
Disable Enable Party:
Code: Select all
game.script.champEnabled(champion, bool)
Code: Select all
game.script.gainExp(champion, amount)
Code: Select all
game.script.getEnabled(champion)
Code: Select all
game.script.champ(champion)
Code: Select all
game.script.setXpGain(percentage)
--In the percentage there is no need for a % sign
Code: Select all
game.script.setUpOutDoors(level)
Code: Select all
game.script.addItem(entity, item)
Hidden Pressure Plate
floor_trigger
How to make forests, and beaches
Forests
To make a forest shift + left click or right click with forest floor 1 to place down that tile all over the dungeon easily,
Then find the entity forest_day_sky and place it any were on the dungeon doesn't matter where, and find the forest_hightmap and place it
any were as well doesn't matter were again. and your done! To add forest walls just place down the forest_wall tile!
Beaches
To make a beach shift + left click or right click with the beach floor to place down that tile all over the dungeon easily,
Then find the entity forest_day_sky and place it any were on the dungeon doesn't matter where, and find the forest_hightmap and place it
any were as well doesn't matter were again. Then find the beach_ocean entity and place it down somewhere in the map and your pretty much done! (Warning the beach_ocean goes really far but will not cover the whole map unless you make it be at the complete left of the dungeon and make it face west!)
Beach_Oceans only go were ever there facing so if its facing south it will only be south. Another thing about oceans is they take up the entire map of south/north/east/west from the entity start point.
Example:
Lets say you made a beach_ocean at the middle of the map and it was facing south then the ocean would cover half the map on the south side.
Water
To make simple water just add water, well its not that simple what you really do is place your water tiles were you want them to be, then browse your assets for swamp_water or water_surface or water_surface_unerground and in saying that your pretty much done.
Terrain Height
To change the terrain height all you do is go to the little tab called Layerwhen your editing tiles,and change it to height map and that will only be there if you've added the forest
height map, then change the height to whatever and click on a tile then reload/start your dungeon and you'll see that tile is higher or lower.
Handling Tiles
Handling tiles can be a little confusing at times or the first time you open the editor, To use tiles correct they're actually pretty simple, simple select a tile out of your many tiles and if your using forest or beach or anything special look back up at how to make beaches and forests they'll help you a lot, but basically you select your tile and and you see you have the little choosing thing don't touch that it might be a little confusing but I don't think you'd really want to touch it anyway , what the LMB and RMB mean are Left Mouse Button and Right Mouse Button so if you left click on a tile in the tile browser you set the Left Mouse Button to that tile if you right click on a tile in the browser you set the Right Mouse Button to that tile.
Now the Floor and Ceil Floor Will mean how high or low the floor is Ceil will mean how high or low the ceiling will be. And so you simply place your tiles after setting your tile settings at the top and your done!
Non-consumable key?
SpoilerShow
Skuggasveinn:
master_key (but spoiler tag since its a major item in the end game of LoG2)
But it is also is able to open up every lock there is, so ones the party has it, finding a key will never be an issue.
Its not until AH releases the scripting reference that we can see if we can clone the master_key and change it so that it only opens locks that it has been assigned to and still remain with the party.
More Info Coming soon when more is found out!
Want to see a little dungeon I'm working on that has lots of examples?
Download: https://dl.dropboxusercontent.com/u/278 ... 20hand.zip
This dungeon has some things that currently don't work such as bosses, and damaging entities!
Video Tutorials: (By Skuggasveinn)
Skuggasveinn:
I've created some tutorials for the new Dungeon Editor
Please note that I'm just learning this stuff myself, and I've not seen the lua code behind the assets so I reserve the right to be complete wrong about what I'm talking about
Part 1 - http://youtu.be/vMMBC9B2qjM GUI and new features
Part 2 - http://youtu.be/eDaeqUUOuSc Elevations inside dungeons
Part 3 - http://youtu.be/6cv3P8dxCgY Coordinates and level transition
Part 4 - http://youtu.be/hVpY60Ptjdk Creating Water and Reflections
Part 5 - http://youtu.be/bLwSL8mhJOk Outdoor scenario
Playlist link https://www.youtube.com/playlist?list=P ... B7joLG52Nc
Hope that this will help someone get started.
Maybe I will add to these in the future.
Skuggasveinn.
Have anything I missed or don't know post it as a comment!