Spawning with less than the maximum ammunition.

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

fasty
1st Lieutenant
1st Lieutenant
Posts: 438
Joined: Thu Apr 15, 2010 4:17 am
Projects :: Server modding
Games I'm Playing :: SWBF2
Contact:

Spawning with less than the maximum ammunition.

Post by fasty »

Is it possible to have a unit spawn with say, 100 out of a max of, 200 shots for his rifle? Can he start out with less than the max amount of ammo and can get more?
mswf
Master Bounty Hunter
Master Bounty Hunter
Posts: 1674
Joined: Tue Mar 31, 2009 3:40 pm
Location: Twello, The Netherlands
Contact:

Re: Spawning with less than the maximum ammunition.

Post by mswf »

I don't remember that that's possible.
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: Spawning with less than the maximum ammunition.

Post by myers73 »

never seen it done
fasty
1st Lieutenant
1st Lieutenant
Posts: 438
Joined: Thu Apr 15, 2010 4:17 am
Projects :: Server modding
Games I'm Playing :: SWBF2
Contact:

Re: Spawning with less than the maximum ammunition.

Post by fasty »

Yeah, I don't think its possible :P. I've been fooling around with my units odf. Tried adding stuff like, WeaponAmmo = 5/10 and such, but no success :( .
Darth_Squoobus
General
General
Posts: 760
Joined: Mon Aug 03, 2009 3:21 am
Projects :: No Mod project currently.
Location: over the hills and far away

Re: Spawning with less than the maximum ammunition.

Post by Darth_Squoobus »

Expirement and find out.
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: Spawning with less than the maximum ammunition.

Post by DarthD.U.C.K. »

editing the units odf wont work since the ammorelated lines only control the absolute ammo you can have
User avatar
Lagomorphia
Major
Major
Posts: 502
Joined: Sun Dec 13, 2009 10:02 am

Re: Spawning with less than the maximum ammunition.

Post by Lagomorphia »

When you change class you have less than full ammo and abilities such as sabotage can reduce things, so it's probably possible but also probably complicated.
fasty
1st Lieutenant
1st Lieutenant
Posts: 438
Joined: Thu Apr 15, 2010 4:17 am
Projects :: Server modding
Games I'm Playing :: SWBF2
Contact:

Re: Spawning with less than the maximum ammunition.

Post by fasty »

Yeah, I thought about using the sabotage bonus :cantina: . I still would rather figure out how it works, though.

It wouldn't work for what I want also.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Spawning with less than the maximum ammunition.

Post by Fiodis »

The sabotage bonus, I think, deals a certain amount of damage to a side's vehicles immediately upon them spawning - it has nothing at all to do with ammo, and cannot be applied here. Changing classes preserves the amount of ammo you have at the moment - if you change classes while you have full ammo, you will respawn as your new class with full ammo. That effect, also, can't be applied here.

In fact, I don't think there is any way to do this.
fasty
1st Lieutenant
1st Lieutenant
Posts: 438
Joined: Thu Apr 15, 2010 4:17 am
Projects :: Server modding
Games I'm Playing :: SWBF2
Contact:

Re: Spawning with less than the maximum ammunition.

Post by fasty »

Wouldn't surprise me if it isn't possible. Just a little idea I had for my map :sick: . I'm still experimenting of course. If anyone has any suggestions of what I could try, just throw them at me.
Last edited by fasty on Thu Jul 29, 2010 6:07 am, edited 2 times in total.
User avatar
Lagomorphia
Major
Major
Posts: 502
Joined: Sun Dec 13, 2009 10:02 am

Re: Spawning with less than the maximum ammunition.

Post by Lagomorphia »

Maybe there is a way to make the units 'use' 50% of their ammo as they spawn?
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Spawning with less than the maximum ammunition.

Post by lucasfart »

Thats a good idea, but i can't really see how you would implement it in the lua...
CressAlbane
Master Bounty Hunter
Master Bounty Hunter
Posts: 1519
Joined: Fri Dec 18, 2009 8:02 am
Projects :: CTF Arenas
Games I'm Playing :: Steam- cressalbane2
Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı

Re: Spawning with less than the maximum ammunition.

Post by CressAlbane »

Or when after he spawns use a setproperty to make his ammo higher?
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Spawning with less than the maximum ammunition.

Post by lucasfart »

That might work. Give it a try and tell us if it works :)
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Spawning with less than the maximum ammunition.

Post by Fiodis »

Lagomorphia wrote:Maybe there is a way to make the units 'use' 50% of their ammo as they spawn?
You cannot force a unit to fire a weapon via lua, so no.
CressAlbane wrote:Or when after he spawns use a setproperty to make his ammo higher?
Example Finder gives no instance of "CurAmmo" or "CurAmmunition" anywhere. You can use SetProperty with CurHealth to play with health, but you can't use it to affect ammunition.

In short, I don't think there's any way to do this. Feel free, of course, to say "but maybe if we did this", but fully expect someone to post a reason why you can't.
fasty
1st Lieutenant
1st Lieutenant
Posts: 438
Joined: Thu Apr 15, 2010 4:17 am
Projects :: Server modding
Games I'm Playing :: SWBF2
Contact:

Re: Spawning with less than the maximum ammunition.

Post by fasty »

Maybe something along these lines, or am I totally off? :P
Hidden/Spoiler:
testFunction = OnCharacterSpawn(
function(player, spawn)
SetProperty(unit, "CurAmmunition", GetObjectAmmunition(unit)+20)
end
)
Hidden/Spoiler:
By the way, it doesn't work. What a surprise. :roll:
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Spawning with less than the maximum ammunition.

Post by Fiodis »

fasty wrote:Maybe something along these lines, or am I totally off? :P
Hidden/Spoiler:
testFunction = OnCharacterSpawn(
function(player, spawn)
SetProperty(unit, "CurAmmunition", GetObjectAmmunition(unit)+20)
end
)
By the way, it doesn't work. What a surprise.
Fiodis wrote:Example Finder gives no instance of "CurAmmo" or "CurAmmunition" anywhere. You can use SetProperty with CurHealth to play with health, but you can't use it to affect ammunition.
Indeed, what an unexpected surprise. :wink:
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Spawning with less than the maximum ammunition.

Post by [RDH]Zerted »

Spawning and attempting to increase the max ammo count would mostly likely (if it is possible) crash the game in MP. I know messing with weapons almost always causes crashes.

I don't know if an ammo pick-up could have a negative ammo count, which in theory would cause anyone picking it up to lose ammo. If so, you could try creating one directly on the locations of any spawning units.
User avatar
SW_elite
Filthy Thief
Filthy Thief
Posts: 507
Joined: Sat Jan 02, 2010 6:43 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia!!!

Re: Spawning with less than the maximum ammunition.

Post by SW_elite »

I was thinking of something along those lines but I didn't bother posting because I have no clue how to get it working.
fasty
1st Lieutenant
1st Lieutenant
Posts: 438
Joined: Thu Apr 15, 2010 4:17 am
Projects :: Server modding
Games I'm Playing :: SWBF2
Contact:

Re: Spawning with less than the maximum ammunition.

Post by fasty »

It's a great idea but I don't know how to get it working either. Whenever I mess with the com_item_powerup_ammo, nothing happens in game although, I noticed it does munge it in VisualMunge. I can't get it to subtract ammo, or add any.
Post Reply