Page 1 of 1
How do I script this?
Posted: Mon Aug 02, 2010 12:28 am
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...
Re: How do I script this?
Posted: Mon Aug 02, 2010 9:34 am
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.
Re: How do I script this?
Posted: Mon Aug 02, 2010 11:08 am
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.
Re: How do I script this?
Posted: Mon Aug 02, 2010 3:04 pm
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.
Re: How do I script this?
Posted: Mon Aug 02, 2010 6:26 pm
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.
Re: How do I script this?
Posted: Tue Aug 03, 2010 3:23 pm
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?
Re: How do I script this?
Posted: Tue Aug 03, 2010 4:38 pm
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:
Re: How do I script this?
Posted: Tue Aug 03, 2010 9:24 pm
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.
)
Re: How do I script this?
Posted: Wed Aug 04, 2010 5:00 am
by DarthD.U.C.K.
callbacks should be the conditions under which the ambush/whatever starts
Re: How do I script this?
Posted: Thu Aug 05, 2010 7:37 pm
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.