Custom Medals

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Custom Medals

Post by Anakin »

Hi,

haven'T found something about the award weapons in the faq thread. So is it possible to make my own medal types?
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Custom Medals

Post by DarthD.U.C.K. »

no, you cant really edit these (maybe change the name in the localisation though?!) here is a topic discussing this which is a result of putting for "medals" in the search function.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Custom Medals

Post by Anakin »

thanks for this, but it's not 100% what i'm looking for. i'm looking more for a hiden award. You make some points in some way lets say with the dc15 pistol. if you have enougth, you get an new weapon additionaly lets say the dc17 blaster. if you make enought with this you get the wookie bowcaster......

is this possible? i tryed to use in the weapons odf PointsToUnlock, but didn't worked for me.

and i don't want to save the award, so you can get the weapons on lifetime, after you made enought of them
Lephenix
Captain
Captain
Posts: 497
Joined: Tue Jul 12, 2011 6:46 am
Projects :: Becoming a Concept Artist-Illustrator
Contact:

Re: Custom Medals

Post by Lephenix »

Then that's not medals but award weapons.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Custom Medals

Post by AQT »

Anakin wrote:i tryed to use in the weapons odf PointsToUnlock, but didn't worked for me.
That's because it's an ODF parameter specifically for units and doesn't really make sense here at all...

This is really a case of learning from example. If you want a weapon to, say, work like the stock pistol/AWARD pistol in terms of the requirements to go from one weapon to the next (in this case, six kills at most to advance to the next weapon level), you simply look at what is in their respective ODFs. And look at what they have in common that obviously pertains to the award system!
com_weap_inf_pistol.odf wrote:

Code: Select all

ScoreForMedalsType = 0
MedalsTypeToLock = 0
com_weap_award_pistol.odf wrote:

Code: Select all

MedalsTypeToUnlock = 0
ScoreForMedalsType = 0
And that's how you link any two weapon for this specific medal type. I'll assume you know how to set up the unit ODFs so that this works correctly.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Custom Medals

Post by Anakin »

jep i know. but how can i change the count of people to kill? And i wnat to have the award weapons additionaly like the Roket, but to get the roket award you need to make u think 6 critical hides. So i want to make lets say 10 kills, or 20
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Custom Medals

Post by AQT »

Anakin wrote:jep i know
No offense, but it's hard to tell what you actually know at times.
but how can i change the count of people to kill?
Then you create your own medal type by trying the things suggested in the topic D.U.C.K. linked to.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Custom Medals

Post by Anakin »

