[Halp] Result happens before unit is done building

[Halp] Result happens before unit is done building

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

[Halp] Result happens before unit is done building

Post by Forboding Angel »

https://code.google.com/p/evolutionrts/ ... lector.lua

I need this to check if the unit that has "cancollect" is finished building before it takes effect.

Preferably before tomorrow (tomorrow is a gameday) and I just realized that this was a problem. In the heat of battle you could have a con start building one of these and insta reclaim or convert to drones, without actually having to finish building it.

I can haz halp? I did try to mangle it using logic from another gadget, but I couldn't figure out how to properly implement it.
Last edited by Forboding Angel on 11 Oct 2013, 21:25, edited 1 time in total.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: [Halp] Result happens before unit is done building

Post by FLOZi »

Code: Select all

if UnitDefs[Spring.GetUnitDefID(unit)].customParams.cancollect and select(5, Spring.GetUnitHealth(unit)) == 1 then
Ugly but, w/e
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Halp] Result happens before unit is done building

Post by Forboding Angel »

FLOZi wrote:

Code: Select all

if UnitDefs[Spring.GetUnitDefID(unit)].customParams.cancollect and select(5, Spring.GetUnitHealth(unit)) == 1 then
Ugly but, w/e
You can do that?

I agree that it isn't pretty like what I was trying to mangle out of smoth's code, but at the same time, if it works, I'm not going to complain. I discovered this at the 11th hour, so to speak, so I'm in panic mode atm.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: [Halp] Result happens before unit is done building

Post by FLOZi »

Should be fine though I can't quite remember if it needs to be 1 or 0; 1 would be most logical, but, this is Spring. 8)
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Halp] Result happens before unit is done building

Post by Forboding Angel »

Hehehe :-D

Works perfectly, thanks. I was really worried about this. It seems that some of the people who play evo will exploit bugs repeatedly, even if they are super broken and refuse to ignore those exploits when playing vs others.

Basically, some people like to be complete and total assholes. Shocker.

Thanks :-D
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: [Halp] Result happens before unit is done building

Post by Google_Frog »

That fix isn't particularly ugly. It would be nicer to add valid units to a table in UnitFinished and remove them when destroyed.

Also I wouldn't call your players assholes. They don't know exactly what your design is, this bug barely breaks anything and it not feasible to avoid exploiting this bug (what if you actually want to build an Orb?).
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Halp] Result happens before unit is done building

Post by Forboding Angel »

I said, "some of the people". Being an in this case isn't necessarily a bad thing, it just means that you like to win, regardless of whether something is totally broken or not.

As to this not being a serious exploit...

Actually, it is. If after a battle, you were to start building an orb in the center of all those cores lying around, you could easily wind up with 100+ metal and energy and you could simply pop the orb construction and not lose the 40 metal spent on the orb. So yeah, it's a pretty serious thing.

Also, I'm talking about people who continue to exploit it even after the fact that it is a bug has been established, forcing me to release a new version on the spot, which causes the host to have to empty out, etc etc. When, instead, they could just not exploit it and save everyone the trouble.

But no, one jerk causes issues for everyone else. It's a very not nice thing to do in that situation.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: [Halp] Result happens before unit is done building

Post by Google_Frog »

From your post I infer that Orbs can now be built outside of factories. I did not know this.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Halp] Result happens before unit is done building

Post by Forboding Angel »

Ahh ok, that puts what you were saying in an entirely different perspective. Gotcha :-)

Edit: Yeah, I'm little by little shifting the focus of gameplay from being forced to be so reliant on hovers. Orbs being built in the field just kind of makes sense really.
Post Reply

Return to “Lua Scripts”