How do I script this?

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
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

How do I script this?

Post by wishihadaname »

I'm concidering ressurecting Landing at Point Rain. Its a shame really, its sitting in my C drive 75% done, I am bored out of my mind cas' I have nothing to do, and i'm preatty sure I made some people cry when I stopped updating for like 3 months... Anyhow, before I can officially restart the project, I need a bit of help with bringing some of my ideas into BFII script.

1) How do I make an ambush tied to a looping timer? As in, have a timed ambush that spawns units say every five minutes and repeats this six times? I already know how to set up a timed ambush, but they are a one time deals. Having six of them on overlapping timers would be too bulky and complicated.

2) Do any of you have the spare time and expertiece to be my modeler? I cannot for the love of God get my computer to export anything to .msh, and besides, my graphic design skills are an abomination...
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: How do I script this?

Post by DarthD.U.C.K. »

1) i would make a second timer that starts when the first elapses and is set to 0 after 5 minutes. whenever its 1 you let the ambush spawn. to let it spawning 6 times only i would make a variable and increase it by 1 everytime the ambush is spawned.
User avatar
linksith
Command Sergeant Major
Command Sergeant Major
Posts: 284
Joined: Mon Jul 12, 2010 12:19 pm
Projects :: Waaay too many projects
Games I'm Playing :: too many
xbox live or psn: me has no xbox
Location: looking for a wifi connection

Re: How do I script this?

Post by linksith »

I would reccomend putting your second question in the All Purpose Request Thread http://www.gametoast.com/forums/viewtop ... 25&t=18018. I haven't been able to convert to mesh either but you won't get anyone to do the job if you ask in the wrong area.
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: How do I script this?

Post by wishihadaname »

I also came up with another idea to get hte battle effect. Why not have an "on enter area" kind of setup. Basically set an area for each of the four hubs, when the player enters, 60 reps and 150 ish droids spawn to make the area feel like the center of the battle. The ambush itself would be easy to make, what I was wondering was how to link an animation to a timed ambush. It would have to work like this

player enters region -> Animation starts/ ambush is on a timer -> when gunships/transports hit the ground the ambush spawns-> endcode.
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: How do I script this?

Post by [RDH]Zerted »

When the timer ends, simple restart it from inside the timer elapse function. To keep track of how many times it has run, use a variable and increase it by one each time the timer elapses. When it it reaches six times ran, just don't restart the timer.
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: How do I script this?

Post by wishihadaname »

what about the second setup? Is there a tut somewhere for on enter region or should I just improv based off of shipped level codes?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: How do I script this?

Post by Maveritchell »

wishihadaname wrote:Is there a tut somewhere for on enter region or should I just improv based off of shipped level codes?
Using the shipped scripts as an example is always a good idea, but your first question makes me wonder whether you searched at all to find the answer:
Hidden/Spoiler:
Image
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: How do I script this?

Post by wishihadaname »

I knew about that one, I haven't looked at it yet though. I was wondering if anyonw had a tut specifically dealing with multifunctional regions. I know, need to check FAQ before I ask arround...


Also, I'm a bit unclear about what some of this means, i'll just explain it as I understand it and I would appreciate it if someone could correct me if i'm wrong.

--from Maveritchell's example--

ActivateRegion("regionname") <-- name of region ingame
testfunction = OnEnterRegion( <-- The "testfunction" is just a name given to this function
function(region, player) <-- Does function need to be changed or is it part of the code, I assume region needs to be the name of the region?
if [whatever callbacks you want] then <-- What exactly is a callback?
whatvever you want to happen <--I assume you remove the brakets and put the ambush on a timer and animation start here
end
end,
"regionname" <-- name of region ingame.
)
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: How do I script this?

Post by DarthD.U.C.K. »

callbacks should be the conditions under which the ambush/whatever starts
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: How do I script this?

Post by [RDH]Zerted »

testfunction is a variable which holds what the OnEnterRegion() function returns. It is like x = 3. x is testfunction and 3 is OnEnterRegion().

The function(region,player) ... end is a new function you are creating. Due to the way it is being created, it doesn't have a name. region and player are the two parameters to the function. As with all parameters, you can name them whatever you want. This function is the callback function. When someone enters any region (unless you provide a filter), the function will be called with the region that was entered and with the player that entered it.

The if ... then ... end statement is just code inside the callback function.

"regionname" is the second parameter to OnEnterRegion() (the callback function is the first parameter). If you read the scripting doc, you'll see that the second parameter is a 'filter'. The callback function won't be called unless the entering region's name is the same as the second parameter.

If that confuses you more, just forget it all for now.
Post Reply