Super cool idea
Moderator: Moderators
Super cool idea
http://springrts.com/phpbb/viewtopic.php?f=14&t=12096
http://springrts.com/phpbb/viewtopic.php?f=13&t=22568
It would be super cool if these two things could be combined into one. Like rocks that fall from the sky and potentially damage your units. Then using peons you could harvest the rocks for metal. Anything been done like that?
http://springrts.com/phpbb/viewtopic.php?f=13&t=22568
It would be super cool if these two things could be combined into one. Like rocks that fall from the sky and potentially damage your units. Then using peons you could harvest the rocks for metal. Anything been done like that?
Re: Super cool idea
CA's Core zenith superweapon fires asteroids. This attack could very easily be modified so that it seems like a random environmental event. Lua to make the asteroids drop metal features on impact would be very easy (I could write it if you're going to use the feature somewhere). Is there anything else you would need to make this work?oksnoop2 wrote:http://springrts.com/phpbb/viewtopic.php?f=14&t=12096
http://springrts.com/phpbb/viewtopic.php?f=13&t=22568
It would be super cool if these two things could be combined into one. Like rocks that fall from the sky and potentially damage your units. Then using peons you could harvest the rocks for metal. Anything been done like that?
Re: Super cool idea
that was requested for jools map (a remake of an ice/water OTA map), where ice comets should come from the sky, also they should be reclaimable then (maybe contact him for that)
Re: Super cool idea
So would this be something that's mod specific or map specific? OR would it just be a modified unit. I was really just wanting a different way to collect metal for CT and this way sounds awesome. Could this be like a gadget? Sorry for my ignorance, outside of simple unitdefs, lua confuses me.
Re: Super cool idea
yep. Just spawn a unit, movectrl it towards the ground and make it explode on impact, leaving the wreckage you wanted.oksnoop2 wrote:Could this be like a gadget?
Re: Super cool idea
Super great, is anyone writing this gadget?
Re: Super cool idea
You sound like a volunteer.
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Super cool idea
I'll go ahead and sound off for Snoop.
We don't have the know-how to do this.
We don't have the know-how to do this.
Re: Super cool idea
This idea came from sky like a monthly topic rotation, it was so cool, it froze over its own development.
+1 to meteors from me. It will kill those dinos strollin over the map.
+1 to meteors from me. It will kill those dinos strollin over the map.
Re: Super cool idea
Start working on it anyway, ask us whenever you need help. The only way to improve is to challenge yourself.SanadaUjiosan wrote:I'll go ahead and sound off for Snoop.
We don't have the know-how to do this.
Re: Super cool idea
Uh ok, Is there some similar gadget i can look at? Or anything really? I just don't think i can start with a blank text file.
Re: Super cool idea
If I were you, I'd begin with a gadget that spawns a feature when a weapon hits or a unit dies (depending on how you want to implement the meteor). That can be achieved easily enough by modifying the gadget I used to make the CA concept blastwing spawn a mine on death. That gadget is available here.
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Super cool idea
Super cool idea frozze forum allover, now it is a superconductor making the supercoolidea hanging suspended in the air, in eternal levitation, till hell freezes over. But Undo My Post, i dare you.
Re: Super cool idea
Yeah that's basically want i want, rocks to randomly fall from the sky damage units then spawn a reclaimable wreck. I thought about just doing it privately but i guess i'll open it up to public ridicule, might get done faster that way. I can't stress this enough. I don't know what i'm doing.
Code: Select all
-- $Id$
function gadget:GetInfo()
return {
name = "Space Rock",
desc = "Spawns rocks from space.",
author = "oksnoop2",
date = "4/24/2010",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = false, -- loaded by default?
}
end
if (not gadgetHandler:IsSyncedCode()) then
return false -- no unsynced code
end
local oldUnitName = "spacerock"
local testUnitName = "spacerockwreck"
local testUnitDefID = UnitDefNames[testUnitName].id
function gadget:UnitCreated(unitID, unitDefID, unitTeam)
local name = UnitDefs[unitDefID].name
if (name == "spacerock"
end
function gadget:UnitDestroyed(unitID, unitDefID, unitTeam)
if UnitDefNames[oldUnitName].id == unitDefID then
local x, y, z = Spring.GetUnitPosition(unitID)
Spring.CreateUnit(testUnitName, x, y, z, 0, unitTeam)
end
end
ok so i think i need to use movecrtl........somewhere... can someone show me an example of it from a preexisting gadget
Re: Super cool idea
Code: Select all
-- $Id$
function gadget:GetInfo()
return {
name = "Space Rock",
desc = "Spawns rocks from space.",
author = "oksnoop2",
date = "4/24/2010",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = false, -- loaded by default?
}
end
if (not gadgetHandler:IsSyncedCode()) then
return false -- no unsynced code
end
local oldUnitName = "meteor"
local testUnitName = "meteorwreck"
local testUnitDefID = UnitDefNames[testUnitName].id
function gadget:UnitCreated(unitID, unitDefID, unitTeam)
local name = UnitDefs[unitDefID].name
if (name == "spacerock"
end
function gadget:UnitDestroyed(unitID, unitDefID, unitTeam)
if UnitDefNames[oldUnitName].id == unitDefID then
local x, y, z = Spring.GetUnitPosition(unitID)
Spring.CreateUnit(testUnitName, x, y, z, 0, unitTeam)
end
end
function gadget:GameFrame(frame)
if frame % 30 == 0 then -- every second
local x = math.random(Game.mapSizeX)
local z = math.random(Game.mapSizeZ)
local unitID = Spring.CreateUnit("meteor", x, 0, z, "n", Spring.GetGaiaTeamID)
Spring.MoveCtrl.Enable(unitID)
Spring.MoveCtrl.SetPosition(x, Spring.GetGroundHeight(x, z) + 10000, z)
Spring.MoveCtrl.SetGravity(1)
end
end
As i stated in the quote i guess i don't know what arguments are.....help me understand.[14:50:00] <[LCC]quantum[0K]> try something like this: http://pastebin.com/Vg9gSK4M
[14:50:17] <[LCC]quantum[0K]> havent tried it myself, not guaranteed to work or even compile
[14:50:57] <[LCC]quantum[0K]> oh, setposition and set gravity need an unitID argument too
[15:05:14] <oksnoop2> stupid question: what's a unitID agrument (i failed programming)
[15:08:58] <Regret> better question would be: what's an argument?
[15:09:55] <oksnoop2> i'll take answers to eitehr
[15:10:36] <oksnoop2> *either
Re: Super cool idea
Don't you have a math teacher at school to which you could ask these questions? Or else use the google, a bookstore, or whatever, to get an introduction to programming. You're not asking question relating to Spring, nor even lua, but about basic concepts even non-programmers would take for granted.
Then after typing that, I tried googling some Lua tutorial and had a hard time finding a useful one. Maybe try this one: http://lua.gts-stolberg.de/en/index.php
And remember that whenever a Lua tutorial tells you to use print, replace it with Spring.Echo
Yes, I do know you Spring redirects Lua's print to stdout, but I'm talking to someone who doesn't even know what's an argument, so stfu about that.
Then after typing that, I tried googling some Lua tutorial and had a hard time finding a useful one. Maybe try this one: http://lua.gts-stolberg.de/en/index.php
And remember that whenever a Lua tutorial tells you to use print, replace it with Spring.Echo
Yes, I do know you Spring redirects Lua's print to stdout, but I'm talking to someone who doesn't even know what's an argument, so stfu about that.
Re: Super cool idea
An argument is a variable you give to a function, for example in Spring.GetUnitPosition(unitID), unitID is the argument.
The docs ( http://springrts.com/wiki/Lua_MoveCtrl, http://springrts.com/wiki/Lua_Scripting ) tell you what arguments a "Spring." function takes. For example:
Spring.MoveCtrl.SetPosition(unitID, x, Spring.GetGroundHeight(x, z) + 10000, z)
SetGravity need to be corrected too.
Also, replace "meteor" with a valid unit name, one that you can get with "/cheat" "/give mymeteorname"
The docs ( http://springrts.com/wiki/Lua_MoveCtrl, http://springrts.com/wiki/Lua_Scripting ) tell you what arguments a "Spring." function takes. For example:
This means you'll need to correct the SetPosition line to this:Spring.MoveCtrl.SetPosition( number unitID,
number posX, number posY, number posZ ) -> nil
Spring.MoveCtrl.SetPosition(unitID, x, Spring.GetGroundHeight(x, z) + 10000, z)
SetGravity need to be corrected too.
Also, replace "meteor" with a valid unit name, one that you can get with "/cheat" "/give mymeteorname"
Re: Super cool idea
Ok finally started working on this again, had to make a tactical retreat in the face of overwhelming self doubt and school finals but that's over now. So here's where i stand, it's failing to load.
http://pastebin.com/Q2ZaLGtg --Infolog
http://pastebin.com/TwdAnxQy --Gadget
http://pastebin.com/Q2ZaLGtg --Infolog
http://pastebin.com/TwdAnxQy --Gadget
Last edited by oksnoop2 on 13 May 2010, 22:25, edited 1 time in total.
Re: Super cool idea
The infolog is your friend. It's hard to debug Lua without it. The important line from the infolog is this one:
This tells us to look around lines 23 or 24 for a missing ')' somewhere near an 'end' statment. A good editor that uses line numbers is also your friend. Looking at those lines leads us to...Failed to load: spacerock.lua ([string "LuaRules/Gadgets/spacerock.lua"]:24: ')' expected (to close '(' at line 23) near 'end')
... where we see an incomplete 'if/then' statement that is indeed missing a ')' and, we might also notice, the 'then' as well. Also missing is whatever you wanted this function to do if the name was indeed meteor.function gadget:UnitCreated(unitID, unitDefID, unitTeam)
local name = UnitDefs[unitDefID].name
if (name == "meteor"
end
end