Page 1 of 1

Killing & respawning 'dusteffect' objects via Lua? [Solved]

Posted: Wed Jun 11, 2014 5:00 pm
by Marth8880
Does anybody know of a way to kill and respawn a 'dusteffect' object via Lua? If not, what about moving the object to a path node? I've tried to use KillObject, RespawnObject, DeleteEntity, and SetEntityMatrix but all of them seem to output the same exact results:

Code: Select all

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(635)
Entity "lvlution_oxygen1" not found

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(635)
Entity "lvlution_oxygen2" not found

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(635)
Entity "lvlution_oxygen3" not found

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(635)
Entity "lvlution_oxygen4" not found

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(635)
Entity "lvlution_oxygen5" not found
I've also tried using various combinations of the four aforementioned callbacks with various callbacks such as GetObjectPtr, GetEntityPtr, GetEntityName, GetEntityClass, etc., but all have output those same, exact results.

The objects in Zero Editor are named "lvlution_oxygen1", "lvlution_oxygen2", "lvlution_oxygen3", "lvlution_oxygen4", and "lvlution_oxygen5".

What I basically need to have happen is for the objects' dust effects be invisible through any means necessary, but then they need to be able to become visible again later in the match, and then become visible again.

Examples of what I've tried:

Code: Select all

	oxygen1Ptr = GetEntityClass("lvlution_oxygen1")
	oxygen2Ptr = GetEntityClass("lvlution_oxygen2")
	oxygen3Ptr = GetEntityClass("lvlution_oxygen3")
	oxygen4Ptr = GetEntityClass("lvlution_oxygen4")
	oxygen5Ptr = GetEntityClass("lvlution_oxygen5")
	
	--print("object1Ptr: "..object1Ptr)
	
	Oxygen1Node = GetPathPoint("oxygen_path", 3) -- gets the path point
	Oxygen2Node = GetPathPoint("oxygen_path", 0)
	Oxygen3Node = GetPathPoint("oxygen_path", 4)
	Oxygen4Node = GetPathPoint("oxygen_path", 2)
	Oxygen5Node = GetPathPoint("oxygen_path", 1)
	OxygenDummyNode = GetPathPoint("oxygen_path", 5)
	
	SetEntityMatrix( oxygen1Ptr, OxygenDummyNode ) -- hide Levolution oxygen vacuum pfx
	SetEntityMatrix( oxygen2Ptr, OxygenDummyNode )
	SetEntityMatrix( oxygen3Ptr, OxygenDummyNode )
	SetEntityMatrix( oxygen4Ptr, OxygenDummyNode )
	SetEntityMatrix( oxygen5Ptr, OxygenDummyNode )

Code: Select all

KillObject(oxygen1Ptr)
	KillObject(oxygen2Ptr)
	KillObject(oxygen3Ptr)
	KillObject(oxygen4Ptr)
	KillObject(oxygen5Ptr)

Code: Select all

	DeleteEntity("lvlution_oxygen1")
	DeleteEntity("lvlution_oxygen2")
	DeleteEntity("lvlution_oxygen3")
	DeleteEntity("lvlution_oxygen4")
	DeleteEntity("lvlution_oxygen5")
I already have all of my timers set up and I know they work and all because the rest of my secret special concepts work perfectly fine with them, but this does not and it needs to.

Anyone have any ideas?

Re: Killing and respawning 'dusteffect' objects via Lua?

Posted: Wed Jun 11, 2014 5:16 pm
by LRKfm946
Marth8880 wrote:

Code: Select all

	oxygen1Ptr = GetEntityClass("lvlution_oxygen1")
	oxygen2Ptr = GetEntityClass("lvlution_oxygen2")
	oxygen3Ptr = GetEntityClass("lvlution_oxygen3")
	oxygen4Ptr = GetEntityClass("lvlution_oxygen4")
	oxygen5Ptr = GetEntityClass("lvlution_oxygen5")
You're using the class as the pointer, not the pointer itself. Use GetEntityPtr instead of GetEntityClass. Also, the objects are placed and alive when the round starts, right?

