On destroy, capture
Moderator: Moderators
- Lorul1
- Rebel Colonel

- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
On destroy, capture
I'm was looking back at this and I wanted to make an on destroy capture (change command post 8 from team 2 to team 1) script. But theres one big obstical in my way ... my only LUA experience other than mod tools is roblox
. So how would a script like this be done. Thanks in advance.
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: On destroy, capture
Second tutorial: Instead of triggering an animation, you want to trigger a SetProperty. First tutorial: Use SetProperty to change the team number of command post 8 from 2 to 1.
- Lorul1
- Rebel Colonel

- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
Re: On destroy, capture
okay this is my lua after function ScriptPostLoad()
animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "myg1_bldg_energy_collector_core" then
Setproperty("CP5", "Team", 1)
end
end
)
just trying to make cp5 team 1's after the myg1_bldg_energy_collector_core is destroyed
i know its wrong but can someone please correct it (AQT sorry i couldent under stand the post)
animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "myg1_bldg_energy_collector_core" then
Setproperty("CP5", "Team", 1)
end
end
)
just trying to make cp5 team 1's after the myg1_bldg_energy_collector_core is destroyed
i know its wrong but can someone please correct it (AQT sorry i couldent under stand the post)
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: On destroy, capture
It is only wrong if "myg1_bldg_energy_collector_core" and "CP5" aren't the correct names of the objects you want to reference. Have you tested the code out to see if it works or not?
- Lorul1
- Rebel Colonel

- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
Re: On destroy, capture
I tested it and it dosent work. I knew my script wouldn't work in the first place because I used the on destroy, animate script and just changed some things. those other post that you linked me to dident help. I just need a on destroy change cp5 to team 1 script that I can put in my Lua, or an on destroy capture script someone els has in there Lua that works so for my perfect map to be complete 
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: On destroy, capture
Um, what?
You used a "On destroy, stuff you choose to happen happens" script. Period. That's what it is. The "specialized" scripts you are looking for don't exist. It should work if you referenced the ZE object names correctly. This also means the names are case sensitive. And what do you mean the other post I linked you to didn't help? You used the information contained in it, although not correctly I just noticed. It should be SetProperty, not Setproperty.
- Lorul1
- Rebel Colonel

- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
Re: On destroy, capture
I tested my scrip above and but changed my old Setproperty to SetProperty with a capital P put my script in my lua after conquest:Start , and when I destroy the energy collector cp5 won't become team 1's command post . can some put my script above into there Lua and try to get it to work then repost the revised script here
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: On destroy, capture
Please post your entire lua file, as well as screenshots of "CP5" and "myg1_bldg_energy_collector_core" in ZE, both highlighted, of course.
- Lorul1
- Rebel Colonel

- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
Re: On destroy, capture
ok i had to use my ipod to take the screenshots i know there's a way to take screenshots with zero edit but its okay
My lua (DONT STEAL my lua or ill hire cad bane on you
) (no im serious dont steal my lua)
http://www.mediafire.com/download/8dxzix9acuwzz6i/gametoast.rar
my here are my pictures both cp5 and the energy core are in conquest and when i destroy the core cp5 dosent become team ones command post.
were did i go wrong
My lua (DONT STEAL my lua or ill hire cad bane on you
Hidden/Spoiler:
my here are my pictures both cp5 and the energy core are in conquest and when i destroy the core cp5 dosent become team ones command post.
were did i go wrong
- lucasfart
- Sith

- Posts: 1440
- Joined: Tue Feb 24, 2009 5:32 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Australia
Re: On destroy, capture
A tip with the pictures. You could always use the print screen button to take a snapshot then copy and paste it somewhere. Its a LOT clearer to read. And when you've got the pics, save them somewhere like imageshack.us so that you don't have to create an extra download for people...
Also, have you tried referring to "cp5" with lowercase? That's the way they seem to be referred to at the top of the lua....
And a quick question - does the lua require the NAME of the object, or the LABEL? Because you haven't got a label for the myg1 prop...
Also, have you tried referring to "cp5" with lowercase? That's the way they seem to be referred to at the top of the lua....
And a quick question - does the lua require the NAME of the object, or the LABEL? Because you haven't got a label for the myg1 prop...
Last edited by lucasfart on Thu Aug 22, 2013 9:50 pm, edited 1 time in total.
- Lorul1
- Rebel Colonel

- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
Re: On destroy, capture
Yes I have but is the script correct?
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: On destroy, capture
animateobja is a variable. It cannot be equal to three different things at the same time, which is what you currently have it set up as. That's why your new code is being ignored.
- Lorul1
- Rebel Colonel

- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
Re: On destroy, capture
Well is there a variable or some thing that can equal 3 things or is there a way how to make my script equal 2 things and work? A better question would be how do i set up what i want . Sorry I don't know too much about Lu's
Last edited by Lorul1 on Thu Aug 22, 2013 10:03 pm, edited 1 time in total.
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: On destroy, capture
I see... A variable can be anything as long as it starts with a letter. So use a unique variable for each of the functions...
- Lorul1
- Rebel Colonel

- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
Re: On destroy, capture
Umm okay so if it starts with a number My lua will work? Man I'm 14 I don't know one bit of Lua all I know is hello world. I don't know what variabul is I don't know what a function is. All I know is that it I don't have this working my map can't be complet. Okay will I have to make a new scrip or is there one out there that I can copy and just change. Or can I change my own to work.
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: On destroy, capture
No, you can't use a number because it is not a letter. You don't have to know Lua programming to know what a variable is. The concept of a variable is taught in basic Algebra, which most people take in middle school. Here, just use this:
Hidden/Spoiler:
- Lorul1
- Rebel Colonel

- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
Re: On destroy, capture
So if I put the the first one that says moe in my lua my plan (when energy collector is destroys cp5 becomes team 1s ) WILL work (btw I knew what a variable was only I thought it meant something els in lua
)
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: On destroy, capture
Yes, basically. The other two (Larry and Curly) will also work on their own too, unlike before when they were all named animateobja (only Curly was working, then, since the other two got ignored for sharing the same variable name).
- Lorul1
- Rebel Colonel

- Posts: 562
- Joined: Wed Apr 24, 2013 10:34 pm
- Projects :: Assault on Theed
- xbox live or psn: No gamertag set
- Location: Your House
Re: On destroy, capture
Thanks so much aqt . I will try to get this to work tomorrow . I can add a [Solved] to my once I've confirmed what you said worked 
Edit: Okay I guess I asked for the wrong type of script. See when I made this post this is what i was thinking in basic terms: if got this script to work in my map, when I destroy the energy collector, cp5 will become team 1s command post . since cp5 is the last command post and team one has took all the command post the "victory" countdown will start and team one will win. But that was not the case simpily because the victory countdown will not start when I use the "Moe" (SetProperty) script AQT gave me. The MOE script worked but it dident do what I thought it would ultimately do wich was give victory to team one. With much apology I now ask is there any way how I can tweek the "Moe" script to give team 1 ( wich would be the republic) victory I was thinking something like drop the droids reinforcement count to zero. Now once again I don't know Lua so someone would have to show me how that's done . So you could explain to me if how to convert the moe (SetProperty) script into a when energy collector is destroyed give team 1 (republic) victory script. it dosent matter what form of script you use as long as it works
Edit: I just noticed that I double posted.I won't do it again
Edit: Okay I guess I asked for the wrong type of script. See when I made this post this is what i was thinking in basic terms: if got this script to work in my map, when I destroy the energy collector, cp5 will become team 1s command post . since cp5 is the last command post and team one has took all the command post the "victory" countdown will start and team one will win. But that was not the case simpily because the victory countdown will not start when I use the "Moe" (SetProperty) script AQT gave me. The MOE script worked but it dident do what I thought it would ultimately do wich was give victory to team one. With much apology I now ask is there any way how I can tweek the "Moe" script to give team 1 ( wich would be the republic) victory I was thinking something like drop the droids reinforcement count to zero. Now once again I don't know Lua so someone would have to show me how that's done . So you could explain to me if how to convert the moe (SetProperty) script into a when energy collector is destroyed give team 1 (republic) victory script. it dosent matter what form of script you use as long as it works
Edit: I just noticed that I double posted.I won't do it again
- lucasfart
- Sith

- Posts: 1440
- Joined: Tue Feb 24, 2009 5:32 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Australia
Re: On destroy, capture
I think this is the line you want:
Just change DEF to whatever your team number is (or use Def/Att). Hopefully that works. 
I'd really encourage you to do a bit of a search before posting questions like this as there's a pretty good chance you'll find the answer. For example THIS topic has everything you need for victory in it.
Code: Select all
MissionVictory(DEF)I'd really encourage you to do a bit of a search before posting questions like this as there's a pretty good chance you'll find the answer. For example THIS topic has everything you need for victory in it.
