Super cool idea

Super cool idea

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Super cool idea

Post by oksnoop2 »

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?
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Super cool idea

Post by MidKnight »

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?
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?
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Super cool idea

Post by manolo_ »

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)
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: Super cool idea

Post by oksnoop2 »

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.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Super cool idea

Post by KDR_11k »

oksnoop2 wrote:Could this be like a gadget?
yep. Just spawn a unit, movectrl it towards the ground and make it explode on impact, leaving the wreckage you wanted.
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: Super cool idea

Post by oksnoop2 »

Super great, is anyone writing this gadget?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Super cool idea

Post by KDR_11k »

You sound like a volunteer.
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Super cool idea

Post by SanadaUjiosan »

I'll go ahead and sound off for Snoop.

We don't have the know-how to do this.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Super cool idea

Post by PicassoCT »

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. ;)
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Super cool idea

Post by MidKnight »

SanadaUjiosan wrote:I'll go ahead and sound off for Snoop.

We don't have the know-how to do this.
Start working on it anyway, ask us whenever you need help. The only way to improve is to challenge yourself. :-)
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: Super cool idea

Post by oksnoop2 »

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.
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Super cool idea

Post by MidKnight »

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.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Super cool idea

Post by CarRepairer »

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Super cool idea

Post by PicassoCT »

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.
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: Super cool idea

Post by oksnoop2 »

CarRepairer wrote:I made you a video.

http://www.youtube.com/watch?v=szeRnfWNsBo

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
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: Super cool idea

Post by oksnoop2 »

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
Got some more help from quantum
[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
As i stated in the quote i guess i don't know what arguments are.....help me understand.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Super cool idea

Post by zwzsg »

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.
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Super cool idea

Post by quantum »

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( number unitID,
number posX, number posY, number posZ ) -> nil
This means you'll need to correct the SetPosition line to this:
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"
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: Super cool idea

Post by oksnoop2 »

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
Last edited by oksnoop2 on 13 May 2010, 22:25, edited 1 time in total.
User avatar
troycheek
Posts: 80
Joined: 22 May 2009, 19:13

Re: Super cool idea

Post by troycheek »

The infolog is your friend. It's hard to debug Lua without it. The important line from the infolog is this one:
Failed to load: spacerock.lua ([string "LuaRules/Gadgets/spacerock.lua"]:24: ')' expected (to close '(' at line 23) near 'end')
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...
function gadget:UnitCreated(unitID, unitDefID, unitTeam)
local name = UnitDefs[unitDefID].name
if (name == "meteor"
end
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.
Post Reply

Return to “Game Development”