Page 1 of 1

Re: How To Use ActivateBonus

Posted: Thu Nov 29, 2007 11:44 pm
by [RDH]Zerted
Took me a while, but I finally figured out how to get those Galactic Conquest bonuses working in mod maps. Ignore the scripting documentation for this, its wrong or outdated. Ignore the other functions with Bonus in them, they seem to have been removed from the game but left in the code.

The function you want to use is:

Code: Select all

ActivateBonus( <team>, "<bonus>" )
where you replace <team> with the number of the team you want to have the bonus and <bonus> with the 'name' of the bonus you want the team to have. Its not very important where you put the ActivateBonus() line in the Lua.

Bonus 'Names':
team_bonus_advanced_blasters
team_bonus_autoturrets
team_bonus_bacta_tanks
team_bonus_combat_shielding
team_bonus_energy_boost
team_bonus_garrison
team_bonus_leader
team_bonus_sabotage
team_bonus_supplies

Here is a code example:

Code: Select all

--give the rebels extra ammo
ActivateBonus( ALL, "team_bonus_supplies" )
Here is another code example:

Code: Select all

--damage the Republic's vehicles
ActivateBonus( CIS, "team_bonus_sabotage" )
Bonus Descriptions:
Advanced Blasters - Increases the damage of all blaster-type weapons
Auto Turrets - Adds defense grid turrets to your CPs
Bacta Tanks - Gives your units a health regen
Combat Shielding - Increases the health of your units
Energy Boost - Gives your units an energy regen
Garrison - Gives you extra reinforcements if your reinforcement count drops too low
Leader - Activates your team's playable hero
Sabotage - Causes enemy vehicles to spawn damaged
Supplies - Increases the amount of ammo and supplies your units can carry

Important Notes:
Each team can only have one bonus at a time. If you try to give a team two bonuses, you will get an error in the error log. However, the second bonus does replace the team's first bonus.

You may be able to clear/remove some bonuses by replacing <bonus> with an invalid bonus 'name'. Example:

Code: Select all

ActivateBonus( IMP, "haha_no_bonus_for_you" )
You will get an error in the error log about an invalid voice over sound. Just ignore it.

All these bonuses work online except team_bonus_autoturrets.

WARNING:
The team_bonus_autoturrets and team_bonus_supplies bonuses may crash others in MP. That is to say, if you use one of those bonuses in a map and that map is played online, everyone who attempts to connect to that server may crash to desktop, even though the admin (if not a dedicated server) will be able to play just fine. The crashes occurs when the bonuses are enabled ingame (like when using the FakeConsole mod). I'm not sure if the crashing still occurs when used in a mod map while the map is being loaded.

Re: How To Use ActivateBonus

Posted: Thu Nov 29, 2007 11:55 pm
by authraw
Wow, that's great! Correct me if I'm wrong, but these bonuses can be added and removed while the map is playing, correct? So they could be added in the middle of a campaign-style map, right? Or do they have to be used before the map loads?

Re: How To Use ActivateBonus

Posted: Fri Nov 30, 2007 12:17 am
by Maveritchell
I'm assuming these have the same effect on any individual unit as SetProperty or SetClassProperty? That is to say giving the Bacta Tanks bonus to a team would override any AddHealth a specific unit had.

@authraw
You can dynamically add and remove these, which means yes, you can do during ScriptPostLoad (the part where your campaign stuff would be written).

Re: How To Use ActivateBonus

Posted: Fri Nov 30, 2007 4:52 pm
by authraw
Another question: Do we know how to make our own custom bonuses, or is that something that just can't be done?

Re: How To Use ActivateBonus

Posted: Fri Nov 30, 2007 5:03 pm
by Maveritchell
I don't know that we can necessarily create "bonuses" per se, but you can do whatever you want to whatever unit you want via scripting. If you wanted to, say, give every unit a speed bonus (might not work online; I hear Zerted had some problems with this), you could just use SetClassProperty for each unittype you wanted to have a speed bonus and change their Sprintspeed or whatever.

Re: How To Use ActivateBonus

Posted: Fri Nov 30, 2007 5:32 pm
by MandeRek
Ok i don't think i get it for a part... This goes let's say just in the ***c_con.lua , and adds a bonus. Does this mean if you add leader bonus to CIS and you play as rep you would be able to come across him ingame? And still this is handy! Nice find :)

Re: How To Use ActivateBonus

Posted: Fri Nov 30, 2007 6:32 pm
by ARC_Commander
Hmm... Would these be possible to activate through, say, a weapon?

Re: How To Use ActivateBonus

Posted: Fri Nov 30, 2007 6:35 pm
by Maveritchell
MandeRek wrote:Ok i don't think i get it for a part... This goes let's say just in the ***c_con.lua , and adds a bonus. Does this mean if you add leader bonus to CIS and you play as rep you would be able to come across him ingame? And still this is handy! Nice find :)
No, you can't use these to make the enemy AI use a hero. Basically, all the hero bonus does is make the hero accessible every time you spawn (or the first time, I can't remember).
ARC_Commander wrote:Hmm... Would these be possible to activate through, say, a weapon?
Yes, using the OnCharacterDispensePowerup or OnCharacterDispenseControllable functions through .lua.

Re: How To Use ActivateBonus

Posted: Sat Dec 01, 2007 8:59 am
by MandeRek
Oh ok get it now...Thanks Mav

Re: How To Use ActivateBonus

Posted: Sat Dec 01, 2007 6:04 pm
by Caleb1117
Confirmation: It seems this bit of data coding is most effective Meat ba... Er Master.

Just tried it with Auto turrets, pure awesome, voice over Announcement and everything.

Re: How To Use ActivateBonus

Posted: Sat Dec 01, 2007 7:52 pm
by Adjuntant_Reflex
I've always wondered how to add ActivateBonus to a mod map,awesome dude1 :thumbs:

Re: How To Use ActivateBonus

Posted: Thu Dec 13, 2007 7:19 pm
by [RDH]Zerted
WARNING:
The team_bonus_autoturrets bonus crashes others in MP. That is to say, if you use the auto-turret bonus in a map and that map is played online, everyone who attempts to connect to that server will crash to desktop, even through the admin (if not a dedicated server) will be able to play just fine.

The other bonuses seem to work fine in MP.

Re: How To Use ActivateBonus

Posted: Thu Dec 13, 2007 7:22 pm
by Caleb1117
Oooh, thanks for the warning, that was the bonus I was using.

Anyway, does this mean you've added functionality for these into the fake console?

Re: How To Use ActivateBonus

Posted: Sat Jan 12, 2008 10:51 pm
by [RDH]Zerted
Yes, they are all in there. I've broken the commands up into sections. You will be able to see which ones crash in MP and which ones are safe to use with other players.

Edit: Sadly, it seems team_bonus_supplies also crashes others when used online.