Page 1 of 1

How to make 'ammo classes' and 'pick-up' weapons

Posted: Fri Jul 28, 2006 8:05 pm
by Dabrowski
See post 4.
This is a concept i came up with for battlefront II based on other games and i was wondering how far can i change the gameplay in a certain map im planning.

1. In SWBFII, picking up an ammo increases all weapons ammo. My question is how to make it possible to get specific ammo. For example, one ammo pack gives grenades while the other gives rifle ammo.

2. Units gain weapons by picking new ones up. Or unit touches item (like a def boost canister) that gives him the weapon as an award (except it does not replace anything and is not award. Therefore everyone starts with one weapon, preferably a pistol, andpeople must find weapons to gain an advantage.

First of all, I would like to know if its possible or is there a differnet way to do it, and lastly how i would be able to accomplish this in a map.

RE: 2 Questions regarding changing Map Gameplay

Posted: Fri Jul 28, 2006 10:39 pm
by t551
I don't think that the weapon pickup is possible, even using awards, because I believe that a unit can only have one award specified, and I think that the award system is handled by the .exe itself. The same goes to the ammo idea. Don't take it that I want to crush your idea into little bitty pieces, I have little to no experience trying to do things like that. It's just that (from everything I've seen) SWBF is a game that can really only be played the way that the developers intended it to be played.

RE: 2 Questions regarding changing Map Gameplay

Posted: Sat Jul 29, 2006 3:02 pm
by [RDH]Zerted
Both of your ideas are doable, however there is one major problem. You can pickup/add/remove weapons/health/stats/etc... of unit classes, but not the unit itself.

Example: If a sniper picked up a jet pack, all other snipers would suddenly get jet packs too. (This would be fine if the map was limited to one player per class.)

RE: 2 Questions regarding changing Map Gameplay

Posted: Sat Jul 29, 2006 3:03 pm
by t551
Ah. I stand corrected.

RE: 2 Questions regarding changing Map Gameplay

Posted: Sun Aug 06, 2006 11:29 am
by Dabrowski
I like your method [RDH]Zerted, but how do you edit to get pickup/add/remove weapon?

But since I also want to devlop my original concept, how do i apply it?
Let's say I edit a unit's .odf and give him a pistol only, and in his other 5-7 slots I give him award weapons.

1) How can I create more item containers (ie. health, def, atk,...)
2)How can I edit what the container gives, such as an Award.
3)How can I make different kinds of ammunition (pistol, smg, standard, rocket, explosives)
4) How do i spawn items in a map?

Re: RE: 2 Questions regarding changing Map Gameplay

Posted: Sun Aug 06, 2006 11:36 am
by xwingguy
Dabrowski wrote:4) How do i spawn items in a map?
Felucia campaign made a flag out of nothing like so:

Code: Select all

	    	PowerCellSpawn = GetPathPoint("powercell_spawn", 0)
	    	CreateEntity("fel1_flag_powercell", PowerCellSpawn, "powercell") --Spawns the Holocron.
In one way of thinking about this, it may be taxing on the system. But on the other hand, infantry units are probably created in the same way.

RE: Re: RE: 2 Questions regarding changing Map Gameplay

Posted: Sun Aug 06, 2006 1:18 pm
by [RDH]Zerted
1) Item containers are just objects. Take a look at com_inf_default.odf to see how to add a dropable object.
2) Look at the game's containers and see how they work.
3) There are different ways to do this. One way is to make some of the dropable containers distroyable. In the map's Lua, when the object is destroyed (use OnObjectKill() ) give the player that destroyed it the ammo or whatever the object represents.

To change the value of somthing, use SetClassProperty( "[class name]", "[variable name]", ["][new value]["] )

Ex: SetClassProperty("all_inf_sniper", "AimFactorPostureStand", "80" ) would cause the Rebel's sniper to have very bad aim when standing.

Read the scripting guide for more info on SetProperty() and SetClassProperty()

