| 
 
 
 
	
			
	
	 UPDATE, still need help spawning ACrab, need lua help. 
        
        
            | Author | Message |  
			| Foogooman 
					Joined: Sat Nov 18, 2006 8:11 pm
 Posts: 267
   |   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?
 
 
 
    							Last edited by Foogooman on Mon Aug 24, 2009 4:57 am, edited 1 time in total. 
 
 |  
			| Sat Aug 22, 2009 2:49 am | 
					
					     |  
		|  |  
			| Duh102 happy carebear mom 
					Joined: Tue Mar 04, 2008 1:40 am
 Posts: 7096
 Location: b8bbd5
   |   Re: Problem involving teams when spawning an ACrab via emitterYou have to emit a craft which has the crab in it's inventory. The craft should instagib to give you the crab posthaste. 
 
 |  
			| Sat Aug 22, 2009 2:51 am | 
					
					   |  
		|  |  
			| Geti 
					Joined: Sun Jul 13, 2008 9:57 am
 Posts: 4886
 Location: some compy
   |   Re: Problem involving teams when spawning an ACrab via emitteror use lua, to avoid the hacky-ness. 
 
 |  
			| Sat Aug 22, 2009 4:05 am | 
					
					     |  
		|  |  
			| Grif REAL AMERICAN HERO 
					Joined: Sat Jan 27, 2007 10:25 pm
 Posts: 5655
   |   Re: Problem involving teams when spawning an ACrab via emitterGeti wrote: or use lua, to avoid the hacky-ness.Lua > Abomb on the hackiness scale have you seen those topics mail makes
 
 |  
			| Sat Aug 22, 2009 4:39 am | 
					
					   |  
		|  |  
			| Geti 
					Joined: Sun Jul 13, 2008 9:57 am
 Posts: 4886
 Location: some compy
   |   Re: Problem involving teams when spawning an ACrab via emitterCode: 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
 
 
    							Last edited by Geti on Sat Aug 22, 2009 6:34 am, edited 2 times in total. 
 
 |  
			| Sat Aug 22, 2009 6:08 am | 
					
					     |  
		|  |  
			| Grif REAL AMERICAN HERO 
					Joined: Sat Jan 27, 2007 10:25 pm
 Posts: 5655
   |   Re: Problem involving teams when spawning an ACrab via emitterWell 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. 
 
 |  
			| Sat Aug 22, 2009 6:24 am | 
					
					   |  
		|  |  
			| Geti 
					Joined: Sun Jul 13, 2008 9:57 am
 Posts: 4886
 Location: some compy
   |   Re: Problem involving teams when spawning an ACrab via emitterwhoops, 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.
 
 
 |  
			| Sat Aug 22, 2009 6:36 am | 
					
					     |  
		|  |  
			| Grif REAL AMERICAN HERO 
					Joined: Sat Jan 27, 2007 10:25 pm
 Posts: 5655
   |   Re: Problem involving teams when spawning an ACrab via emitterAbomb 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). 
 
 |  
			| Sat Aug 22, 2009 6:47 am | 
					
					   |  
		|  |  
			| Geti 
					Joined: Sun Jul 13, 2008 9:57 am
 Posts: 4886
 Location: some compy
   |   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.
 
 |  
			| Sat Aug 22, 2009 8:27 am | 
					
					     |  
		|  |  
			| Grif REAL AMERICAN HERO 
					Joined: Sat Jan 27, 2007 10:25 pm
 Posts: 5655
   |   Re: Problem involving teams when spawning an ACrab via emitterHis 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.
 
 
 |  
			| Sat Aug 22, 2009 3:18 pm | 
					
					   |  
		|  |  
			| Foogooman 
					Joined: Sat Nov 18, 2006 8:11 pm
 Posts: 267
   |   Re: Problem involving teams when spawning an ACrab via emitterWell 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. 
 
 |  
			| Sat Aug 22, 2009 7:31 pm | 
					
					     |  
		|  |  
			| LowestFormOfWit 
					Joined: Mon Oct 06, 2008 2:04 am
 Posts: 1559
   |   Re: Problem involving teams when spawning an ACrab via emitterI'm curious, what exactly are you launching with this? 
 
 |  
			| Sat Aug 22, 2009 7:42 pm | 
					
					   |  
		|  |  
			| Geti 
					Joined: Sun Jul 13, 2008 9:57 am
 Posts: 4886
 Location: some compy
   |   Re: Problem involving teams when spawning an ACrab via emitterGrif 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"
 
 |  
			| Sat Aug 22, 2009 11:34 pm | 
					
					     |  
		|  |  
			| Foogooman 
					Joined: Sat Nov 18, 2006 8:11 pm
 Posts: 267
   |   Re: Problem involving teams when spawning an ACrab via emitterHmm, 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 = MOSParticlePresetName = 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.
 
 |  
			| Sun Aug 23, 2009 7:06 am | 
					
					     |  
		|  |  
			| Geti 
					Joined: Sun Jul 13, 2008 9:57 am
 Posts: 4886
 Location: some compy
   |   Re: Problem involving teams when spawning an ACrab via emittertry 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..
 
 
 |  
			| Sun Aug 23, 2009 10:03 am | 
					
					     |  
		|  |  
		|  |  
 
	
		| Who is online |  
		| Users browsing this forum: No registered users |  
 
	|  | You cannot post new topics in this forum You cannot reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot post attachments in this forum
 
 |  
   |