controlling team spawn

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
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

controlling team spawn

Post by ZoomV »

So I have this conquest map with two local teams, one friendly to ATT the other to DEF. I'm trying to set it up to where the team friendly to ATT only spawns if ATT's reinforcement's are below DEF's and if DEF's reinforcements are above 30. Vise Versa applies to the local's friend to DEF.

LUA seems like witchcraft to me, so I am hoping one of you guys might have advice.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: controlling team spawn

Post by AQT »

Here's a very similar code that you can use as a base: http://www.gametoast.com/viewtopic.php?p=328409#p328409
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

Re: controlling team spawn

Post by ZoomV »

AQT wrote:Here's a very similar code that you can use as a base: http://www.gametoast.com/viewtopic.php?p=328409#p328409
<_<
>_>
huh, I completely blanked on there being a GetReinforcementCount call. I was trying to do something crazy with OnTicketCountChange.


Anyways, is there a way to print a message in the log so I can have it tell me when it does its thing, and what syntax would be necessary to get said log message also print the reinforcements at that point?
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: controlling team spawn

Post by Marth8880 »

ZoomV wrote:Anyways, is there a way to print a message in the log so I can have it tell me when it does its thing, and what syntax would be necessary to get said log message also print the reinforcements at that point?
Sure. The function you're looking for is print(). Here's its usage:

Code: Select all

i = "Hello World!";
print(i); -- prints "Hello World!" (without quotes)
Or you could use Lua's concatenate, which is .. (two periods) to bind parts together:

Code: Select all

i = "Hello World!";
print("Message: "..i); -- prints "Message: Hello World!" (without quotes)
And here's an example from MEU of printing multiple variables in the same function call:

Code: Select all

	local screenWidth, screenHeight = ScriptCB_GetScreenInfo()
	local aspectRatio = screenWidth / screenHeight
		print("ME5_MiscFunctions:    Width: "..screenWidth.."    Height: "..screenHeight.."    Aspect Ratio: "..aspectRatio)
The idea is you're printing a string directly with quotations in the print() function, or you're printing a variable, or both.

In your case, you'd want to assign the result of GetReinforcementCount to a variable, and then print that variable (possibly with a message for organization/clarity reasons).
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: controlling team spawn

Post by [RDH]Zerted »

Don't use concatenate, use commas instead. If you try to concatenate a nil value it'll crash. It doesn't crash if you use commas.

Examples:

Code: Select all

print('Team: ', DEF, 'count:', GetReinforcementCount(DEF))

local impCount = GetReinforcementCount(IMP)
print('Team:', IMP, 'count:', impCount)
In Lua you can use ' or " for string (but not both at the same time: 'this is wrong").
Post Reply