HisShame
  • HisShame
  • 52.25% (Neutral)
  • Private Topic Starter
14 years ago
Basically, I'm creating a mission involving Humvees rolling through a destroyed city. Of course, the Humvees need TOW missiles if they're going to have any chance of surviving, and I don't know how to have them spawn with TOW's already equipped! I don't know how I've made it this far without needing Pre-Built Upgrades, but here I am.

It's worth mentioning that it is preferable to not have any American buildings on the map at all. If they are absolutely necessary, I guess I can just make them unselectable. I'm pretty good with scripts (I've worked with them a ton in the past), and I'm trying to stay away from INI's.

If you know of a way to use scripts to instantly build pre-built upgrades into units, your help would be much appreciated. If you know how to achieve the same result with INI's, and have the time/patience to give me step-by-step instructions (I don't even know how to open them), then you, sir, are a better man than I, and I'd appreciate you teaching me your wizardry.

So far I've spent a good hour scouring the web for anyone with an explanation, but I've come up dry.

Thanks!
Sponsor
Annihilationzh
14 years ago

If you know of a way to use scripts to instantly build pre-built upgrades into units, your help would be much appreciated.


You can force a player to buy an upgrade, but granting it for free is not possible IIRC.

You could add this to a map.ini:
Object AmericaPowerPlant
 AddModule ModuleTag_XX_Override
  Behavior = GrantUpgradeCreate ModuleTag_XX
    UpgradeToGrant     = Upgrade_AmericaTOWMissile
  End
 End
End
This will make the upgrade free if the user owns a power plant.
If you need help, post in the forum. You'll get help a lot faster than if you send me a PM.

I reject all buddy requests. I don't think 'buddy' needs to be made official. It's not like you're marrying me.
stefandeath
14 years ago
I always do it like this:

Spawn an America War Factory outside the map with the name: 'USA War Factory'

*** IF ***
True
*** Then ***
'USA War Factory' is transferred to the command of 'player0'
Unit 'USA War factory' use Ability 'Command_UpgradeAmericaTOWMissile'

Found at:
Player -> Transfer -> Transfer a specific unit to the control of player.
Unit -> CommandButton -> Use command button ability

player0 is the person in the first slot. You could always change that to something else which could suit you better. I don't know for which person you need it.
If you already had the building on the right player from the start (for example for a certain AI or civilian etc) then you can scratch the unit transfer line.

You could also add in that you really cannot cancel it.


*** IF ***
True
*** Then ***
'USA War Factory' is transferred to the command of 'player0'
'USA War Factory' changes the value of the flag 'selectable' to 'FALSE'
Unit 'USA War factory' use Ability 'Command_UpgradeAmericaTOWMissile'

Found at:
Unit -> Affect flags set on panel.

Remember that it takes the normal research time of the TOW Missile then. If you do not use the map for online gameplay (some fan made missions can be used online so I don't know if its for SP or MP) then you could also better use map.ini with this code:


Upgrade Upgrade_AmericaTOWMissile 
  BuildTime          = 0.1
End

With that code you change the research time of TOW Missiles from 30 seconds to 0,1 seconds, which is practically instantly.

My self made CCG Zero Hour Maps can be downloaded from here . Readme files are included.
My Uploaded Race Maps: Race map v3.1  | Race Map v2.5 
HisShame
  • HisShame
  • 52.25% (Neutral)
  • Private Topic Starter
14 years ago
Thanks very much to both of you!

Annihilationzh: First off, I am a big M*A*S*H fan, and I appreciate the Colonel Flagg quote. Second, although it is free, will the upgrade be automatic/instantaneous?

stefandeath: I will definitely be giving your solution a try. I was doing something more complicated, but this will make for much less of a headache.

Both: How do you go about editing a map.ini file?

Thanks again!
Annihilationzh
14 years ago

Second, although it is free, will the upgrade be automatic/instantaneous?


Yes. This is the same method toxin general uses to get anthrax beta and toxin shells (which he starts with).

This code is easily adaptible. Here's one for the war factory:
Object AmericaWarFactory 
AddModule ModuleTag_XX_Override
  Behavior = GrantUpgradeCreate ModuleTag_XX
    UpgradeToGrant     = Upgrade_AmericaTOWMissile
  End
End
End

And one for the US Ambulance:
Object AmericaVehicleMedic
AddModule ModuleTag_XX_Override
  Behavior = GrantUpgradeCreate ModuleTag_XX
    UpgradeToGrant     = Upgrade_AmericaTOWMissile
  End
End
End

Both: How do you go about editing a map.ini file?


Use notepad. It goes in the same folder as the .map and .tga file, and can be created by making a txt file and changing it's extension to ini.
If you need help, post in the forum. You'll get help a lot faster than if you send me a PM.

I reject all buddy requests. I don't think 'buddy' needs to be made official. It's not like you're marrying me.
HisShame
  • HisShame
  • 52.25% (Neutral)
  • Private Topic Starter
14 years ago
So, just opening a new txt file, pasting the code (lets say, copy-pasting the war factory code) and saving it as "map.ini" to the same location as the map itself? That's it?
stefandeath
14 years ago
My way is simply when you do not want to use map.ini at first, or if you may delete the map.ini file later on. Better to listen to Annihilation if you intend to use map.ini.

My self made CCG Zero Hour Maps can be downloaded from here . Readme files are included.
My Uploaded Race Maps: Race map v3.1  | Race Map v2.5 
helderD
14 years ago
Nevermind! I had the .ini file saved as 'mapname.ini' instead of map.ini.
It works fine now :)

