Author Topic: Side-projects  (Read 8249 times)

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« on: May 03, 2011, 08:40:15 PM »
This mission is supposed to be a LoS on Colony Games.  You versus the AI.

This post is for: 2P - ColonyLoS - Arena Of Fire
Update 1: Finished your player colony on easy.  Next will be, all the beacons, the ai colony, ai triggers, and disasters.  All for the easy difficulty.

Update 2: Put the map in the zip.

Update 3: AI has it's own mine and can rebuild every building except the Command Center and Structure Factory.  I'll soon be trying to get it to rebuild units.
« Last Edit: November 18, 2011, 12:50:54 PM by subbed74 »

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #1 on: May 04, 2011, 04:17:14 PM »
Forgot to mention that there's a small easter egg/spoiler in this if you can find it.

Offline Flashy

  • Sr. Member
  • ****
  • Posts: 391
Side-projects
« Reply #2 on: May 05, 2011, 07:03:00 AM »
It says "Could not initialize game". And where is that "aof.map" from? I don't recognise it. And another little thing, why is it marked as colony game?
Praise the mighty light towers!!!

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #3 on: May 05, 2011, 02:13:55 PM »
I forgot to include the map so sorry about that.  It's a colony game cause it's LoS against an AI. Not a player.  I'll re-upload the file with aof.map

Offline evecolonycamander

  • Hero Member
  • *****
  • Posts: 602
Side-projects
« Reply #4 on: May 05, 2011, 03:56:31 PM »
the aof map is mine. right now however it looks like crap cause it was for a live tortorial for newbies to learn on. sadly, it is no where near completion cause of many reasons
''The blight cant get us up here!''
-famous last words
--------------o0o--------------
Outpost 2: EoM project status: Re-planning

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #5 on: May 06, 2011, 08:20:05 PM »
Map added to zip.

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #6 on: November 13, 2011, 04:24:08 PM »
Tada! I've lost the code.  I'll be rebuilding the mission and posting it soon.

EDIT:  I've found the code on one of my old topics. YAY
« Last Edit: November 13, 2011, 09:14:29 PM by subbed74 »

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #7 on: November 14, 2011, 10:24:59 PM »
I set my enemy miner to build a common ore mine using this code:
Code: [Select]
Unit ecommonoreminer;
SCRIPT_API void CommonOreMine() {
ecommonoreminer.DoBuild(mapCommonOreMine, LOCATION(120+32, 47-1));
}

I have a trigger to call ecommonoreminer and the miner moves.  But it won't build the mine.  Could someone tell me what's wrong?

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Side-projects
« Reply #8 on: November 15, 2011, 02:22:42 AM »
You should probably avoid using global variables (variables declared outside the scope of a function). If you need access to the variable in another part of the script, then it would probably be wise to move the Unit declaration in the ScriptGlobal struct (or whatever the struct is called that gets setup in GetSaveRegions). If you're not using it elsewhere, then just move the Unit declaration into the function.


I believe DoBuild doesn't work with mines. At least not properly. I vaguely remember you can use build coordinates with an offset, like where ConVecs move when building a structure, but this was a bit glitchy. I think the proper way to build a mine, is to record the mine in a building group, and give the building group enough units to go and build the mine itself. I'm pretty sure someone else has posted something about this. You can probably find something useful on the forum if you do a search and wade through some of the results.
 
« Last Edit: November 15, 2011, 02:24:40 AM by Hooman »

Offline Hidiot

  • Hero Member
  • *****
  • Posts: 1018
Side-projects
« Reply #9 on: November 15, 2011, 02:13:51 PM »
Yes, if you use DoBuild, the coordinates need to be offset by +1, +1.
"Nothing from nowhere, I'm no one at all"

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #10 on: November 15, 2011, 05:18:07 PM »
Interesting offset.  It worked. Thanks.

So I should use groups though instead of trying to do what I'm doing now?
« Last Edit: November 15, 2011, 05:23:57 PM by subbed74 »

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #11 on: November 15, 2011, 10:10:25 PM »
I got groups going, but I also have a few problems.

My mining group stops mining after a while.  I don't mean because the ai has run out of space the trucks will start going back to the mine and just sit there.

