Region deactivation codes
Moderator: Moderators
- linksith
- Command Sergeant Major

- Posts: 284
- Joined: Mon Jul 12, 2010 12:19 pm
- Projects :: Waaay too many projects
- xbox live or psn: me has no xbox
- Location: looking for a wifi connection
Region deactivation codes
Hi, I want certain transporter regions to be de-activated and a death region to be activated when an object is destroyed. I also want the regions to be re-activated and the death region to be deactivated whenthe object is repaired. Can someone give me the code to do this? Thanks.
- bobfinkl
- Rebel Colonel

- Posts: 593
- Joined: Sun Jul 13, 2008 9:01 am
- Projects :: Lots of unreleased stuff
- xbox live or psn: No gamertag set
- Location: The quaint little city gametoast.
Re: Region deactivation codes
That's a HUGE amount of code you want. I won't write it all out for you but I'll tell you you will be needing to use if then statements. The actual specific codes can be looked up in the lua documentation provided with the modtools, codes such as OnCharacterDeath are ones you will be using.
- Firefang
- Major

- Posts: 518
- Joined: Mon Nov 15, 2010 8:55 pm
- Location: California
Re: Region deactivation codes
Something like this (this is off the top of my head so there may be some bugs)
Code: Select all
Kill = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "objectname" then
DeactivateRegion("teleportregion")
ActivateRegion("deathregion")
end
end
)
Respawn = OnObjectRespawn(
function(object)
if GetEntityName(object) == "objectname" then
ActivateRegion("teleportregion")
DeactivateRegion("deathregion")
end
end
)- linksith
- Command Sergeant Major

- Posts: 284
- Joined: Mon Jul 12, 2010 12:19 pm
- Projects :: Waaay too many projects
- xbox live or psn: me has no xbox
- Location: looking for a wifi connection
Re: Region deactivation codes
Ok so I added the code and modified some of it. It won't work. Here is my LUA and a message severity 3 error.
--
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to call global `GetEnitityName' (a nil value)
stack traceback:
(none): in function <(none):95>
--
Hidden/Spoiler:
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to call global `GetEnitityName' (a nil value)
stack traceback:
(none): in function <(none):95>
- Firefang
- Major

- Posts: 518
- Joined: Mon Nov 15, 2010 8:55 pm
- Location: California
Re: Region deactivation codes
Replace
With
Code: Select all
GetEntityName(computer)Code: Select all
GetEntityName(object) == "computer"- linksith
- Command Sergeant Major

- Posts: 284
- Joined: Mon Jul 12, 2010 12:19 pm
- Projects :: Waaay too many projects
- xbox live or psn: me has no xbox
- Location: looking for a wifi connection
Re: Region deactivation codes
The error message is gone but the regions won't deactivate.
Updated LUA
Updated LUA
Hidden/Spoiler:
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: Region deactivation codes
I'm not even sure if the ActivateRegion and the DeactivateRegion functions even do work the way their names suggest. For death regions, though, you should use the AddDeathRegion function.
-
THEWULFMAN
- Space Ranger
- Posts: 5557
- Joined: Tue Aug 17, 2010 3:30 pm
- Projects :: Evolved 2
- Location: Columbus, Ohio
- Contact:
Re: Region deactivation codes
AQT wrote:I'm not even sure if the ActivateRegion and the DeactivateRegion functions even do work the way their names suggest.
Not exactly as their names suggest no. They can't turn regions of and of dynamically. For instance, you couldn't turn on and off rainshadow regions at will, but you can turn generic regions that have no special attributes on and off, like a capture region.
- linksith
- Command Sergeant Major

- Posts: 284
- Joined: Mon Jul 12, 2010 12:19 pm
- Projects :: Waaay too many projects
- xbox live or psn: me has no xbox
- Location: looking for a wifi connection
Re: Region deactivation codes
So then how will I disable the transporter regions?
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: Region deactivation codes
Off-topic: Capture regions are assigned or unassigned to CP's but not activated or deactivated.
ActivateRegion seems to only work with the OnEnterRegion function.
Code: Select all
SetProperty("cp1", "CaptureRegion", "cp1_capture")
SetProperty("cp1", "CaptureRegion", "")- DarthD.U.C.K.
- Master of the Force

- Posts: 6027
- Joined: Wed Sep 27, 2006 11:05 am
- Location: Duckburg, Germany
Re: Region deactivation codes
you know, you can actually try to figure something out yourself, its possible!linksith wrote:So then how will I disable the transporter regions?
as previously said, you cannot deactivate a region. you can only disable and enable whether the "onenterregion"-events are triggered when a region is entered, with ActivateRegion and DeactivateRegion.
there is also a command "RemoveRegion" but i dont know if it can really remove any region.
- linksith
- Command Sergeant Major

- Posts: 284
- Joined: Mon Jul 12, 2010 12:19 pm
- Projects :: Waaay too many projects
- xbox live or psn: me has no xbox
- Location: looking for a wifi connection
Re: Region deactivation codes
I just tried figuring out on my own but I got stumped, I can't figure it out. A little more help please?
