The hardest part in converting the fields is getting the field scripts to work. Having slight trouble with the elevator scene because I do not know how to get the cloud model that has the elevator slam button animation working. Any help would be appreciated
Scripts exporting is a bit tricky because you need a bit of manual work to do it. In existed field files I already rename a lot of things to increase readability.
1) Scripts exported to text file (md1_1_script.txt)
There you will find raw script to lua conversion. Most of implemented functions ready to use when they converted. Others need to be reworked.
2) You need to cteate entity layout manually.
EntityContainer = {}
EntityContainer[ "entity_name_goes_here" ] = {
}
After export you get original entity name. They are abbreviated and may be different in different fields though they represent same model. That's why I renamed them.
cl
script_0:
became
EntityContainer[ "Cloud" ] = {
3) First script ("script_0:")
In ffvii first script has two parts: initial and normal.
cl
script_0:
0441 (end 0441): -- assosiate entity with model (CHAR) argument doesn't matter
0443 (end 0443): set_entity_to_character( "cl", 0 );
0445 (end 0445): return
0446 (end 0446): cl:set_move_speed( 1.875 )
044a (end 044a): jumpto( 044a );
Everything before first return is initial script.
In qgears this is "on_start" script.
We need to initialize model for entity in qgears
set_entity_to_character( "Cloud", "Cloud" )
self.cloud = entity_manager:get_entity( "Cloud" )
In ffvii this is done with PC opcode wich translates to
0441 (end 0441): -- assosiate entity with model (CHAR) argument doesn't matter
0443 (end 0443): set_entity_to_character( "cl", 0 );
set_entity_to_character is located in output\data\scripts\ffvii\field.lua
set_entity_to_character = function( entity_name, character_name )
if character_name == FFVII.Party[ 1 ] and entity_name ~= "" then
if System.MapChanger.point_name ~= "" then
local point = entity_manager:get_entity_point( System.MapChanger.point_name )
if point ~= nil then
local x, y, z = point:get_position()
local rotation = point:get_rotation()
local player = entity_manager:get_entity( entity_name )
player:set_position( x, y, z )
player:set_rotation( rotation )
player:set_solid( true )
player:set_visible( true )
end
end
entity_manager:set_player_entity( entity_name )
end
end
It do basicly tha same thing that PC opcode do.
Next is self.cloud = entity_manager:get_entity( "Cloud" )
This finds entity with name Cloud which described in XML file and store referensce to it in local variable to get access to it.
That\s all for now. Try to look at exported script and existed script files to understand how it works. I can add more later.