• Welcome to SC4 Devotion Forum Archives.
 

News:

The SC4 Devotion Forums are no longer active, but remain online in an archived, read-only "museum" state.  It is not possible for regular members to post or use the private messaging system, and no technical support will be provided for any issues pertaining to the forums in their current state.  Attachments (those that still work) are accessible without login.

The LEX has been replaced with SC4Evermore (SC4E), and SC4E maintains an active Discord server.  For traditional forums, we recommend Simtropolis.

Main Menu

Automata generator: Planes on taxiways

Started by xannepan, May 22, 2013, 12:12:16 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xannepan

Hello again! I am working on a generator for planes on taxiways. The idea for now is to use roads/streets as taxiway network. As long as the taxiway road stays isolated from any other lots/buildings I assume no other traffic will appear on them.

Based on other generator examples (the eurotraffic generator and the ingame ambulance lua script) I have created a LUA script, a plane automata and a generator lot (see attachement).

Unfortunately, there is a bug somewhere... If I use it in the game, no planes are generated, and I have noticed all other generators (e.g. eurotraffic) stop working.  :'(
There may be a problem with the script, but perhaps also in the use of occupantgroup IDs. At this moment I don't have a clue...

Please help  ::)


Here is the script (also attached)

--#-package:e8f83fb6# -- package signature --

dofile("_templates.lua")
dofile("vehicles.lua")
dofile("pedestrians.lua")

automata_group.plane_taxiway = --TTT
{
   _parent = automata_group.vehicle,
   group_id = "0x8A00",
   source_building = "0x8000",     

}


-- create a generator that creates ambulance trucks at the edge of the lot.
generator.plane_taxiway_generator =
{
      automata = { "plane_taxiway" },                  -- create ambulance trucks
      count = 29,
      rate = 29,                              -- ...X times per...
      rate_scale = RateScale.PER_HOUR,   -- ...game minute
      max_count= 99,
      radius = { 2,14 },
      follow_roads = true,

   behavior = {               -- behavior is always expressed as a table of tables, since there can be more than 1
         {   
            state = BehaviorState.DEFAULT,
            timeout = 9999,
            final=true;

         },
   },
   follow_road = true,
   destroy_automata = false,
}
---------------------------------------------------------------------------------------
-- Finally, create a "school" occupant group with attached attractor & generator

occupant_group.plane_taxiway_maker =   ---- this is the building group name
{
    group_id = "0x8000",         -- this should be a GUID defined in ingred.ini's "occupant groups" value map - building group number
   controllers = {
      "plane_taxiway_generator",              -- DO NOT change this string without also changing cSC4Vehicle.cpp!
      },
}

-- keep this as the last line and uncomment it to check your work
--~ verify_all_templates()







xannepan

Argghhh.. Why is it that always 5 minutes after the post you find the solution yourself... Problem solved. The scripts are okay. Somehow the IID I used for the LUA script didn't work. Why that is, is still a puzzle to me though... but it works...

Still suggestions on where to improve are welcome!

ACEfanatic02

It may be somewhat off-topic, but thanks for (indirectly) alerting me to the fact you can *actually see* the game's Lua code in Reader.  Seems odd to me that it wasn't all compiled down prior to ship.
日本語勉強中-最近読んだ本はこちらで見えます。
Python Enthusiast

noahclem

Can we have  the picture back please?  :P

Looked very promising as a thumbnail but had been removed by the time I tried to open it. Anyway, outstanding work as always  &apls

xannepan

#4
Don't worry ACEfanatic02. LUA scripts are included in SimCity_1.dat. Via LUA it is possible to do some simple coding without affecting the actual game source code.
Noah: for now no new picture.. I want to see if I can come back with some teasers a bit later in the process of completing this.... Anyway pictures are no good in showing taxiing and flying planes.