Guide to event modding in BtS

That's right, yeah. bPickPlayer is another player - if you're human, it picks an AI. But OtherPlayerHasTech merely creates the possibility the event might happen. It won't trigger automatically when the other player gets that tech.

I got it to trigger but, either bPickPlayer is switched on (1) and the event affects the other player (which isn't what I wanted), or bPickPlayer is switched off (0), and the OtherPlayerHasTech is completely ignored. I guess this is one situation where I'm going to need Python to get what I want.
 
two questions:

When an event is non-reoccuring, it means, only for the player civ? or only once per game...(meaning every civ can trigger it once?)

if you have it set to reoccuring, but then use the cancel-funtion on the event, will you lose the changes given by the event...and will it be triggered again when the conditions are met? such as you build a Special-Trade unit, which will improve food, & kill the unit, the next time you build the Special-Trade unit, it will give food again?
 
Normally, everything is done per-player. But if you set the bGlobal tag to 1, it will be for everyone. But usually, a non-recurring event means once per game per civ.

If you use the "cancel function", it only makes the game forget the event has happened, nothing else. It does not undo the effects. For a non-recurring event, yes, if you "cancel" it, it can occur again later. But if you make your event a recurring one, there'd be no need to cancel it if you want it triggered again later.
 
Thank you solver, you are the patron saint of know-how.

What I wanted to do (since my python skills suck..i mean sucksucksucksuck) was do 2 things. One create the "temple of Zues" idea (units from a building ever x turns) but the code that was given didn't see to work for me (copied verbatim, and finnlly just wholesale-replaced things with the code, nothing seemed to work)

and a refugee idea, of unit killed on creation that gives + pop and+unhappiness to a city which is why I asked if you cancled things out, it could happen again later.
 
All in all thanks solver for this very nice post.
Event creation works fine and everything looks good. But i have one problem with additional events. Everytime i create one it will be displayed in another "main" event of this event. Not in the right one...
 
The answer is in the question...- its the adjective name for the city, using basic grammer rules.
It corresponds to, for example, "the English city of London has been hit by a hurricane".

%s1 is used in the third person- ie used in the broadcast summaries of events that other civs see.
%s2 is used when the event is "talking" to you specifically. Using the example above, it would be used to say, to you, "London has been hit by a hurricane".


HDK
I also am having trouble with the placeholders. What I want is to display the adjective of the enemy civ (for the example below, "Chinese") in the description of the event option. When I use %s1civ_adjective I get what you can see in the attached file. Other numbers yield even worse results. Is it even possible to do what I want?
 

Attachments

  • HelenofTroy.JPG
    HelenofTroy.JPG
    39.7 KB · Views: 230
Someone wanted to know how to do a global plague, now I do not know the specific code but I was thinking something like this:

if city is connect to tigger city
get a random number 1 .. 10
if random number is greater than five
then city has plague
loop to next city
end

Like I said, I don't know python, but the logic should work.
 
I have a (slightly off-topic) question about the events system: what is the Python command to write a statement to the event log? Not a debugging log, mind you, but the log that appears on the main interface at the top. I need this because I want to use it outside of the events system, hence I can't simply use the existing event tag that displays a global message.
 
I also am having trouble with the placeholders. What I want is to display the adjective of the enemy civ (for the example below, "Chinese") in the description of the event option. When I use %s1civ_adjective I get what you can see in the attached file. Other numbers yield even worse results. Is it even possible to do what I want?

That's a cool idea for an event! Would you mind if I used it in a mod someday?
 
Okay, I'm new to civ IV moding, but I'm starting to like it. Right now I want a specific event (option) to have a chance to lead to another event trigger (that has multiple events (options) itself) Any tips?
You mean like the "Danthrax event" example on the first page, or something different?
 
I have a problem. For my Star Trek mod, I set up an event that causes a star to go supernova. It's supposed to clear the solar system, kill any cities on it, and and put the supernova feature in its place. It does this, but when I end the turn the supernova is removed and the solar system is put back in its place! What can I do to fix this?
 
I have another problem. I attempted to add an event that will trigger on a plot owned by the player with no features that will add the supernova feature onto said plot. However, it seems to require something, because when I attempt to test it in the console it won't trigger. What could such an event require? Could someone respond to this and my above post? And could someone explain to me why whenever I attempt to add an event it requires hours of troubleshooting?
 
Deanej and all: I have your beta version and I've been adding events by myself and the same idea occured to me (along with economical collapses, comet colisions with planets, and unit disapearences). If anyone has the anwser (to nova event) I too would like to know.

Also: I have figured out something else to solve my previous problem; thanks Dryhad
 
I have a problem with another event. I want it to trigger only if the player knows a certain tech, and when triggered, I want it to spawn a barbarian unit. However, when I added the python code, I get a zillion errors when I attempt to trigger it in the console. It takes issue with checking for the tech as well as a bunch of things with adding the units (the unit adding stolen from the barbarian uprising events and modified).

Code:
def canTriggerQ(argsList):
    kTriggeredData = argsList[0]

    player = gc.getPlayer(kTriggeredData.ePlayer)
    pTeam = player.getTeam()
    iTech = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_ISOLINEAR_CHIPS')

    if gc.getTeam(player.getTeam()).isHasTech(iTech):
       return true
    else:
        return false

def doQ1(argsList):
    iEvent = argsList[0]
    kTriggeredData = argsList[1]

    player = gc.getPlayer(kTriggerdData.ePlayer)

    listPlots = []
    map = gc.getMap()
    for i in range(map.numPlots()):
        plot = map.plotByIndex(i)
        if(plot.getOwner == player and not plot.isImpassable() and plot.area().getCitiesPerPlayer(player) > 0):
            listPlots.append(i)

    if 0 == len(listPlots):
        return

    iUnit = CvUtil.findInfoTypeNum(gc.getUnitInfo(),gc.getNumUnitInfos(),'UNIT_ALIEN')
    barbPlayer = gc.getPlayer(gc.getBARBARIAN_PLAYER())

    barbPlayer.initUnit(iUnit, plot.getX(), plot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH)

EDIT: I managed to get it to check for the tech OK and fixed the errors, but the unit is still not put on the map! What on Earth am I doing wrong?:confused:
 
Top Bottom