[color=#FF8040]Frisbeetarian[/color] wrote:
DarthRogueKnight wrote:
Labj wrote:Why not ?
Its hardcoded.
I'm pretty sure that that's wrong. You would have to edit the shell at the very least to get your new medal to show up in the stats screen. I could be totally off base, but do you really need new medals and awards so long as you can have weapons that work as award weapons?

They would work the same way that award weapons work now, but they would be implemented differently. You would just use your Lua script to add a new weapon for a unit. You would not be able to replace the weapon (since you can't change the weapon in weapon slot 1), the new weapon would just be a different weapon choice for that unit, like the award rocket launcher.

Another way to do it would be to replace the original award weapon ODF with a new ODF, but you'd have to play around with that since I'm not sure of every reference between the original and the award weapons.

this is what i'm looking for. but how can i set up the properties in the Lua. is there an example?
Do the Weapons also need to be in the default_units.odf?
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Custom Medals

Post by Frisbeetarian »

What I said can be done with the Lua is demonstrated in Mav's Spira:Besaid map at the very least. I'm not sure if his script is in the Released Assets forum or not, but perhaps you can request it there.

Here is a topic that seems to cover what you're looking for: http://www.gametoast.com/forums/viewtop ... 27&t=13823.

Something that I'm not sure was mentioned: I think you have to respawn the unit before the changes take effect. Using Lua, though, you can kill the player, respawn him, then move him to the previous location instantly.
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: Custom Medals

Post by razac920 »

Hey I'm working on a Gun Game Mode that involves lots of switches of weapons, so I can give you some information.
First of all, you cannot edit a weapon's ODF via LUA, only unit classes.
For singleplayer maps to be played offline ONLY, you can edit the unit class's weapons to your liking. You could do so with a line such as SetClassProperty("unit_class_name","WeaponName1","weapon_class_name"), replacing the class names with what you want to change. Other things to change are WeaponAmmo1 (or 2, 3, 4) and WeaponChannel (if you're making something be a secondary). Also, you need not replace a weapon, you can add it as well (though MAYBE only if you have under 4 weapons). The unit can have up to 8, but the valid properties are WeaponName, WeaponAmmo, WeaponChannel (under the weaponsection = #) or appending the numbers 1-4. Note that you need to already have the weapon loaded in a different class before you can add it (though the other class that you load need not be added to a team). Another problem would be that every other unit of this class would inherit the changes as well. This could possibly be averted partially if you make changes, respawn your unit only, and change things back before any AI dies/spawns. I have never tried this, though. More simply would be to have the AI be on a third team with copies of original team classes (uneditted) and simply be allied to the player.

AN IMPORTANT point that Frisbeetarian mentioned is that you need to respawn the unit for changes to take effect. This MIGHT not apply to reskins, as I have not tried that, but it definitely is required for weapon changes. The code to make it apply is very straightforward though. A problem is that it will deduct from your points/reinforcement count unless you correct for this, depending on your game mode, and it will state on the screen that your character has died (or been killed).

If you're aiming to have it be multiplayer-compatible, your choices are much more limited. The game will crash for players if you try to use SetClassProperty to change the weapons of a class in the middle of a game. Furthermore, I do not think you can add a class in the middle of the game either. Thus, any class with "custom medal" award weapons must be in-game from the beginning. I suppose you could set the point requirement for this class to be really high (999) and kill any bots that attempt to spawn in it. Then, when you want to give the award weapon class to a player, you kill that player, switch that player's class, and force spawn them right in the same location. It's not perfect -- you get messages telling everyone the player died when he didn't -- but it functionally works. I am very willing to help give you example code that I've written, but I would like to know more precisely what is it you're trying to do.

EDIT: Ah, actually, you cannot simply spawn in a class you don't have the points for. But there are ways with LUA to add and take points from a player, so fundamentally there is no issue.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Custom Medals

Post by DarthD.U.C.K. »

razac920 wrote:AN IMPORTANT point that Frisbeetarian mentioned is that you need to respawn the unit for changes to take effect. This MIGHT not apply to reskins, as I have not tried that
if you are talking about changing the override-texture property: you cant do that ingame, as far as i know the overridetexture is applied either while munging or loading the model, same applies for addons i think.
you can however change textures midgame by loading a file that contains a texture with the same name. it doesnt require respawning and thus you need a unique model+texturname for the objects whose texture you change.
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: Custom Medals

Post by razac920 »

I was talking about switching weapons, but thanks for the info!
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Custom Medals

Post by Anakin »

mh thanks for your informations. the link is exactly what i'm looking for.

so if i understand everything right, i cannot make a mod being multi compatible and than make units to have medal weapons. right?

So lets say i have 6 units, all using the dc17_aa.

and only the 6th unit should get the wookie roketeer, if he made lets say 10 kills with the dc17_aa.

so i need first make three weapons. the dc17_aa and the dc17_aa_award and of course the wookie weapon.

in the lua i will set the thing with the change weaponsclass only for the dc15_aa_award,
so only the 6th unit will get the wookie weapon right?

only Problem: If any unit makes 10 kills with the dc17_aa_award all units with the dc17_aa_award will get the wookie roketeer on life time right? so is it only if one unit makes the 10 kills in one life, or let say i play the unit and kill 5, than the pc takes it and kills 3 and than i play it again an make 2 kills, will this gain the award too?

but all this will make the mod beeing multi incompatible right?

what about the region thing? do i need to edit the map in Zero first? ( i refere to this link http://www.gametoast.com/forums/viewtop ... 27&t=13823) or can this be done in the lua, too? if yes, will this crash the game in multi too?
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Custom Medals

Post by Frisbeetarian »

Anakin wrote:i cannot make a mod being multi compatible and than make units to have medal weapons. right?
Right
Anakin wrote:in the lua i will set the thing with the change weaponsclass only for the dc15_aa_award,
so only the 6th unit will get the wookie weapon right?
The change is a class-based thing. You change the weapon of a particular class, you don't turn a weapon into another weapon. All the classes can share the same weapon.
Anakin wrote:so is it only if one unit makes the 10 kills in one life...
When Zerted said, "For the number of kills, count each time the player kills an enemy," you have to keep track of that through a variable in the Lua script. You can grab each time a player makes a kill and increment a variable. If you want this to work over only one life, reset the variable when he dies, otherwise, just keep incrementing.
Anakin wrote:but all this will make the mod beeing multi incompatible right?
Right
Anakin wrote:what about the region thing? do i need to edit the map in Zero first?
Yes, though remember this was for a different question than you originally asked.
Anakin wrote:what about the region thing? ... can this be done in the lua, too?
Technically yes, but this is more advanced, and it's much easier to just take care of it in ZE.
Anakin wrote:what about the region thing? ... if yes, will this crash the game in multi too?
Since we're still talking about changing a class, yes. There's nothing different between the two questions except what the triggering mechanism is.
Post Reply