Author Topic: Turrets Won't Fire, And A Thought.  (Read 6356 times)

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3237
Turrets Won't Fire, And A Thought.
« Reply #25 on: August 29, 2008, 12:38:34 PM »
Quote
I hear muffled laughter as I'm adding this reply...
CODE:
SCRIPT_API void Blight ()
{
    GameMap::SetVirusUL(LOCATION(64-31,10-1),-1);
    TethysGame::SetMicrobeSpreadSpeed(10);
}

OR

SCRIPT_API void Blight ()
{
    GameMap::SetVirusUL(LOCATION(64-31,10-1),0);
    TethysGame::SetMicrobeSpreadSpeed(10);
}

It's declared like this (note the lack of annotation, the purpose of the int for example.)
static void __fastcall SetVirusUL(struct LOCATION where, int);
*                      So what did I do wrong?
You're setting the initial spread speed as -1 (first example) and 0 (second example).
Try this:

SCRIPT_API void Blight()
{
    GameMap::SetVirusUL(LOCATION(95, 9), 10);
    TethysGame::SetMicrobeSpreadSpeed(10);
}

Also, it's (x+31, y-1), not (x-31, y-1).

Edit: And speed 10 is much too slow. Try something with 3 digits.
« Last Edit: August 29, 2008, 12:39:25 PM by Sirbomber »
"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

Fire Plague

  • Guest
Turrets Won't Fire, And A Thought.
« Reply #26 on: September 13, 2008, 11:15:24 AM »
except for these triggers Im finnally done. Dose anyone know why these keep firing as fast as they can get processed, when they should fire when the buildings they count equal 0, but fires when they still exist?

CODE:

CreateTimeTrigger(1,0,150,150,"laborday");


SCRIPT_API void laborday()
{
    labordayTest();
}

AND:

int playerLOCnum = TethysGame::LocalPlayer();
void labordayTest ()
{
    Trigger &noAgriTrigger = CreateCountTrigger(1, 1, playerLOCnum, mapAgridome, (map_id)0, 0, cmpEqual,"NoResponseToTrigger");
    Trigger &noStructFacTrigger = CreateCountTrigger(1, 1, playerLOCnum, mapStructureFactory, (map_id)0, 0, cmpEqual,"NoResponseToTrigger");
    Trigger &noConVecWithSFTrigger = CreateCountTrigger(1, 1, playerLOCnum, mapConVec, mapStructureFactory, 0, cmpEqual,"NoResponseToTrigger");
    Trigger &noConvecWithAGTrigger = CreateCountTrigger(1, 1, playerLOCnum, mapConVec, mapAgridome, 0, cmpEqual, "NoResponseToTrigger");
    Trigger &starvEnding = CreateSetTrigger( 1, 1, 4, 4, "LaborDayPlayer", noConVecWithSFTrigger, noConvecWithAGTrigger, noStructFacTrigger, noAgriTrigger);
}


WITH THIS:

SCRIPT_API void LaborDayPlayer ()
{
Unit x;
//    Player[playerLOCnum].SetWorkers(1);
//    Player[playerLOCnum].SetScientists(0);
    TethysGame::CreateUnit(x,mapLynx,LOCATION(60+31,5-1), playerLOCnum, mapRPG, 2);
}

They are driving me nuts ( this is only one of four ways tried, but the code creates units every 150 ticks and proves it's working backwards)
« Last Edit: September 13, 2008, 11:23:31 AM by Fire Plague »

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3237
Turrets Won't Fire, And A Thought.
« Reply #27 on: September 13, 2008, 12:25:11 PM »
I don't know what (map_id)0 is or why you're using it, but try using mapAny.  If that doesn't work, try mapNone.
"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 Hidiot

  • Hero Member
  • *****
  • Posts: 1018
Turrets Won't Fire, And A Thought.
« Reply #28 on: September 13, 2008, 01:37:58 PM »
(map_id)0 is mapNone.

From just these bits of code I can't tell what the problem is.
"Nothing from nowhere, I'm no one at all"

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3237
Turrets Won't Fire, And A Thought.
« Reply #29 on: September 13, 2008, 02:06:47 PM »
Ah.  Then try mapAny.  That's how my CountTrigger work, anyway (unless I'm looking for a specific cargo).
"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

Fire Plague

  • Guest
Turrets Won't Fire, And A Thought.
« Reply #30 on: September 13, 2008, 02:54:31 PM »
I'm confused, you want it to read like this??
CODE:
Trigger &noAgriTrigger = CreateCountTrigger(1, 1, playerLOCnum, mapAgridome, mapAny, 0, cmpEqual,"NoResponseToTrigger");

The order is:

The time trigger fires the set of triggers every 150 ticks. They in turn test to see if there are agdomes and Sructure Factories in convecs and on the map for the "LocalPlayer()"  If there isn't then it's suposed to fire.

Offline Hidiot

  • Hero Member
  • *****
  • Posts: 1018
Turrets Won't Fire, And A Thought.
« Reply #31 on: September 13, 2008, 03:34:44 PM »
If you have it in AI Proc, then I suspect it'll create more triggers than it should. Adding a check of your own to the firing of those trigger might have a chance to help.
« Last Edit: September 13, 2008, 03:34:51 PM by Hidiot »
"Nothing from nowhere, I'm no one at all"

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4954
Turrets Won't Fire, And A Thought.
« Reply #32 on: September 13, 2008, 05:06:08 PM »
Umm, this is a really bad trigger setup for a multiplayer map. It won't run the same on each computer, and would cause them all to desync. I mainly say this because you're using:
Code: [Select]
int playerLOCnum = TethysGame::LocalPlayer();
which you don't really need to use in a single player game.


Also, you're creating an unbounded number of triggers, and not destroying them when you're done with them, which means you'll run out of triggers and cause the game to crash. Everytime the time trigger fires you'll use up 10 ScStubs, and you can only have a max of 255 of them. Provided you're not using (m)any other triggers, you'll have at most 26 rounds before it crashes. At 150 tick intervals, that works out to a max run time of 3900 ticks, or 39 marks. That's not exactly a very long game.


Actually, come to think of it, why bother with the time trigger at all? This would work, and faster, if you just setup the other triggers globally. It'd be much less comlicated and error prone.


As for why it doesn't work the way you expect, I'm not really sure.


Oh, and to complicate things a little further for you, what about convecs with kits stored in garages?  ;)
 

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3237
Turrets Won't Fire, And A Thought.
« Reply #33 on: September 14, 2008, 04:45:15 PM »
Quote
Oh, and to complicate things a little further for you, what about convecs with kits stored in garages?  ;)
Then this happens.
"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