Data Realms Fan Forums
http://45.55.195.193/

UPDATE, still need help spawning ACrab, need lua help.
http://45.55.195.193/viewtopic.php?f=1&t=16319
Page 1 of 3

Author:  Foogooman [ Sat Aug 22, 2009 2:49 am ]
Post subject:  UPDATE, still need help spawning ACrab, need lua help.

Alright, so I am making this drone launcher. So I made a copy of the drone but set the team to 0. 0 being the human team in single player(right?). Well, despite the fact that the drone is on my team, my guys still shoot it and it shoots my guys. AND, I set the drone AIMode to 4 so that it will brainhunt automatically. However... it seems to want to hunt MY brain every time. So it clearly isn't working properly, which brings me to my next question. When it DOES work, what happens if there isn't an enemy brain and it is set to AImode = 4? Will it hunt a friendly brain, and if it would, is there any way around that besides changing the AImode?

So yeah, how can I get it to be on my team and hunt enemy brains?

Author:  Duh102 [ Sat Aug 22, 2009 2:51 am ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

You have to emit a craft which has the crab in it's inventory. The craft should instagib to give you the crab posthaste.

Author:  Geti [ Sat Aug 22, 2009 4:05 am ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

or use lua, to avoid the hacky-ness.

Author:  Grif [ Sat Aug 22, 2009 4:39 am ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

Geti wrote:
or use lua, to avoid the hacky-ness.


Lua > Abomb on the hackiness scale

have you seen those topics mail makes

Author:  Geti [ Sat Aug 22, 2009 6:08 am ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

Code:
crab = CreateACrab("<presetname of crab>", "<module of crab>.rte")
crab.Pos = whatever, probably the particle you're using's Pos
local box = Box((self.Pos-Vector(40,40)),(self.Pos+Vector(40,40))
for actor in MovableMan.Actors do
if box:WithinBox(actor.Pos) then
self.parent = actor
end
end
crab.Team = self.parent.Team
crab.Vel = self.Vel

doesnt seem hacky to me. if you want to make it more interference-proof (ie make it so point-blanking someone doesnt end in you getting eaten) you can add some distance comparison check, for now its just basic boxes.

edit: added local, fixed box defining, thanks grif

Author:  Grif [ Sat Aug 22, 2009 6:24 am ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

Well your box defining is ♥♥♥♥, but I'd just like to point out that the same thing is possible with a ludicrous amount of .ini code. Somewhere around 25 lines for the dropship and all related gun code.

Author:  Geti [ Sat Aug 22, 2009 6:36 am ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

whoops, thanks for that.
also, you'd need the instagib emitter and all, but i know what youre getting at. the ABomb methond just seems less reliable than this to me.

Author:  Grif [ Sat Aug 22, 2009 6:47 am ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

Abomb method is by its very nature exactly as reliable as this. And you don't need an insta-gib emitter if you just give it enough impulse to instantly gib on creation (with ludicrously small gibimpulselimit).

Author:  Geti [ Sat Aug 22, 2009 8:27 am ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

*concedes defeat*
this was my initial point.
Grif wrote:
I'd just like to point out that the same thing is possible with a ludicrous amount of .ini code.
but if its doable with as few as 25 lines, and you prefer the ABomb method then whatever, go with that. you just dont get the right team if you play as greenies with the ABomb method, which was kinda the initial point, unless i'm mistaken.

Author:  Grif [ Sat Aug 22, 2009 3:18 pm ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

His original point was they were spawning as team -1, it would seem, or at least automatic brainhunt non-friendly actors.

Which is pretty much why the abomb method ever existed.

Author:  Foogooman [ Sat Aug 22, 2009 7:31 pm ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

Well I'm not very good with lua so I couldn't get the script to work so right now I am just using a TDExplosive to summon it. If someone wants to go into more detail about how to get the code to work though, I would prefer that.

Author:  LowestFormOfWit [ Sat Aug 22, 2009 7:42 pm ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

I'm curious, what exactly are you launching with this?

Author:  Geti [ Sat Aug 22, 2009 11:34 pm ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

Grif wrote:
His original point was they were spawning as team -1, it would seem, or at least automatic brainhunt non-friendly actors.

yes, but it only lets you spawn actors of one team.

here, put this in a .lua file and add it to any particle you want to fire as a round. it doesnt matter what it is. you just need to add the PresetName of the ACrab (likely "Drone" or something) to the first red highlighted bit. then get whatever your module name is and put it in the second one, with the .rte (for example "Dummy.rte" if this script were part of the dummy faction).
the comments should help you understand what the script is doing. please note you might need to set AIMODEs and the like, see the luadocs for how to do that.
LowestFormOfWit wrote:
I'm curious, what exactly are you launching with this?
OP Says "Drone Launcher"

Author:  Foogooman [ Sun Aug 23, 2009 7:06 am ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

Hmm, I still have some problems with it.

I have a gun which fires a MOSParticle, and I put the script on the MOSParticle, and I think everything is set right and there aren't any console errors, but the script doesn't seem to be taking effect at all. The MOSParticle fired doesn't even dissapear like the script says it should.

When I fire, the object just comes out and that's it, no crab and it doesn't delete itself.

In the code it looks like

Code:
AddEffect = MOSParticle
   PresetName = Drone Delivery 3
   ScriptPath = CoalitionPunisher.rte\Devices\Weapons\DroneLauncher\Drone.lua
   Mass = 3
   GlobalAccScalar = -0.3


And Drone.lua contains:
Code:
function Create(self)
   --create the crab
   local crab = CreateACrab("Drone 2", "CoalitionPunisher.rte")
   --position it
   crab.Pos = self.Pos
   --create a box for finding who shot us.
   local box = Box((self.Pos-Vector(40,40)),(self.Pos+Vector(40,40))
   --look at all the actors on the scene
   for actor in MovableMan.Actors do
      --if they are within the box
      if box:WithinBox(actor.Pos) then
         -- they are our parent! assign this
         self.parent = actor
      end
   end
   --make the crab the same team as our parent
   crab.Team = self.parent.Team
   --give it the same velocity as the particle that spawned it
   crab.Vel = self.Vel
   --add it to the game
   MovableMan:AddActor(crab)
   --delete ourself.
   self.ToDelete = true
end


So I'm not sure what's wrong with it.

Author:  Geti [ Sun Aug 23, 2009 10:03 am ]
Post subject:  Re: Problem involving teams when spawning an ACrab via emitter

try replacing "Create" with "Update"
if no console errors are happening i didnt make a silly typo somewhere, so the script probably isnt getting run.
that and also: are you sure you're firing the right particle, it seems you have 3..

Page 1 of 3 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/