|
| Author |
Message |
|
bman654 Lietunant

Joined: 09 May 2007 Posts: 451
|
Posted: Sun Jun 03, 2007 5:37 am Post subject: |
|
|
| Moriarty wrote:
Thanks.
Associative arrays versus regular indexed arrays.
|
I assumed you didn't know what an assoc. array is. Map is a common name for them.
| Moriarty wrote:
Makes you wonder why the items listing object seems to be a vector then. That thing gets looped through thousands of times a game - very silly. |
Which items listing object? If you actually need to loop through all items to "do stuff to each item" a whole bunch, a vector will be quicker than a map. Maps are great for random access from string keys or random access to a sparse array (ie you might have an index that is 10000000 and another index that is 1 but you don't actually have 10000000 entries in the array). But maps are slow compared to vectors if you need to iterate through every entry.
|
|
|
| Back to top |
|
|
AlienHunter Private

Joined: 08 May 2007 Posts: 18
|
Posted: Sun Jun 03, 2007 12:35 pm Post subject: |
|
|
Since someone must have already been working with adding new weapons, could you summarize me where to start (i.e. what files to change)?
I got really annoyed with the inquisitors and I want to add a simple FIRE EXTINGUISHER I could use directly the properties and tactical game graphics/animations of the chemical gun, I just need to change it to put down fires instead of damage and add 2D graphics of fire extinguisher. It would be buyable all the time, no need to research (d'oh!).
I hate that fires screw up my tactics and kill my men, high-tec soldier should be also able to fight fires damn it 
|
|
|
| Back to top |
|
|
Nightfreak Corporal first class

Joined: 27 May 2007 Posts: 71 Location: Berlin
|
Posted: Sun Jun 03, 2007 12:56 pm Post subject: |
|
|
| bman654 wrote: For your code, you shouldn't be using any formID's or anything because a "form" is a gui window and you are trying to do stuff with hotkeys (ie no gui). Most likely you are trying to use some code from the inventory screen. |
I just found out what causes the error. My functions seem to work fine and the crash occurs when I open the inventory. The problem seems to be that I don't register picked up items properly with the unit. I hadn't used any forms yet and that just seems to be the problem as an item has a property called formId. Now the game complains that some item doesn't have a formid (the one I picked up).
This is the line where it happens. inv.xscr -> invClearForms:
| Code: inventory.deleteSubObject(slot.get(i).formId); |
In Inv.xscr they just get the from from a drop area slot.
| Code: object newForm = inventory.findSubObject(areaSlot[2].formId); |
And they get a hold of the drop area using a form.
| Code: list areaSlot = invFindDropArea(form, itemInstance.item); |
This is the cat chasing her own tail. I'll look into it again later.
|
_________________ (cc) http://www.shearer.de (cc) Kick Ass Rock (cc) free album download (cc) |
|
| Back to top |
|
|
Moriarty Colonel

Joined: 06 Jan 2006 Posts: 1728
|
Posted: Sun Jun 03, 2007 4:46 pm Post subject: |
|
|
bman654 wrote: | Moriarty wrote:
Thanks.
Associative arrays versus regular indexed arrays.
|
I assumed you didn't know what an assoc. array is. Map is a common name for them. |
I'm primarily PHP'er - love associatives. Even more so the fact that PHP can do both types in the same array. Call me a lazy coder.
Don't recall hearing them called maps before and I have dabbled in a bunch of languages, but I may have forgotton.
| Quote:
| Moriarty wrote:
Makes you wonder why the items listing object seems to be a vector then. That thing gets looped through thousands of times a game - very silly. |
Which items listing object? If you actually need to loop through all items to "do stuff to each item" a whole bunch, a vector will be quicker than a map. Maps are great for random access from string keys or random access to a sparse array (ie you might have an index that is 10000000 and another index that is 1 but you don't actually have 10000000 entries in the array). But maps are slow compared to vectors if you need to iterate through every entry. |
The one that stores the item database itemList - has about 140 entries. An example would be:
| Code:
getItemTypeIndex( itemTypeId )
{
object itemList = getGlobalVariable( "itemList" );
for( int i=0; i < itemList.size(); ++i )
{
if( itemList.get( i ) == itemTypeId ) return i;
}
return -1;
} |
Fortunately that function is only called 8 times, but I'm sure it's not alone.
I suspect it's because of things like that that there is a noticeable lag when you open the ufopedia / production screen etc (at least on my 2600).
|
|
|
| Back to top |
|
|
panzrfaust Private first class

Joined: 28 May 2007 Posts: 31
|
Posted: Sun Jun 03, 2007 7:50 pm Post subject: |
|
|
I just made a kind of an auto-installer for the xbig, I know most people don't have a problem using the command prompt, but if you do, this might be the thing for you.
It auto-extracts system.xbg and replaces it with the blank.xbg (renamed ofc).
Link: http://www.savefile.com/files/777774
Modding just got easier
(Yes, this isn't really needed, I just wanted to help out those who might be inexperienced in using the command prompt, dont download if you dont want to.)
|
|
|
| Back to top |
|
|
Moriarty Colonel

Joined: 06 Jan 2006 Posts: 1728
|
|
| Back to top |
|
|
panzrfaust Private first class

Joined: 28 May 2007 Posts: 31
|
Posted: Sun Jun 03, 2007 10:18 pm Post subject: |
|
|
yea, but i didnt, i like the old fashion way of creating batch files
and all ppl (as myself) dont want MIAB, i just want Bman's mod.
|
|
|
| Back to top |
|
|
Moriarty Colonel

Joined: 06 Jan 2006 Posts: 1728
|
|
| Back to top |
|
|
panzrfaust Private first class

Joined: 28 May 2007 Posts: 31
|
Posted: Mon Jun 04, 2007 8:17 am Post subject: |
|
|
ah, well i didnt even know it came with an in/uninstaller. but as you said, no harm done 
|
|
|
| Back to top |
|
|
gloomlord Rookie

Joined: 10 Jun 2007 Posts: 5
|
Posted: Sun Jun 10, 2007 6:47 pm Post subject: |
|
|
Hello, I'm obviously new the forum and have really enjoyed looking around at the topics. I'm particularly interested in the modding section as one of the things that prevented me from wanting to buy this game in the first place were some of the major concerns listed on review sites... I'll have to admit it looks like the modding community has taken care of a lot of these problems already!
I had a question regarding these mods I was hoping someone could help me out with. I have not read every post on this thread so I apologize if this has already been answered, but I'm wondering how compatible the various mods are with each other? It looks like there are more than a few in the Mod List that I would want to take advantage of, but is there a compatibility issue trying to use more than one at once? Is there one or more mods that are very comprehensive and contain a large number of fixes together?
Also, off topic for this thread I know, is there a post somewhere or anything on the website (I didn't notice anything if there is) regarding what exactly was addressed in the patch that was released?
Thanks in advance for your help!
|
|
|
| Back to top |
|
|
Murkhach Private first class

Joined: 05 Jun 2007 Posts: 31 Location: Olomouc, CZ
|
Posted: Mon Jun 11, 2007 9:42 pm Post subject: Alien Base Cloak System :) |
|
|
I finally did it and test it !!
- each alien base has a cloak generator
- range is increased by game period
- At least important change is (repair of scan % count)
| Code:
DetectChance = DetectChance * (1 + 0.2 * ScanInfo.BigScanners + 0.08 * ScanInfo.SmallScanners) + DetectionBonus;
|
if ufo fully cloaked
- interceptor has some better chance (45 detect, 60 lose) than
- base radars near( overscan, 80 lose) - far(overscan, 120 lose)
-overscan if there is normaly (without cloak) better chcnce to detect than 100
then min(25,reminder) is added to detection probabality without cloak penalty
Globeai.xscr
comment print and printf after for final use
| Quote:
AIUpdateUfoVisibility(UfoInfo)
{
int ALIEN_CLOAK_DISTANCE = 2800;
int ALIEN_CLOAK_DISTANCE_INC = 200;
int Time = GetTimeInSeconds(CURRENT_TIME);
if (Time > UfoInfo.LastScanTime + ScanFrequency)
UfoInfo.LastScanTime = Time;
else
return;
if (HackScanners)
{
AIShowUfo(UfoInfo, false);
return;
}
float DetectionBonus = 0, MaxDetect = 0.0, MinLose = 100.0, DetectChance, LoseChance;
float unCloakChance = 1;
float cloakDistance = ALIEN_CLOAK_DISTANCE + GetGlobalVariable("AlienAI").GamePeriod * ALIEN_CLOAK_DISTANCE_INC;
float minDist = cloakDistance;
float overScan = 0;
float Dist;
object UfoBases = GetGlobalVariable("StrategicPart").UfoBases;
for (int I = 0; I < UfoBases.size(); I++)
{
object Base = UfoBases.get(I);
if (Base.TypeName == "EmptyType" ) continue;
Dist = SizeOfVector(SubstractVectors(GetUfoInfoPos(UfoInfo), Base.Location));
if (Dist < minDist) minDist = Dist;
}
/* 0-25% (100% effect)
25%-100% (100%-0%) */
unCloakChance = 1 - min(1, 4*(cloakDistance-minDist)/(cloakDistance*3));
if (UfoInfo.OnLand)
{ DetectionBonus = DetectionBonusUfoOnLand;
if (UfoInfo.GlobeMission != null)
{
if (UfoInfo.GlobeMission.MissionType ==UFO_MISSION_MINING) DetectionBonus *= 1.4;
if (UfoInfo.GlobeMission.MissionType ==UFO_MISSION_CONSTRUCTION) DetectionBonus *= 1.8;
};
}
//Murkhach
object Bases = GetGlobalVariable("StrategicPart").Bases;
for (int I = 0; I < Bases.size(); I++)
{
object Base = Bases.get(I);
if (Base.typeName == "EmptyType") continue;
object ScanInfo = Base.ScanInfo;
float Dist = VectorDist(Base.Location, GetUfoInfoPos(UfoInfo));
float MaxRange = tof(ScanInfo.MaxRange);
if (MaxRange == 0) { // bases with no scanners have no range
DetectChance = 0;
} else if (Dist < MaxRange) {
DetectChance = 90;
} else if (Dist < 2*MaxRange) {
DetectChance = Max(0.0, (2*MaxRange - Dist)) / MaxRange * 90;
}
else
{
printf("Scan info %d: to faar %f > %f ",I,Dist,MaxRange);
continue;
}
printf("Scan info %s: big:%d small:%d bonus:%d chance: %d distance: %d ",Base.name,ScanInfo.BigScanners,ScanInfo.SmallScanners,DetectionBonus,DetectChance,Dist);
DetectChance = DetectChance * (1 + 0.2 * ScanInfo.BigScanners + 0.08 * ScanInfo.SmallScanners) + DetectionBonus;
overScan = max(0,DetectChance-100);
DetectChance =(DetectChance-overScan) * unCloakChance + min(overScan,25);
if (!UfoInfo.OnLand) {
if (MaxRange == 0) { // bases with no scanners have no range
LoseChance = 100;
} else if (Dist < MaxRange) {
LoseChance = 80*(1-unCloakChance);
} else if (Dist < 2* MaxRange) {
LoseChance = 40+80*(1-unCloakChance);
} else {
LoseChance = 100;
}
} else {
LoseChance = 0;
}
if (MaxDetect <DetectChance> LoseChance) MinLose = LoseChance;
}
object CafShips = getGlobalVariable("shipsOnGlobe");
for (int I = 0; I < CafShips.size(); I++)
{
object Ship = CafShips.get(I);
float Dist = VectorDist(Ship, GetUfoInfoPos(UfoInfo));
float MaxRange = tof(GetItemType(Ship.Ship.planeTypeId).ScanRange);
if (Dist < MaxRange) {
DetectChance = 45 + 45*unCloakChance;
} else {
DetectChance = 0;
}
if (!UfoInfo.OnLand) {
if (Dist < MaxRange) {
LoseChance = 60 * (1-unCloakChance);
} else {
LoseChance = 100;
}
} else {
LoseChance = 0;
}
if (MaxDetect <DetectChance> LoseChance) MinLose = LoseChance;
}
Printf("Final detection [%d,%d] cloak = %d ",MaxDetect,MinLose, unCloakChance*100);
if (!UfoInfo.Visible)
{
// Ufo is not detected yet but can be detected now
int Dice = rand(100);
if (Dice < MaxDetect) {
AIShowUfo(UfoInfo, false);
} else {
AIHideUfo(UfoInfo, false); // needed!
}
}
else
{
// Ufo is detected but can be lost now
int Dice = rand(100);
if (Dice < MinLose) {
AIHideUfo(UfoInfo, false);
} else {
AIShowUfo(UfoInfo, false); // needed!
}
}
|
code
| Quote:
// ufo is cloaked and damaged 40 - 100 %
if (Ship.Type == GLOBE_OBJECT_UFO_SHIP && !Ship.UfoInfo.Visible)
{
if (rand(100) < 100 - 60 * (Ship.ACTarmor / GetUFOItemType(Ship.UfoInfo.DatabaseId).Armor))
return false;
}
|
Last edited by Murkhach on Tue Jun 19, 2007 8:54 am; edited 2 times in total |
|
|
| Back to top |
 |
|
Murkhach Private first class

Joined: 05 Jun 2007 Posts: 31 Location: Olomouc, CZ
|
Posted: Mon Jun 11, 2007 10:14 pm Post subject: AI Balance |
|
|
There could be added some kind of AI agression balance
( CAF Bases + period > Alien BAses + constant ) = > agrression increased
( CAF Bases + period <Alien> agrression decreased
BASE_DEFENCE
- if find base (set to 0)
- if RETALIATION SUCCESFULL decrease
- if RETALIATION FAILED increase to retaliation ship size + ERA
- if defence <Ship> RETALIATE else BOTHER
Add new mission type
MISSION _BOTHER
- ufo (or squad) that atacks CAF ships (especially unprotected transport )
- balanced that if is ufo under atack it repeats fire and let transport go
- if there is no trnasport neraby so fly around base
How It shoudld work showed next
CAF BASE DEFENCE STRENGHT - p_def
ALIEN BASES # - ai_bas
PLAYER BASES # - p_bas
FREE STATES # - neutral
on agression peak
if there is no known base (spy as well)
p_def = low && ai_bas <p_bas> neutal => RETALIATION
p_def = high && ai_bas <p_bas> neutal => BOTHER
=> TERROR
on medium agression
ai_bas <p_bas>0 => CONSTRUCTION
ai_bas <p_bas> ABDUCTION
default and randomly
MINING
SUPLY
SPY
|
|
|
| Back to top |
 |
|
greycell Sergeant first class


Joined: 18 Feb 2007 Posts: 175 Location: Toronto Canada
|
Posted: Tue Jun 12, 2007 4:43 am Post subject: |
|
|
This is very cool. I hope someone can implement this into one of the major mods with an option for it.
|
_________________ UFO:ET Wiki |
|
| Back to top |
|
|
Murkhach Private first class

Joined: 05 Jun 2007 Posts: 31 Location: Olomouc, CZ
|
Posted: Thu Jun 14, 2007 11:48 am Post subject: Did anyone try to improve granades ? |
|
|
I have an idea to improve function of gramades and add some new techs
- i think that there could be new research items
[timers] - requires researched ufotype2
- allows to manufacture granades with timers
[proximity] - requires destroyer race, timers
- allow to create proximity mines
[proximity2] - some more advanced technology, proximity2
- explodes only if there is no CAF unit nearby
[micromechaics] - based on trilobit race or something like it, proximity
- allows to produce boomeroids none from apocalypse
[wawedecoder] - basebuilding that provides additional info about ufo
-
[alien anatomy ] - requires researched some races depends on period
- with researched alien and this is in tactical missions there is better chance of inflicting citical hit /* dice table in mission.xscr */
[mind probe] - gets info about alien
p.s. What developer tools are you using /* Total Comander + print(), printf() */ ?
p.s.s. Is' it wise to try mod alien ocuupeatioj (like, soldier, commander, navigator, engeneer, medic ...)
|
|
|
| Back to top |
 |
|
ksnoopy Private first class

Joined: 02 Jul 2007 Posts: 20
|
Posted: Mon Jul 02, 2007 6:30 am Post subject: |
|
|
I'm just starting to make my own mods in this game.
I'm wondering if there's a way to make the game reload the .xscr files so I can make changes to the scripts and have those changes take affect without having to exit and restart the game? Like something like a "Reload UI" debug command....
|
|
|
| Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|