Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12706) Events framework
Home

[Freeciv-Dev] (PR#12706) Events framework

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12706) Events framework
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 2 Apr 2005 05:23:15 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12706 >

I have typed up a suggestion for doing the events ruleset as general
effects and general requirements in
http://www.freeciv.org/index.php/Events (see bottom of article).

Comments? Feel free to add to the page.

I reproduce it here in any case for the wikiphobiacs:

Make events just a case of general effects. (For easy identification,
global effects and events effects should be put in effects.ruleset, while
other effects should be put in the other rulesets.)

Add new requirement "Event" with value which is one of "Hut", "City_Taken"
and so on. Once one of these actions happen, look through all effects with
this requirement and see if we should trigger it.

We need one additional specific requirements that cannot yet be handled by
gen req, and I suggest adding it directly to the effects definition, since
it makes no sense for other stuff:

req_random_range - Before running events, generate a random number between
0 and 100. If this random number is between the range specified, then the
requirement is satisfied.

We also need new section types to deal with cities and units, and two new
effects to refer to them. The units and cities sections have fields
identical to the fields with the same name in the savegame, except you can
omit any field, and also an extra role parameter for units and extra
options for the "id" field: "new" for new unit id and "self" which is
whatever unit or city triggered the event. The defaults may be specific to
the event.

An example of each:

 ; whenever a hut is entered, entering player gets a unit at the hut
 ; location
 [effect_hut_0]
 name = "Units"
 value = "units_0"
 reqs   =
 { "type", "name"
   "Event", "Hut"
 }

 [units_0]
 units = { "id", "veteran", "type_from_role"
           "new", 0,        "Hut"
 }

 ; whenever a hut is entered, entering player gets a city at the hut
 ; location (if possible)
 [effect_hut_1]
 name = "Cities"
 value = "cities_0"
 reqs   =
 { "type", "name"
   "Event", "Hut"
 }

 [cities_0]
 cities = { "id", "size"
            "new", 1
 }

Another complicated example, not involving cities or units:

 ; 20% chance that a player who pops a hut will get 50 gold, a random tech
 ; and the Wheel tech, if the player entering the hut has researched
 ; Industrialization and has not built Michelangelo's.
 ; This can only happen once in the entire game.

 [effect_hut_2]
 req_random_range = 0, 20 ; 20% chance
 name = "Gold"
 value = 50
 reqs   =
 { "type", "name"
   "Tech", "Industrialization"
   "Event", "Hut"
 }
 nreqs  =
 { "type", "name", "range"
   "Building", "Michelangelo's Chapel", "Player"
   "Variable", "var_hut_1", "World"
 }

 [effect_hut_3]
 req_random_range = 0, 20 ; 20% chance
 name = "Give_Imm_Tech"
 value = 1
 reqs   =
 { "type", "name"
   "Tech", "Industrialization"
   "Event", "Hut"
 }
 nreqs  =
 { "type", "name", "range"
   "Building", "Michelangelo's Chapel", "Player"
   "Variable", "var_hut_1", "World"
 }

 [effect_hut_4]
 req_random_range = 0, 20 ; 20% chance
 name = "Give_Imm_Tech"
 value = "The Wheel"
 reqs   =
 { "type", "name"
   "Tech", "Industrialization"
   "Event", "Hut"
 }
 nreqs  =
 { "type", "name", "range"
   "Building", "Michelangelo's Chapel", "Player"
   "Variable", "var_hut_1", "World"
 }

 ; finally set the bool variable var_hut_1 for this player
 [effect_hut_5]
 req_random_range = 0, 20 ; 20% chance
 name = "Variable"
 value = "var_hut_1"
 reqs   =
 { "type", "name"
   "Tech", "Industrialization"
   "Event", "Hut"
 }
 nreqs  =
 { "type", "name", "range"
   "Building", "Michelangelo's Chapel", "Player"
 }

  - Per





[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12706) Events framework, Per I. Mathisen <=