But how do I know the normal BuildTime?
And how can I set it back so if I use a Control Rods upgrade next time in this game, it won't build in 0.1?





Hi.
I used this way to make my Power plants upgrade the power control rods.

script:
if
true
then
Unit 'PowerPlant1' use Ability 'Command_UpgradeAmericaAdvancedControlRods'.
Unit 'PowerPlant2' use Ability 'Command_UpgradeAmericaAdvancedControlRods'.
Unit 'PowerPlant3' use Ability 'Command_UpgradeAmericaAdvancedControlRods'.
Unit 'PowerPlant4' use Ability 'Command_UpgradeAmericaAdvancedControlRods'.

This works well, but I need the upgrade from the game start! So I tried to add this .INI:
Upgrade Upgrade_AmericaAdvancedControlRods 
  BuildTime          = 0.1
End

it's the way descriped above, but it won't work, the Advanced Control Rods just start to Upgrade with the same (old) Build Time

What am I doing wrong? or isn't 'Upgrade Upgrade_AmericaAdvancedControlRods' not right?
And if not, can I find somewhere a list with all the upgrade names?

Thanks!



stefandeath
14 years ago
Ini file editing stays the way it is forever on that map, it also cannot be used in multiplayer mode if not everyone has the map from the start. That's why I prefer scripting in worldbuilder. Also I suck at ini editing as you already saw 😛

Try to use Annihilation his way with ini scripting that will probably work.

These are the codes for both Control Rods (USA and SWG)


;------------------------------------
;America Cold Fusion Reactor Upgrades
;------------------------------------

Upgrade Upgrade_AmericaAdvancedControlRods
  DisplayName        = UPGRADE:ControlRods
  Type               = OBJECT
  BuildTime          = 30.0
  BuildCost          = 500 
  ButtonImage        = SSControlRods
End

Upgrade SupW_Upgrade_AmericaAdvancedControlRods
  DisplayName        = UPGRADE:ControlRods
  Type               = OBJECT
  BuildTime          = 30.0
  BuildCost          = 500 
  ButtonImage        = SACntrlRds ;Special blue ones for Superweapon general.
End

Coped and pasted it out of upgrade.ini

My self made CCG Zero Hour Maps can be downloaded from here . Readme files are included.
My Uploaded Race Maps: Race map v3.1  | Race Map v2.5 
helderD
14 years ago

Ini file editing stays the way it is forever on that map, it also cannot be used in multiplayer mode if not everyone has the map from the start. That's why I prefer scripting in worldbuilder. Also I suck at ini editing as you already saw 😛

Try to use Annihilation his way with ini scripting that will probably work.

These are the codes for both Control Rods (USA and SWG)


;------------------------------------
;America Cold Fusion Reactor Upgrades
;------------------------------------