Re: Killing and respawning 'dusteffect' objects via Lua?

Posted: Wed Jun 11, 2014 5:18 pm
by Marth8880
LRKfm946 wrote:You're using the class as the pointer, not the pointer itself. Use GetEntityPtr instead of GetEntityClass. Also, the objects are placed and alive when the round starts, right?
Already tried that - same result. :( And yes, re: your question.

Re: Killing and respawning 'dusteffect' objects via Lua?

Posted: Wed Jun 11, 2014 5:21 pm
by LRKfm946
Interesting.. Do you get the errors the very first time you try to do anything with the objects in the LUA?

Re: Killing and respawning 'dusteffect' objects via Lua?

Posted: Wed Jun 11, 2014 5:22 pm
by Marth8880
Yes.

Re: Killing and respawning 'dusteffect' objects via Lua?

Posted: Wed Jun 11, 2014 5:24 pm
by LRKfm946
What triggers the killing/respawning of the objects?

EDIT: And have you tried every possible parameter type for the functions? (e.g. trying object name and ptr for KillObject)

Re: Killing and respawning 'dusteffect' objects via Lua?

Posted: Wed Jun 11, 2014 5:39 pm
by Marth8880
Timers.

Example:
Hidden/Spoiler:
[code] KillObject("lvlution_corridor_02_a_masseffectfield")

--Setup Levolution Timer - Pre-Destruction--

timePreDestruction = CreateTimer("timePreDestruction")
SetTimerValue(timePreDestruction, 0.2)
StartTimer(timePreDestruction)
--ShowTimer(timePreDestruction)
OnTimerElapse(
function(timer)
print("tan1n_con: Initiating Levolution pre-setup")
--RemoveRegion("lvlution_death1")
--RemoveRegion("lvlution_death2")
--RemoveRegion("lvlution_death3")
KillObject("lvlution_bldg_spacevacuum") -- kill the space vacuum auto-turrets before anyone spawns because lol no
KillObject("lvlution_bldg_spacevacuum1")
KillObject("lvlution_bldg_spacevacuum2")
KillObject("lvlution_bldg_spacevacuum3")
KillObject("lvlution_bldg_spacevacuum4")
KillObject("lvlution_bldg_spacevacuum5")
KillObject("lvlution_bldg_spacevacuum6")
KillObject("lvlution_bldg_spacevacuum7")
KillObject("lvlution_bldg_spacevacuum8")
KillObject("lvlution_bldg_spacevacuum9")
KillObject("lvlution_bldg_spacevacuum10")
KillObject("lvlution_bldg_spacevacuum11")
KillObject("lvlution_bldg_spacevacuum12")
DestroyTimer(timer)
end,
timePreDestruction
)

--Setup Levolution Timer - Hull Breach Seal--

timeCorridorSeal = CreateTimer("timeCorridorSeal")
SetTimerValue(timeCorridorSeal, 10)
ShowTimer(timeCorridorSeal)
OnTimerElapse(
function(timer)
print("tan1n_con: Initiating Levolution corridor hull breach seal")
RespawnObject("lvlution_corridor_02_a_masseffectfield")
--KillObject("lvlution_bldg_spacevacuum")
KillObject("lvlution_bldg_spacevacuum1")
KillObject("lvlution_bldg_spacevacuum2")
KillObject("lvlution_bldg_spacevacuum3")
KillObject("lvlution_bldg_spacevacuum4")
--KillObject("lvlution_bldg_spacevacuum5")
KillObject("lvlution_bldg_spacevacuum6")
KillObject("lvlution_bldg_spacevacuum7")
KillObject("lvlution_bldg_spacevacuum8")
KillObject("lvlution_bldg_spacevacuum9")
KillObject("lvlution_bldg_spacevacuum10")
KillObject("lvlution_bldg_spacevacuum11")
KillObject("lvlution_bldg_spacevacuum12")
KillObject("lvlution_oxygen1")
KillObject("lvlution_oxygen2")
KillObject("lvlution_oxygen3")
KillObject("lvlution_oxygen4")
KillObject("lvlution_oxygen5")
--[[SetEntityMatrix( "lvlution_oxygen1", OxygenDummyNode )
SetEntityMatrix( "lvlution_oxygen2", OxygenDummyNode )
SetEntityMatrix( "lvlution_oxygen3", OxygenDummyNode )
SetEntityMatrix( "lvlution_oxygen4", OxygenDummyNode )
SetEntityMatrix( "lvlution_oxygen5", OxygenDummyNode )]]
SetProperty("blastbar1", "IsLocked", "0") -- unlock the doors
SetProperty("blasteng2", "IsLocked", "0")
SetProperty("blasteng1", "IsLocked", "0")
SetProperty("lpodroom1", "IsLocked", "0")
SetProperty("engine01", "IsLocked", "0")
SetProperty("lpodroom2", "IsLocked", "0")
SetProperty("techroom1", "IsLocked", "0")
SetProperty("tan4_prop_door5", "IsLocked", "0")
SetProperty("tan4_prop_door1", "IsLocked", "0")
SetProperty("tan4_prop_door4", "IsLocked", "0")
SetProperty("lpodroom3", "IsLocked", "0")
SetProperty("techroom2", "IsLocked", "0")
SetProperty("rpodroom2", "IsLocked", "0")
SetProperty("rpodroom1", "IsLocked", "0")
SetProperty("rpodroom1f", "IsLocked", "0")
DestroyTimer(timer)
end,
timeCorridorSeal
)

--Setup Levolution Timer - Destruction--

timeCorridorDestruct = CreateTimer("timeCorridorDestruct")
SetTimerValue(timeCorridorDestruct, 20)
StartTimer(timeCorridorDestruct)
ShowTimer(timeCorridorDestruct)
OnTimerElapse(
function(timer)
print("tan1n_con: Initiating Levolution corridor destruction")
KillObject("lvlution_corridor_02_a")
SetProperty("lvlution_weaponrecharge5", "AddHealth", 0)
SetProperty("blastbar1", "IsLocked", "1") -- lock the doors!
SetProperty("blasteng2", "IsLocked", "1")
SetProperty("blasteng1", "IsLocked", "1")
SetProperty("lpodroom1", "IsLocked", "1")
SetProperty("engine01", "IsLocked", "1")
SetProperty("lpodroom2", "IsLocked", "1")
SetProperty("techroom1", "IsLocked", "1")
SetProperty("tan4_prop_door5", "IsLocked", "1")
SetProperty("tan4_prop_door1", "IsLocked", "1")
SetProperty("tan4_prop_door4", "IsLocked", "1")
SetProperty("lpodroom3", "IsLocked", "1")
SetProperty("techroom2", "IsLocked", "1")
SetProperty("rpodroom2", "IsLocked", "1")
SetProperty("rpodroom1", "IsLocked", "1")
SetProperty("rpodroom1f", "IsLocked", "1")
KillObject("lvlution_weaponrecharge5")
AddDeathRegion("lvlution_death1")
AddDeathRegion("lvlution_death2")
AddDeathRegion("lvlution_death3")
--RespawnObject("lvlution_bldg_spacevacuum")
RespawnObject("lvlution_bldg_spacevacuum1") -- purge the corridors because space reasons
RespawnObject("lvlution_bldg_spacevacuum2")
RespawnObject("lvlution_bldg_spacevacuum3")
RespawnObject("lvlution_bldg_spacevacuum4")
--RespawnObject("lvlution_bldg_spacevacuum5")
RespawnObject("lvlution_bldg_spacevacuum6")
RespawnObject("lvlution_bldg_spacevacuum7")
RespawnObject("lvlution_bldg_spacevacuum8")
RespawnObject("lvlution_bldg_spacevacuum9")
RespawnObject("lvlution_bldg_spacevacuum10")
RespawnObject("lvlution_bldg_spacevacuum11")
RespawnObject("lvlution_bldg_spacevacuum12")
RespawnObject("lvlution_oxygen1") -- simulate oxygen and junk being sucked out of the corridors
RespawnObject("lvlution_oxygen2")
RespawnObject("lvlution_oxygen3")
RespawnObject("lvlution_oxygen4")
RespawnObject("lvlution_oxygen5")
--[[SetEntityMatrix( "lvlution_oxygen1", Oxygen1Node )
SetEntityMatrix( "lvlution_oxygen2", Oxygen2Node )
SetEntityMatrix( "lvlution_oxygen3", Oxygen3Node )
SetEntityMatrix( "lvlution_oxygen4", Oxygen4Node )
SetEntityMatrix( "lvlution_oxygen5", Oxygen5Node )]]

StartTimer(timeCorridorSeal)
ShowTimer(timeCorridorSeal)
DestroyTimer(timer)
end,
timeCorridorDestruct
)[/code]
In regards to your second question, yeah, using the object names was the first thing I tried. :o


EDIT:

Here's the dusteffect object ODF:
Hidden/Spoiler:
[code][GameObjectClass]

ClassLabel = "dusteffect"
GeometryName = "hoth_prop_dust.msh"
GeometryScale = 0.5


[Properties]

MinPos = "-3 0 20"
MaxPos = "3 18 20"
MinVel = "0 0 -40"
MaxVel = "0 0 -50"
MinSize = "6"
MaxSize = "9"
MinLifeTime = "1"
MaxLifeTime = "2"
Alpha = "1.0"
NumParticles = "120"
MaxDistance = "180"
Texture = "oxygen"
SpawnSound = ""[/code]

Re: Killing and respawning 'dusteffect' objects via Lua?

Posted: Thu Jun 12, 2014 3:30 pm
by LRKfm946
That's pretty wierd. You could try doing everything purely via LUA (if you haven't already); delete the objects in ZE and spawn them in using CreateEntity. The only think I can make of this is that maybe when you place the objects in ZE, it treats them as environmental effects, which can't be altered after loading, rather than treating them as objects.

