Scripted explosions?

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
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Scripted explosions?

Post by SkinnyODST »

Am I able to script a small explosion to happen in a certain spot on the map that only explodes once then stops? Kind of like a timer but with a grenade explosion or something. If so how?
User avatar
Oceans14
Command Sergeant Major
Command Sergeant Major
Posts: 296
Joined: Mon Apr 27, 2015 7:09 pm
Projects :: Athenova Campaign
Games I'm Playing :: SWBF2
Location: Planet 4546b

Re: Scripted explosions?

Post by Oceans14 »

Sure you can. Set the odf up like the kashyyyk beach explosion, place it where you want it in ZE, and then in your script add the line ActivateObject("NAME"). You could put that line in several different places depending on the desired behavior (on enter region, on timer elapse, on objective complete, etc). As for getting it to go once and then stop, play around with the values in the explosion odf. I don't recall but I think one of them dictates how often the effect is played.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Scripted explosions?

Post by AQT »

Alternatively, create a destructible invisible prop that explodes when destroyed. Use either:

Code: Select all

SetProperty("name_of_object_in_ze", CurHealth, 0)
SetProperty("name_of_object_in_ze", MaxHealth, 1+e37)
or

Code: Select all

KillObject("name_of_object_in_ze")
as the conclusion of your timer elapsing or whatever you want to use as your scripted event.
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Scripted explosions?

Post by SkinnyODST »

AQT wrote:Alternatively, create a destructible invisible prop that explodes when destroyed. Use either:

Code: Select all

SetProperty("name_of_object_in_ze", CurHealth, 0)
SetProperty("name_of_object_in_ze", MaxHealth, 1+e37)
or

Code: Select all

KillObject("name_of_object_in_ze")
as the conclusion of your timer elapsing or whatever you want to use as your scripted event.
Where do I put the timer in the lua? Can you give an example of how it looks in the lua, as well as telling me how to make an object invisible? I just put it after "function ScriptPostLoad()" and it can`t read the lua right.
- my code:
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()

timername= CreateTimer("timername")
SetTimerValue(timername, (25))
StartTimer(timername)
OnTimerElapse(KillObject("kas2_bldg_oilrefinery")
function(timer)

DestroyTimer(timer)
end,
timername
)


SetClassProperty("cis_inf_rifleman", "NoEnterVehicles", "1")


--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "cp5"} etc.
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: Scripted explosions?

Post by Marth8880 »

KillObject("kas2_bldg_oilrefinery") needs to go after function(timer).
Post Reply