Author Topic: Vortex Settings  (Read 3595 times)

Fire Plague

  • Guest
Vortex Settings
« on: September 08, 2011, 09:11:56 AM »
static void __fastcall SetTornado(int tileX, int tileY, int duration, int, int, int boolNoIdea);

     I've been playing around with the settings on vortexes and I noticed a pattern. the unlabeled int,int seems to be the lower right x,y coordinate to create a "kill box" for the tornado. the unknown bool has locked the screen so that once I look at the vortex it will not move to another part of the map if the bool is true. Play with these settings and verify them if you wish, I'm pretty curtain of them though. If we do know what they are then the SDK should be re-written slightly to note there function.
 

Offline Flashy

  • Sr. Member
  • ****
  • Posts: 391
Vortex Settings
« Reply #1 on: September 08, 2011, 11:08:35 AM »
Sirbomber mentioned this in his tutorial:
Code: [Select]
TethysGame::SetTornado(originX, originY, Duration, destX, destY, No Delay);  // Vortex
Though when I tested the bool, it was indeed a no-delay switch but didn't disable moving
Praise the mighty light towers!!!

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Vortex Settings
« Reply #2 on: September 08, 2011, 09:51:59 PM »
I just checked the most recent version of the SDK (now hosted in a Git repository) and it reads:
Code: [Select]
	static void __fastcall SetTornado(int startTileX, int startTileY, int duration, int endTileX, int endTileY, int bImmediate);

Perhaps you're using an older package? I just poked around on the site, but I didn't see any links to the SDK. Is this something you downloaded recently?
 

Offline Savant_Ace

  • Full Member
  • ***
  • Posts: 102
    • http://www.spitfire-sa.com/
Vortex Settings
« Reply #3 on: September 14, 2011, 08:18:59 PM »
Well I've not been able to get the TethysGame::SetTornado Function to work at all. I downloaded the SDK from the AmIMeYet Tutorial on getting the Visual C++ 2008 Express Functioning with it.

I tried to follow the Tutorial:

"
"
// Vortexes (Vortices?)
SCRIPT_API void Vortex()
{
TethysGame::SetTornado( TethysGame::GetRand(128)+31, TethysGame::GetRand(128)-1, TethysGame::GetRand(20)+10, TethysGame::GetRand(128)+31, TethysGame::GetRand(128)-1 );
}
"

However, when I attempted to build the OP2Script with those settings, it kicked back an error saying:

1>.\Main.cpp(459) : error C2660: 'TethysGame::SetTornado' : function does not take 5 arguments

Not being a total incompetent, I looked into the problem a little further. Apparently the game expects 6 defined variables in the function: All of the aforementioned ones and one more: "int boolNoIdea". I tried setting this to both 1 and 0, and both times the OP2Script build came through successfully, but when I attempted to execute the script in Outpost 2, It stops before the game starts and gives me the error:

"Couldn't resolve data reference Quakes in mission script"

The game still starts and seems to function normally after that, with the exception of there being no vortexes.

Can you possibly tell me what I'm doing wrong here?
 

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Vortex Settings
« Reply #4 on: September 15, 2011, 12:47:24 AM »
Your problem (as in that error message) is unrelated to the posted code.

What you appear to be lacking is a "SCRIPT_API void Quakes()" function, which you've referenced elsewhere, but then failed to define. I assume you created a trigger and passed it the string "Quakes"?


Also, you'll need your "Vortex" function to be called for it to do anything such as actually create a vortex. Normally you do this by referencing it as a trigger callback function. Time triggers are usually used for disaster callback functions.
« Last Edit: September 15, 2011, 12:47:55 AM by Hooman »

Fire Plague

  • Guest
Vortex Settings
« Reply #5 on: September 24, 2011, 09:38:30 AM »
after quite some searching it's probably the one I was using before. I could have sworn I downloaded it agian off this site prior to starting again this time. I was only trying to help.  B)

The problem that I have right now is getting the computer to *move* the lynx that I created for a computer player.   .DoMove() is not being anheared to and I've not gone through the entire "class" of SirBombers. (probably being the oldest person on here will do that.)