Re: Killing & respawning 'dusteffect' objects via Lua? [Solv

Posted: Fri Jun 13, 2014 11:54 am
by Marth8880
I've decided to just use a mixture of auto-firing auto-turrets and their ordnance with the effect as a trail effect. It works perfectly. :) Here's the ODFs and FX file if anybody cares:

lvlution_bldg_oxygenfx.odf
Hidden/Spoiler:
[code][GameObjectClass]
ClassLabel = "armedbuilding"
GeometryName = "editor_lvlution_spacevacuum.msh"

[Properties]



BUILDINGSECTION = "BODY"

PilotType = "self"

Label = "artillery_dummy"

MapTexture = ""
MapScale = "0.0"
HealthTexture = "HUD_kam_turret_icon"

GeometryName = "lvlution_bldg_spacevacuum"
ExplosionName = "lvlution_bldg_spacevacuum_exp"

DestroyedGeometryName = "lvlution_bldg_spacevacuum"

MaxHealth = "999999.9"
//AddHealth = "999999.9"

RespawnTime = "999999.9"

HideHealthBar = 1

AutoBarrierEnable = 0
AutoBarrierRemoveOnDeath = 1
AutoBarrierSize = 2.0

BUILDINGSECTION = "TURRET1"



PilotType = "self"

TurretNodeName = "hp_turret"

PitchLimits = "0 0"
YawLimits = "0 0"

PitchTurnFactor = "0.0"

EyePointOffset = "0.0 1.5 1"
TrackCenter = "0.0 1.5 -2.0"
TrackOffset = "0.0 0.75 2.0"
TiltValue = "0.0"

ThirdPersonFOV = "65"

MaxTurnSpeed = "5.0"
MaxPitchSpeed = "5.0"
//PitchRate = "1.0" // this in the code is the same as MaxTurnSpeed !
//TurnRate = "1.5" // this in the code is the same as MaxPitchSpeed !
PCMaxPitchSpeed = "5.0"
PCMaxTurnSpeed = "5.0"
TrackCenter = "0.0 8.0 5.0"
TrackOffset = "0.0 -7.0 10.0"

BuildingCollisionPrim = "BldgBox1 box 0.0 0.0 0.5 0.0 0.5 0.5 0.5"

BuildingCollision = "p_-bt_cylinder"
TerrainCollision = "p_-bt_cylinder"


TURRETSECTION = "TURRET1"

WeaponName = "lvlution_weap_bldg_oxygenfx"
WeaponAmmo = "0"

Controllable = "0" //<<IMPORTANT!!!
AutoFire = "1" //<<IMPORTANT!!!

AimerNodeName = "hp_aimer"

AimerPitchLimits = "0 0"
AimerYawLimits = "0 0"

FirePointName = "hp_fire"

//TurretAmbientSound = "emergency_siren_5_layered"


BUILDINGSECTION = "TURRET2"

PilotType = "self"

TurretNodeName = "hp_turret1"

PitchLimits = "0 0"
YawLimits = "0 0"

PitchTurnFactor = "0.0"

EyePointOffset = "0.0 1.5 1"
TrackCenter = "0.0 1.5 -2.0"
TrackOffset = "0.0 0.75 2.0"
TiltValue = "0.0"

ThirdPersonFOV = "65"

MaxTurnSpeed = "5.0"
MaxPitchSpeed = "5.0"
//PitchRate = "1.0" // this in the code is the same as MaxTurnSpeed !
//TurnRate = "1.5" // this in the code is the same as MaxPitchSpeed !
PCMaxPitchSpeed = "5.0"
PCMaxTurnSpeed = "5.0"
TrackCenter = "0.0 8.0 5.0"
TrackOffset = "0.0 -7.0 10.0"


TURRETSECTION = "TURRET2"

WeaponName = "lvlution_weap_bldg_null"
WeaponAmmo = "0"

Controllable = "0" //<<IMPORTANT!!!
AutoFire = "1" //<<IMPORTANT!!!

AimerNodeName = "hp_aimer1"

AimerPitchLimits = "0 0"
AimerYawLimits = "0 0"

FirePointName = "hp_fire1"


BUILDINGSECTION = "TURRET3"

PilotType = "self"

TurretNodeName = "hp_turret2"

PitchLimits = "0 0"
YawLimits = "0 0"

PitchTurnFactor = "0.0"

EyePointOffset = "0.0 1.5 1"
TrackCenter = "0.0 1.5 -2.0"
TrackOffset = "0.0 0.75 2.0"
TiltValue = "0.0"

ThirdPersonFOV = "65"

MaxTurnSpeed = "5.0"
MaxPitchSpeed = "5.0"
//PitchRate = "1.0" // this in the code is the same as MaxTurnSpeed !
//TurnRate = "1.5" // this in the code is the same as MaxPitchSpeed !
PCMaxPitchSpeed = "5.0"
PCMaxTurnSpeed = "5.0"
TrackCenter = "0.0 8.0 5.0"
TrackOffset = "0.0 -7.0 10.0"


TURRETSECTION = "TURRET3"

WeaponName = "lvlution_weap_bldg_null1"
WeaponAmmo = "0"

Controllable = "0" //<<IMPORTANT!!!
AutoFire = "1" //<<IMPORTANT!!!

AimerNodeName = "hp_aimer2"

AimerPitchLimits = "0 0"
AimerYawLimits = "0 0"

FirePointName = "hp_fire2"[/code]
lvlution_weap_bldg_oxygenfx.odf
Hidden/Spoiler:
[code][WeaponClass]
ClassLabel = "cannon"

[Properties]
GeometryName = ""
HighResGeometry = ""

OrdnanceName = "lvlution_weap_bldg_oxygenfx_ord"

TriggerSingle = "0"
ShotDelay = "0.05"
MaxPressedTime = "0.0"

LockOnRange = "150.0"
LockTime = "0.0"
AutoAimSize = "2.0"

SalvoCount = "1"
ShotsPerSalvo = "1"
SalvoDelay = "0.0"
SalvoTime = "0.0"
InitialSalvoDelay = "0.0"

TargetEnemy = "1"
TargetNeutral = "1"
TargetFriendly = "1"

TargetPerson = "1"
TargetAnimal = "1"
TargetDroid = "1"
TargetVehicle = "1"
TargetBuilding = "1"

AITargetPerson = "1"
AITargetAnimal = "1"
AITargetDroid = "1"
AITargetVehicle = "1"
AITargetBuilding = "1"

BarrageMin = "1000"
BarrageMax = "1000"
BarrageDelay = "0"

RoundsPerClip = "0"
ReloadTime = "0.0"

HeatPerShot = "0.0"
HeatRecoverRate = "1.0"
HeatThreshold = "0.0"

//SOUND
FireSound = ""
ReloadSound = ""
WeaponChangeSound = ""
ChangeModeSound = ""
FireEmptySound = ""
ChargeSound = ""
ChargeSoundPitch = "0.05"
OverheatSound = ""
OverheatSoundPitch = "0.5"
OverheatStopSound = ""

[/code]
lvlution_weap_bldg_oxygenfx_ord.odf
Hidden/Spoiler:
[code][OrdnanceClass]
ClassLabel = "missile"

[Properties]
TrailEffect = "lvlution_oxygen_vacuum_trail"

Damage = "0.0"

Velocity = "100.0"
Gravity = "0.0"
Rebound = "0.0"
Friction = "1.0"
LifeSpan = "0.7"

TurnRate = "0.0"
WaverRate = "0.0"
WaverTurn = "0.0"

VehicleScale = "1.0"
PersonScale = "1.0"
DroidScale = "1.0"
ShieldScale = "1.0"
AnimalScale = "1.0"
BuildingScale = "1.0"

OrdnanceSound = ""
CollisionOtherSound = ""

BonusAmplification = "0.25" //how much more damage will be done when team_bonus_blaster_amplication is on[/code]
lvlution_oxygen_vacuum_trail.fx
Hidden/Spoiler:
[code]ParticleEmitter("Oxygen")
{
MaxParticles(2.0000,3.0000);
StartDelay(0.0000,0.0000);
BurstDelay(0.7000, 0.7000);
BurstCount(2.0000,3.0000);
MaxLodDist(5000.0000);
MinLodDist(4000.0000);
BoundingRadius(200.0);
SoundName("")
NoRegisterStep();
Size(1.0000, 1.0000);
Hue(255.0000, 255.0000);
Saturation(255.0000, 255.0000);
Value(255.0000, 255.0000);
Alpha(255.0000, 255.0000);
Spawner()
{
Spread()
{
PositionX(0.0000,0.0000);
PositionY(0.0000,0.0000);
PositionZ(0.0000,0.0000);
}
Offset()
{
PositionX(0.0000,0.0000);
PositionY(-8.0000,-6.0000);
PositionZ(0.0000,0.0000);
}
PositionScale(0.0000,0.0000);
VelocityScale(40.0000,40.7000);
InheritVelocityFactor(0.0000,0.0000);
Size(0, 5.5000, 7.5000);
Red(0, 255.0000, 255.0000);
Green(0, 255.0000, 255.0000);
Blue(0, 255.0000, 255.0000);
Alpha(0, 64.0000, 64.0000);
StartRotation(0, 180.0000, 360.0000);
RotationVelocity(0, 1000.0000, 1000.0000);
FadeInTime(0.0000);
}
Transformer()
{
LifeTime(0.7000);
Position()
{
LifeTime(0.7000)
Scale(0.0000);
}
Size(0)
{
LifeTime(1.4000)
Scale(1.0000);
}
Color(0)
{
LifeTime(0.5500)
Reach(255.0000,255.0000,255.0000,64.0000);
Next()
{
LifeTime(0.1500)
Move(-255.0000,-255.0000,-255.0000,-64.0000);
}
}
}
Geometry()
{
BlendMode("NORMAL");
Type("PARTICLE");
Texture("oxygen");
}
}
[/code]