ResearchNotOwned?

Talk about your new mod or map here

Moderators: jelco, bert_the_turtle

User avatar
00Davo
level2
level2
Posts: 84
Joined: Mon Sep 22, 2008 12:52 pm

ResearchNotOwned?

Postby 00Davo » Mon Sep 29, 2008 12:30 am

Is there a way to tell if the player DOESN'T own a certain piece of research? I know that ResearchOwned can check if they DO have it. I've got two separate events, which will trigger under the same conditions, except that one checks if Armour is owned. How can I make sure the other one will only trigger if Armour is NOT owned? Help!
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Mon Sep 29, 2008 1:05 am

I'm pretty sure that there is no ResearchNotOwned command. However, there are a few things that you can try. First off, there is a BuildingNotOnline command (as I recall). Thus, if you grant the armour research in a script that is activated when a particular building comes online, you can check the status of that building, and use that as a proxy for whether or not armour is granted. If you give armour to the player via a research cube, you can put a SafeArea around the research cube, and set it to go online when an engineer goes into it. This is not perfect, as the engineer could die before getting the research, but it might work well enough (then when checking if the player has armour, you can check the status of that building).

xander
User avatar
00Davo
level2
level2
Posts: 84
Joined: Mon Sep 22, 2008 12:52 pm

Postby 00Davo » Mon Sep 29, 2008 1:39 am

The armour is gained in a different level, specifically via a Yard setup. The Construction Yard goes online when activated, right? If so, that's just what I needed. Thanks. :)
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Mon Sep 29, 2008 2:09 am

00Davo wrote:The armour is gained in a different level, specifically via a Yard setup. The Construction Yard goes online when activated, right? If so, that's just what I needed. Thanks. :)

It should be noted that armour is not automatically granted when the Yard comes online. If you look at the original game files, you will note that armour is not granted until several buildings in Yard come online. The exact line in game.txt is as follows:

Code: Select all

    Event BuildingOnline:yard,4 BuildingOnline:yard,3 BuildingOnline:yard,1 BuildingOnline:yard,110 BuildingOnline:yard,101
        Action RunScript yard_armour.txt
        End

Buildings 4 and 101 are SafeAreas, while buildings 1, 3, and 110 are Trunkports. When all five buildings are online, then the script yard_armour.txt is run. Note that none of these buildings is the Yard. In fact, if I recall properly, the Yard never comes "oneline." Instead, it becomes "active," and starts pumping out armour.

So, two things: (1) If you are granting armour, you need to do so with either a script, or with a research cube. Nothing else will work. (2) You should be able to check whether a building is offline or online, but you should tie granting of armour to the status of a single building. As an example of why this is, consider the above case. There are five buildings that must be online in order for armour to be granted. Say that you have one script that needs to run if armour is available, and another if not. There are 2^5=32 possible combinations of online/offline status for those five buildings. In order to correctly determine if a player does or does not have armour, you would need to check every one of those combinations.

The fact is that Darwinia has very poor flow control. It is nearly impossible to create a proper if...then statement in the Darwinia modding system. Your best bet is to make it as simple as possible, and hope that no one finds the problems that you will have to leave behind.

If you can be more specific about what it is that you are trying to do, I might be able to be more helpful.

xander
User avatar
00Davo
level2
level2
Posts: 84
Joined: Mon Sep 22, 2008 12:52 pm

Postby 00Davo » Mon Sep 29, 2008 2:58 am

What I'm trying to do:
I've got a few levels set up. One of them has three trunkports. However, one of the trunkports is defended heavily by Soul Destroyers. At this point, it should be pretty much impossible to kill them. (No Armour, no rockets) The other two trunkports lead to levels much like mine and generator, which then lead to a yard-like level. Once the player has armour production up, they can return to the other level and get past the Soul Destroyers.

Of course, a player may manage to avoid the SDs without getting the armour, and somehow escort enough Darwinians past them to the port. I've made the next level only properly accessible if they have armour, using the ResearchOwned command in the completion event. If the player manages it without getting the armour, I want a message explaining this, so that they'll know why the next level isn't opening.

Hmm. I just had an idea. What if I add ResearchOwned:armour to the objectives for the level? It would provide a hint, and also prevent the big Objectives Complete from coming up when they aren't.
User avatar
The GoldFish
level5
level5
Posts: 3961
Joined: Fri Mar 01, 2002 9:01 pm
Location: Bowl / South UK
Contact:

Postby The GoldFish » Mon Sep 29, 2008 3:53 am

I'm fairly sure that you can exploit the order of events in game.txt to setmission the next map to (with no armour research) a map which informs the player of the issue of not being able to progress (you could put the start camera out in the middle of nowhere in that map which will probably pretty much put anyone off bothering to try and do stuff with the level). Then following this, an event that does need the armour research, which sets the mission on the map to be the correct mission, allowing progres.

However, a simpler option would be to put an armour safe area on your map where the player may or may not use armour to get DGs past soul destroyers, and just compare with that building's online/offline status.
User avatar
00Davo
level2
level2
Posts: 84
Joined: Mon Sep 22, 2008 12:52 pm

Postby 00Davo » Mon Sep 29, 2008 3:56 am

The main problem was that players wouldn't know that they needed Armour to pass that point. Simply adding armour to the mission objectives did the trick. Thanks all!

Return to “Mod Projects”

Who is online

Users browsing this forum: No registered users and 7 guests