 |
|  |
 |
|
Immortal Wombat
|
 |
in perpetuity
Dec 2000 time: 05:24
|
|
quote: Originally posted by Maquiladora
2. If a named unit is killed, how do i make a popup? Like for example if the "HMS Repulse is sunk by the Japanese", when the Japanese attack and sink that particular named unit? It will be a generic unit though (ie unit_battlecruiser) or would i need to create a special unit_hmsrepulse? (that seems overly complicated though for one unti) but it will be killed at game start anyway so...
|
If you can guarantee it's location at the beginning of the game, then you don't need to define a new unit. If you cannot, then by far the easiest way is to have a UNIT_HMS_REPULSE.
Then you need something like this:
code:
HandleEvent(BattleAftermath) 'is_hms_repulse_still_around' pre {
int_t i;
unit_t tmpUnit;
int_t here;
// assuming REPULSE owner is 1
for(i=0; i < PlayerUnitCount(1); i = i + 1){
GetUnitByIndex(1, i, tmpUnit);
if(tmpUnit.type == UnitDB(UNIT_HMS_REPULSE)){
here = 1;
}
}
if(!here){
message(1, 'hmsrepulse_dead');
}
}
messagebox 'hmsrepulse_dead' {
Show();
Title(ID_HMS_REPULSE_DEAD_TITLE);
Text(ID_HMS_REPULSE_DEAD);
}
quote:
3. How do i spawn units on a given turn, and the make them attack a specific city or tile in the next turn/s?
|

Without going in to too much detail, you'll need to know the locations they'll be spawned in, do CreateUnit functions for each one (as used in the AtG scen), then store each one, probably best to use a unit array. Then on the next beginturn for their owner, check they're still alive, and use a MoveOrder or Battle order perhaps to force the attack. I don't know if this works properly.
Try looking at Peter Triggs reSLICed WW2 scenario. This might have examples of this kind of thing.
|
|
|  |
 |
|
Maquiladora
|
|
Ah okay, good.
One more question, if i create an event for say: if the human player attacks the Neutral Civ they get all gold taken away for 10 turns. But make it so the human can still pay upkeep+wages, but limit them to no rush buying money, perhaps change the gold amount to 100 after the turn has been played ready for next turn. Also i want to prevent the AI from attacking the Neutral Civ, civ number 7.
|
|
|  |
 |
|
Maquiladora
|
|
Yeah i read that part right then. I guess thats not as bad, but as the human will know the consequences for attacking a neutral nation, they could spend all their money before they attack so it doesnt get taken away.
|
|
|  |
 |
|
Maquiladora
|
|
cross posted abit there
quote: Originally posted by Immortal Wombat
er... is the only other use for gold rush-buying? It would be much easier to prevent that, rather than messing with the amount of gold they actually have. |
Yeah, i just dont want the human to have the ability to rush buy units if they want to gain an advantage by attacking a neutral. But i think taking away their money for several turns and giving a popup telling them, has more atmosphere, no?
|
|
|  |
 |
|
Maquiladora
|
|
Or,
If say, Britain attacks a Neutral city, Germany and Japan receive 5000 gold each, sort of like the Neutrals paying for help but no need to deduct the Neutrals money because theyll be unplayable and no one will notice.
|
|
|  |
 |
|
Maquiladora
|
|
Okay i need good ideas for turnlength.
Currently the scenario lasts 46 months in real life, and i ideally want the scenario to last around 150-500 turns. Just some ideas,
1-8 Jan
9-16 Jan
17-24 Jan
25-31 Jan
1-8 Feb (or 7-14 Feb)
etc
... or
Week 1 Jan
Week 2 Jan
Week 3 Jan
Week 4 Jan
Week 1 Feb (or Week 5 Feb)
Which do you prefer? Keep in mind i want it to last over 150 turns and not anymore than 500, and also each turn to be an equal increment. I cant decide which one i like. Obviously length of the scenario is most important because all the ideas and events will fit around it, not to mention growth and science costs. Any other ideas welcome...
|
|
|  |
 |
|
centrifuge
|
|
I like the 2nd choice as well... Just looks "cleaner" I guess.
|
|
|  |
 |
|
Maquiladora
|
|
Okay that one it is. Although itll have to be,
Wk 2 Dec 1941
Wk 3 Dec 1941
Wk 4 Dec 1941
Wk 1 Jan 1942
so the year fits in the little turn box.
A new question: How do i stop all players from changing government? Aside from giving them all seperate advances for each of their governments. Ideally through nice clean slic code.
|
|
|  |
 |
|
Maquiladora
|
|
Okay nevermind i figured out a way to do it. Ill give each nation a new strategy in strategies.txt and define only one government for each. Like it was done in the Activison ww2 one. I was gonna give each government a new strategy anyway so...
|
|
|  |
 |
|
Maquiladora
|
|
How do i immediately start a new line in a messagebox? Is it possible?
|
|
|  |
 |
|
Maquiladora
|
|
Yeap, using that now.
|
|
|  |
 |
|  |
 |
|
Martin Gühmann
|
 |
Berlin, Germany
Mar 2001 time: 06:24
|
|
I have here a piece of code that was able to make an army to attack a city that is on a neighbor tile of that city. I tried something like this recently. But I failed as far as I figured it out I wasn't able to group the just created units into one army.
code:
void_f MG_SendTroopsTo(location_t theLoc, location_t theGoal) {
location_t MGLoc;
location_t MGGoal;
army_t MGArmy;
unit_t MGUnit;
MGLoc = theLoc;
MGGoal = theGoal;
if (GetUnitsAtLocation (MGLoc)>0) {
Event:ActivateAllUnits(MGLoc);
GetUnitFromCell(MGLoc, 0, MGUnit);
GetArmyFromUnit(MGUnit, MGArmy);
Event:Battle(MGArmy, MGGoal);
message(1,'MG_TestMessage');
message(MGArmy.owner,'MG_TestMessage');
}
}
If you want to group all units at agiven location into one army you could use this event:
GroupOrder(army_t);
But note that you can't do anything with this army on the same turn, because all the events are executed afterwards the current event handle and all called events before were executed.
For the rest I suggest to consult also slci code that is not part of scenarios, the BetteraAI code contains some stuff about grouping single units into an army and has also some stuff about moving armies if you want to make the army to attack someone you needs the battle event.
-Martin
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:24. Apolyton Time is 00:24. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|