Jump to content

Capture-type maps or the like.


Recommended Posts

 

Hello everyone, I would like to ask for help, I am creating some maps in which the victory would depend on the capture and maintenance of the capture (10 min for example) of structures initially in Gaia's possession. On the map, for example, there can be 5 locations with each of these structures (for now called flags) whoever conquers at least 4 of these structures the countdown begins, to win you must remain with these conquered structures. The map does not allow the construction of new cc and each player will only have the initial one. Most of the idea is easy for me, but I have no idea how to create the part of the script that creates the winning condition (number of flags won, regressive time to win at the end). If someone is interested in creating this part or knowing a map that has done something similar that can inspire me is of great help.

(google translate, sorry  p)

Link to post
Share on other sites

Hmm.. I didn't experiment much with this but if possible I'd think this would be done on a triggers script.

Check out:

- https://github.com/0ad/0ad/blob/master/binaries/data/mods/public/maps/random/jebel_barkal_triggers.js

- https://github.com/0ad/0ad/blob/b364a8cc7f41fe305e8b436651f1ee59afa3a1e1/binaries/data/mods/public/maps/scripts/TriggerHelper.js

In particular the functions which return entities, check owner for an entity and the OnOwnerShipChange callback. Since gaia should not own structures by default (depending on map) it should be easier to just check all gaia's structures (player with id 0).

There could be a better way, but you could check this every x seconds or set an array with all the conquerable entity ids or on ownershipchange hook check if all were taken by the same player.

As I said, I'm not familiar with this so someone else might know more.

Edited by badosu
  • Like 1
Link to post
Share on other sites

An even better example is the "survival of the fittest" map.

You should indeed be listening to the onOwnershipChanged messages. First find some way to filter the 5 entities (probably give them some identity class) and onOwnershipChanged you should be able to do the required checks.

Another option is to look at CaptureTheRelic.js victory condition and do the same trick there (you probably can reuse that code, just need to change a class)

  • Like 1
Link to post
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.

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...