I have to force units to spawn in the Deathmatch game mode. Respawning all dead units every 10 seconds doesn't seem to bother the game. To spawn units, use SpawnCharacter( [character index], [a path point] ). To get the character index... well, go look it up yourself (remember ambush?).

RE: Re: RE: 2 Questions regarding changing Map Gameplay

Posted: Sun Aug 06, 2006 3:50 pm
by Dabrowski
What exactly im doing is this: Each unit spawns with a pistol. But I have weapons spawn at random regions. And next to them are ammo that represents that weapon. A unit picks up the weapon and the ammo as well hes now got a rifle in addition to the pistol. Also if possible, i can have the unit die and drop his weapons.


2) okay, so I need to change a line like

Code: Select all

SoldierHealth   = 200
into something that gives a weapon. Whats the code for a unit to gain a weapon? Is it just

Code: Select all

WeaponName         = "rep_weap_award_rifle"
?

3) As for ammo properties, I want the unit to pick up the item, not shoot at it. Is there a way to make items give different ammo types and is there a way to establish ammo types some way.

I appreciate the help.

RE: Re: RE: 2 Questions regarding changing Map Gameplay

Posted: Sun Aug 06, 2006 5:32 pm
by Qdin
how about ReserveForPlayer = "1" in the awarded .odf? :o would that work or only with the vehicles? :)

*EDIT* does anyone know a list of useable codes? :P would something like ReserveForReciever or ReserveForPickUp work? :)

RE: Re: RE: 2 Questions regarding changing Map Gameplay

Posted: Mon Aug 07, 2006 2:15 pm
by [RDH]Zerted
Most of your work is going to be done in the Luas, not the object. The object is just for show.

You need to determine, in the Lua, when a player wants to pickup the dropped item. The only way I know how to do this is by making the player destroy the pickuped object. That would trigger an ObjectKill event in the Lua. Once you determine which object it was, you give its weapon/ammo/whatever to the player which generated the event. This is done by changing class properties.

Example:

OnObjectKill(
function( object, killer )
if GetEntityClass(flyer) == FindEntityClass("pistol_pickup") then
SetProperty( GetEntityClassName(GetCharacterUnit(killer)), "WeaponName5", "all_inf_weap_pistol" )
end
end
)

Each weapon slot has a number. There are 8 total slots (4 primary and 4 secondary). WeaponName1, WeaponName2, etc...

List of usable codes: http://swbf.tightyo.com/perspective.asp ... nFileGuide

RE: Re: RE: 2 Questions regarding changing Map Gameplay

Posted: Mon Aug 07, 2006 2:50 pm
by Murdocr
off topic: if i wanted to use something in the common folder just for my map, without having to overwrite the common .lvl that shipped with the game, would that be possible? e.g what you mentioned about the pickup items, but only for my map.

RE: Re: RE: 2 Questions regarding changing Map Gameplay

Posted: Tue Aug 08, 2006 1:58 am
by [RDH]Zerted
Are you talking about the game's common or a side's common? What do you want to rewrite? I think it is possible to override any game script from a mod map, but I haven't tested it fully...

RE: Re: RE: 2 Questions regarding changing Map Gameplay

Posted: Tue Aug 08, 2006 5:27 am
by Murdocr
i mean the games common as in data_modid/common

RE: Re: RE: 2 Questions regarding changing Map Gameplay

Posted: Wed Aug 09, 2006 12:56 am
by [RDH]Zerted
Yes it should be possible, but I can't think of a reason why you would want to.

Posted: Thu Aug 10, 2006 6:37 pm
by Dabrowski
im starting to think that what I want to do is impossible or just too complicated. I guess I should do a class style game instead, that way i can have better secondary modes for all weapons. (ie- Primary has Rocket Launcher and Remote Rocket Launcher while the secondary has something else like that)

Thanks for all who helped. :D
If anyone does come up with a way, go right ahead and post it.