I killed 2 of it's Convecs and it should have rebuilt 2 more.

Could someone help me?  If I need to, I'll post the source.

Offline Hidiot

  • Hero Member
  • *****
  • Posts: 1018
Side-projects
« Reply #12 on: November 15, 2011, 10:30:08 PM »
That kind of situation requires code. Can't help otherwise, unless you're really good at describing how your code works.
"Nothing from nowhere, I'm no one at all"

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Side-projects
« Reply #13 on: November 15, 2011, 11:44:46 PM »
When ore storage reaches capacity, trucks in a mining group will stop and sit idle in the group's specified rect. People usually define this rect to be around their smelter, which is the most logical place for trucks to sit idle when there is no storage room left for them to unload.

If you update the rest of your AI to build or replace things, you'll probably see the trucks start again when the AI consumes some metal.
 

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #14 on: November 16, 2011, 06:27:31 AM »
Well I set an if statement to give me 10000 ore if the ai has 9000 and it didn't work.
« Last Edit: November 17, 2011, 09:02:53 PM by subbed74 »

Offline Hidiot

  • Hero Member
  • *****
  • Posts: 1018
Side-projects
« Reply #15 on: November 16, 2011, 03:56:42 PM »
Excuse me while I laugh, but your if statement is:
Code: [Select]
if (Player[1].Ore() == 9000)
Think of how often you get exact numbers for your metals stored in OP2...

You want to use a greater or equal, not an equals for such a check.
Code: [Select]
if (Player[1].Ore() >= 9000)
« Last Edit: November 16, 2011, 03:57:08 PM by Hidiot »
"Nothing from nowhere, I'm no one at all"

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #16 on: November 16, 2011, 04:02:50 PM »
Wow that was stupid of me! :P no comment......

I'll try that.

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #17 on: November 16, 2011, 04:17:22 PM »
I changed the ore to what you said.  I still didn't 10000 ore when the ai got over 9000.  So I think it's glitching or something.

EDIT: I forgot about AIProc so I'm going to try that.
« Last Edit: November 16, 2011, 04:25:40 PM by subbed74 »

Offline Hidiot

  • Hero Member
  • *****
  • Posts: 1018
Side-projects
« Reply #18 on: November 16, 2011, 06:34:50 PM »
Oh, yeah... I was too distracted by the if statement to mention the InitProc only running once, at mission start-up.
« Last Edit: November 16, 2011, 06:35:00 PM by Hidiot »
"Nothing from nowhere, I'm no one at all"

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #19 on: November 16, 2011, 07:57:03 PM »
I actually set a different way for the mining to go.  What I was trying to didn't work so I set 2 smelters and 2 mining groups.  I'm getting ready to set up the building group for all of the structures.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Side-projects
« Reply #20 on: November 16, 2011, 11:46:01 PM »
lol, you two.  :P

Funny, but my first thought when reading subbed's reply was he used an exact value comparison, and then when I saw the code below it and started scrolling, I started thinking he probably put it in InitProc. I kind of laughed when I saw both. And then laughed harder when Hidiot pointed out he laughed, which initially had me thinking he'd spotted the InitProc placement, but then turned out he'd spotted the exact value comparison. Then my brain felt like it was in a strange knot, just returned from a parallel thought universe. A strange, but amusing experience.  :)

Glad to see you two got it sorted.
 

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Side-projects
« Reply #21 on: November 17, 2011, 11:14:12 AM »
Quote
Code: [Select]
if (Player[1].Ore() >= 9000)


You really should have seen this coming.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #22 on: November 17, 2011, 02:52:09 PM »
Acctually I didn't.  But still.. LOL

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #23 on: November 17, 2011, 08:24:41 PM »
I updated and uploaded a new zip.  If you've downloaded it before you may have 2 arena of fire missions.  I forgot about my old mission so yeah..  Just delete the c2LCAOF.dll file.

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Side-projects
« Reply #24 on: November 18, 2011, 04:06:43 PM »
I've noticed that the CommonOreMine won't rebuild.  I'll be getting that fixed in Update 4 when the colony has the ability to reproduce the starting vecs.