You're not boring me at all.
Okay, so let's make an event called "BlahBlahBlah".
1. You'll need a PNG picture measured 414 x 348 (width x heigth) pixels. No other format than PNG will do!
2. Name this picture: event_BlahBlahBlah.png
3. Put the picture into folder: data/graphics/hud/events (where all the other event graphics are)
4. Open english.txt in folder: data/lang
5. In vanilla CTGW the event texts start at about line 800, you will have to define the event headline and the event text here.
6. every event needs a headline, the headline needs a certain syntax: event_???_title = ??? In our example the syntax would be:
event_BLAHBLAHBLAH_title = THIS IS MY FIRST EVENT TITLE!
7. every event needs a text, the text needs a certain syntax: event_???_descr = ??? In our example the syntax can be:
event_BLAHBLAHBLAH_descr = This is my first event text!
8. be VERY VERY cautious to get the syntax right or the game will not load anymore and crash without a proper error report!
9. especially if you insert a lot of new stuff into english.txt be sure to backup the file beforehand!
10. okay, now open game_events.lua and cut out the script part from where it is
11. instead insert a new event function call
at the place where the script was before
The event function must have the same name like the event picture and the event reference in english.txt
In our case the function call would be titled:
BlahBlahBlah()
12. Now
scroll down to where all the other event function are and define the function using your script fragment
13. to define your function, type:
Code: Select all
function BlahBlahBlah()
local italy = game:GetFactionById(8)
local spain = game:GetFactionById(15)
if GetEvent("BlahBlahBlah") == 0
and italy.alliance.id == 2 then
ChangeFactionAlignment(game:GetFactionById(15), spain.alliance, math.random(35,45))
SetEvent("BlahBlahBlah", game.turn)
end
end
Notice that SetEvent now ends with game.turn and not with -1.
This means the game will now execute the display of the event picture and store the gameturn when the event happened.
Hope this helps.