Upgrade Upgrade_AmericaAdvancedControlRods
  DisplayName        = UPGRADE:ControlRods
  Type               = OBJECT
  BuildTime          = 30.0
  BuildCost          = 500 
  ButtonImage        = SSControlRods
End

Upgrade SupW_Upgrade_AmericaAdvancedControlRods
  DisplayName        = UPGRADE:ControlRods
  Type               = OBJECT
  BuildTime          = 30.0
  BuildCost          = 500 
  ButtonImage        = SACntrlRds ;Special blue ones for Superweapon general.
End

Coped and pasted it out of upgrade.ini

stefandeath wrote:



I see, thanks!

Do you know a way to get my power plants updated when the game starts without editing ini files?
I see a 'pre-build upgrades' thingy, but I can't add anything..
stefandeath
14 years ago


I see, thanks!

Do you know a way to get my power plants updated when the game starts without editing ini files?
I see a 'pre-build upgrades' thingy, but I can't add anything..

helderD wrote:


I like to know myself how to have instant upgrade in WB. In other words, I do not know.

My self made CCG Zero Hour Maps can be downloaded from here . Readme files are included.
My Uploaded Race Maps: Race map v3.1  | Race Map v2.5 
i^love^mixery
14 years ago


I see, thanks!

Do you know a way to get my power plants updated when the game starts without editing ini files?
I see a 'pre-build upgrades' thingy, but I can't add anything..

stefandeath wrote:


I like to know myself how to have instant upgrade in WB. In other words, I do not know.

helderD wrote:



thats simply impossible.

the pre-build upgrade thingy doesnt work for all upgrades. only china mines seem to work.. everything else is not displayed in the list ...
helderD
14 years ago


I see, thanks!

Do you know a way to get my power plants updated when the game starts without editing ini files?
I see a 'pre-build upgrades' thingy, but I can't add anything..

i^love^mixery wrote:


I like to know myself how to have instant upgrade in WB. In other words, I do not know.

stefandeath wrote:



thats simply impossible.

the pre-build upgrade thingy doesnt work for all upgrades. only china mines seem to work.. everything else is not displayed in the list ...

helderD wrote:



So I guess the only solution is to make a longer intro to my mission. haha

Thanks for the answers 🙂
i^love^mixery
14 years ago
btw if you are creating a singleplayer map you can change the visual game time so you can make the game run 20x faster. the script is in Unnused -> Map -> Modify -> Visual game time (if i remember right)

20x faster is almost instant upgrade.. :P

after upgrade complete you can, of course, change it back.
stefandeath
14 years ago

btw if you are creating a singleplayer map you can change the visual game time so you can make the game run 20x faster. the script is in Unnused -> Map -> Modify -> Visual game time (if i remember right)

20x faster is almost instant upgrade.. :P

after upgrade complete you can, of course, change it back.

i^love^mixery wrote:


Good one. I thought that thing didn't work since I didn't see any different changes.

My self made CCG Zero Hour Maps can be downloaded from here . Readme files are included.
My Uploaded Race Maps: Race map v3.1  | Race Map v2.5 
i^love^mixery
14 years ago
there is one that does work very well. at least in singleplayer maps, in multiplayer i didnt test it yet.

its feels like the fast forward (F) mode in replays, only with selectable speed :P

i checked it now:
Unused -> Camera -> Modify -> That thing

it works good up to like 1.000x faster on my comp.

1.000x speed = units teleport and kill everything instantly xD

looks crazy, i recommend to fade to black while you build the upgrade like this to reduce lag.
stefandeath
14 years ago
Hmm, you give me some good idea's.

My self made CCG Zero Hour Maps can be downloaded from here . Readme files are included.
My Uploaded Race Maps: Race map v3.1  | Race Map v2.5 
helderD
14 years ago
Works PERFECT you won't even see/hear the upgrade complete message/sound 😃
stefandeath
14 years ago
Did you find out if it works in multi-player games too? Humans vs humans I mean then.

My self made CCG Zero Hour Maps can be downloaded from here . Readme files are included.
My Uploaded Race Maps: Race map v3.1  | Race Map v2.5 
i^love^mixery
14 years ago
i just tested it. it doesnt. only the animations are faster but not the movements of the units itself. its totally screwed up in multiplayer lol.

also the fps limiter doesnt work in multiplayer games!