If anyone cares, my son has something to say too.

 (thumbsdown)  :find:  :heh:  :whistle:  :blush:  

Offline Savant_Ace

  • Full Member
  • ***
  • Posts: 102
    • http://www.spitfire-sa.com/
Vortex Settings
« Reply #6 on: September 24, 2011, 06:23:33 PM »
There is no refrence to quakes anywhere in my script. Which is why I am so confused about the problem. I've tested it extensively. When I get the error, it only manifests when attempting to create the Vortex. I already have a time trigger set up to call the Vortex. This is what is actually in my code:

   if(TethysGame::CanHaveDisasters() == 1)
{

   CreateTimeTrigger(1, 0, 4500, 7000, "Vortexes");

}


//Code resumes

//After SCRIPT_API void NoResponseToTrigger()

SCRIPT_API void Vortexes()
{
   TethysGame::SetTornado( TethysGame::GetRand(10)+231, TethysGame::GetRand(10)-1, TethysGame::GetRand(20)+10, TethysGame::GetRand(10)+131, TethysGame::GetRand(130)-1, 1 );
}

//END


The final variable (1) is not defined anywhere in the tutorial and when it is not present generates the build error, but when is present generates the quakes error.

Fire Plague

  • Guest
Vortex Settings
« Reply #7 on: September 24, 2011, 07:24:35 PM »
Perhaps I'm taking this in the wrong direction, but your code is in funtion the same that worked with my map. I noticed that the first X co-ordinate:

TethysGame::GetRand(10)+231

has a rather high value. What is the maximum size of your map? if it's less than 210 that may be the problem. Also the last Y co-ordinate:

TethysGame::GetRand(130)-1

could evaluate improperly. GetRand spits out 0 and then it subtracts one. giving -1 as the value. That shouldn't process out everytime but it would realy screw up your day without warning sooner or later. Good luck.

Offline Savant_Ace

  • Full Member
  • ***
  • Posts: 102
    • http://www.spitfire-sa.com/
Vortex Settings
« Reply #8 on: September 24, 2011, 10:28:33 PM »
The map I'm working with is 256x256. I only want the vortexes to occur in certian areas of it. I appreciate the insight, I should definately take care of the offset problem.

Fire Plague

  • Guest
Vortex Settings
« Reply #9 on: September 27, 2011, 01:28:38 PM »
Back to the SDK and my lacking the up-to-date version. I tried to get it from here and that was a stern lesson in futility. Geting it from "git" had no donload button the several angles I tried to look it up. So, I'm not wasting any more time and asking how to get the up-to-date SDK. I'm hoping it has the bufdesc saving code SirBomber talked about saving games in colony. I've ran three different checks in the entire solution in visual studio and it will not bring up the definition he said to modify, although it's call is there.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Vortex Settings
« Reply #10 on: September 27, 2011, 11:26:45 PM »
You need a Git client to download from a Git repository. You can try something like Tortoise Git.

As for saving games, you'll want to search for the data type (the struct name), not the variable name of a struct instance. The struct is declared in the SDK. The variable instance will only be in the level project.

The BufferDesc struct is found in RequiredExports.h:
Code: [Select]
// This struct defined a memory region to be Saved/Loaded to/from saved game files. 
// Note: See GetSaveRegions exported function
// Note: This implies all level data must be statically declared. Avoid using "new".
struct BufferDesc
{
void *bufferStart; // pointer to beginning of DLL data buffer
int length;   // length of this buffer
};

As you can see it's fairly simple. It's pretty much what an Array struct would be in many languages. It points to the start of some area of memory, and indicates it's length. Here the length is in bytes.



I don't recall any specifics on Unit.DoMove. I don't think the AI's really used it though. It think they mostly did unit control using unit groups.



Savant_Ace, make sure you're actually testing the level you're compiling. When you're getting errors messages that reference non-sensical things that don't exist in the source at all, it's often an indication that the binary you are testing was not produced by the source code you're looking at. In particular, check file last-modification dates/times.