Jump to content

Trigger Lesson


akuenzi

Recommended Posts

Wow – I sure didn't intend to upset anyone by starting this thread. My apologies, too, for asking a simple question improperly. Then again, it wasn’t exactly a ‘simple’ question to my brain, so I’m grateful for the ideas shared here. But I will take a look at my posts again to see if my request can be better stated. I’m not making any promises, though – I’m not sure my English is any better than my trigger skills in RRT2.  So, I'm right there with  you outofmage, though your English is vastly superior to my Mandarin, which is nonexistent.  :)

Loco_motive, thanks for the additional ideas. I was just thrilled when it finally worked in my map, though as you (and Jeff) pointed out, it's not the best way to accomplish it. This Board is my classroom.

Link to comment
Share on other sites

Jeff,  I admit 4 events are little too much. But in post #16, I have a better version which can compact into 2 events. 

 

 

Yes, if the human player happens to be #2 player, it will give the human player cash. I try to solve this problem with...

 

Ah, now we are converging. Compacting to 2 events gets you almost to my red solution on page 1. To affect only computer players, you can simply check the box, so no extra machinations are needed.

 

Finally, by running an annual event, it can boost a different computer player each year (with a second event clearing the variable used).

 

Additional theory moving to new thread...

Link to comment
Share on other sites

Jeff, I want to clear more about my intention of my post in #16. This method is to actually replace the function of player Id, not only to answer akuenzi's question from the first post. 

I agree that your method in post #11 works for this scenario, solve Ak's problem. However, to find a more universal answer, extra mechanic is needed. What if we have no idea how much cash this player has, and we still want to apply some effects on to a pre-defined player anyway? For example, as we talked about before, we want to assign a territory to a defined player. Although it is impossible due to the basic mechanic of the game, this is actually some map creators trying to accomplish, so I think my method can be used here.

 

What map creator used to do is to add restrict to the map forbidding company creation and assign each human player's company and AI's companies to their own territories. This means if you want to assign territory, you will have to force player to stick with one company, otherwise you can't take full control of each player's territory access. This reduces the flexibility of map design. 

 

With the PlayerControlledCompanyId trigger and the replacement of playerId technique, we can assign territory to a company created by pre-defined player every time, which means assign territory access to a player. Although we are already able to take full control of human's territory access by checking against only human player, but we can in practice also restrict each AI with its own territory even if we destroy or merge his company through the example I will present below.  Thus we increase map design flexibility.

 

Here is what I designed, and this has been tested.

The task is to assign #2 player #6 territory full access every time he creates a company. As usual, it takes one GV and one PV.

 

event #1

test against all players

check every time a company is created

trigger:

GameVariable1<2 and PlayerVariable1=0

effect:

set PlayerVariable1 100

Add GameVariable1 +1 

-----------------------------

event #2

test against all players

test against all companies

test against territory id=6

check every time a company is created

trigger:

GameVariable1=2 and PlayerVariable1=0 and PlayerControlledCompanyId=CompanyId

effect:

set PlayerVariable1 100

add GameVariable1 +1

territory allow all: do it

-----------------------------

event #3

test against all players

check every time a company is created

trigger:

true

effect:

set PlayerVariable1 1

add PlayerVariable1 -1

set GameVariable1 1

add GameVariable1 -1

 

This method can be used at least in Mad King map and Free four all map.

 

P.S. Akuenzi, I can feel my English skill has improved as I hang around more on this forum. It's been a fun time.

Link to comment
Share on other sites

I want to clear more about my intention of my post in #16. This method is to actually replace the function of player Id...

 

Ah, in that case, since your solution uses player var #1 anyway, it would be more elegant to start the game with an event that counts players while setting each player's P1 to the count at his position.

 

Single-player example of player initialization event:

For all players

Single-player mode only

Trigger: P1 = 0

Every year at start

Text [empty]

Effects:

Add to G1: (+1)

Set P1 to G1

 

After that, (and a test-run to see which player ends up with which number), any and all events wanting to refer to a specific AI-player can test against his number. Not only does this save us from having to chew through all of the players three times for each event, but it liberates GameVariable1 from being used in every such triplet.

 

BTW, this is one of those events where one can "borrow" a territory variable to use as a game variable. Just select the territories box, put a static territory ID in for its number, and then you can use TerritoryVariable4 (or whichever) instead of GameVariable1 to do your counting. After the initialization runs, the borrowed variable will be left holding the max ID (player count), which could become useful for coding around a variable number of AI players.

 

It's possible to write for Multiplayer yet still include human players, but I think it would take two events in order to give the AI-players known numbers before an unknown number of humans get theirs.

Link to comment
Share on other sites

Jeff, that's a very good idea, to do it one time for all. But I doubt there might be a bug in it. The first player's PV1 could be set as 0 before GV1 add 1. However, since this event is triggered every year, the first player's PV1 will be override as 4 (assuming there are 4 players in total) in second year. Adding an event to initialize PV1 as -1 and change the trigger to PV1<0 should fix this bug. In the other case, if GV1 add 1 before setting PV1 to 1 instead of 0, which means PV1 is the true value of playerId, there won't be this bug. 

 

Hopefully all we have done here can help other map creators to full fill their design purpose later.

 

Edit:

I also notice that what you have done is similar to what loco has done in his 'PlayerId in events' thread in post #2

Link to comment
Share on other sites

Jeff, that's a very good idea, to do it one time for all. But I doubt there might be a bug in it. The first player's PV1 could be set as 0 before GV1 add 1.

I'm pretty sure that effects are executed in the order in which effects are listed in the editor (top to bottom). Vars are set in Game - Company - Player - Territory order, with Sets coming before Adds, so no bug.

 

Edit:

I also notice that what you have done is similar to what loco has done in his 'PlayerId in events' thread in post #2

Agreed, I think locomotive is on the right track.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...