Author |
Message |
BrainChild
Joined: Sun May 23, 2010 7:11 pm Posts: 193
|
Small Script Requests
I decided to make a small script request thread , because it will clutter up the requests if we make a new topic every time we need a small script so here it goes
#1 - A script that I can attach to a turret that will make the turret search for a actor in it's team within 100 pixels and aim in that direction at 45' and wait 3 seconds and then fire , should loop so that if the actor stays there it should fire every 3 seconds , should not run the script if the turret is controlled by a human player Why I need it - I am planning to make a turret that fires small clay discs that you can shoot , for practicing you aim and testing new weapons
Ideas mentioned in this thread are not to be copied and distributed as your own , if you really want to use the ideas please give credit
Thanks in advance
Last edited by BrainChild on Sun Jul 18, 2010 1:23 pm, edited 2 times in total.
|
Sun Jul 18, 2010 10:44 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Small Script Requests
This is fine. A more general thread could be a good idea, unless that's the idea of this (ie a place everyone can ask for quick script help). Code: function Update(self) --search through the list of actors for actor in MovableMan.Actors do --if they're on our team then... if actor.Team == self.Team then --check how close they are, if it's under 100px... if SceneMan:ShortestDistance(self.Pos,actor.Pos,true).Magnitude < 100 then --aim at them self.SetAimAngle(math.atan2(self.Pos.X-actor.Pos.X,self.Pos.Y-actor.Pos.Y); break; --DONT DO IT MORE THAN ONCE end end end end Not sure how the atan2 stuff will work out, if someone knows it needs adjusting please correct me. Should be fine though.
|
Sun Jul 18, 2010 12:11 pm |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Small Script Requests
Problem is, that the result would prioritise based on the order of appearance of the actor on the scene, which is fairly arbitrary.
|
Sun Jul 18, 2010 12:18 pm |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Small Script Requests
indeed it would. you can do the whole curdist thing, but really, 100px is pretty small as far as distance checks go on a normal CC map.
|
Sun Jul 18, 2010 12:21 pm |
|
|
BrainChild
Joined: Sun May 23, 2010 7:11 pm Posts: 193
|
Re: Small Script Requests
Geti wrote: This is fine. A more general thread could be a good idea, unless that's the idea of this (ie a place everyone can ask for quick script help). A general thread it is will edit OP also where do I attach it
|
Sun Jul 18, 2010 1:20 pm |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Small Script Requests
To your ACrab turret?
|
Sun Jul 18, 2010 9:50 pm |
|
|
BrainChild
Joined: Sun May 23, 2010 7:11 pm Posts: 193
|
Re: Small Script Requests
A based my turret of the dummy one there is a acrab but it does nothing , the turret is still stationary
|
Mon Jul 19, 2010 2:14 pm |
|
|
BrainChild
Joined: Sun May 23, 2010 7:11 pm Posts: 193
|
Re: Small Script Requests
Bump and double post
|
Sun Jul 25, 2010 1:57 pm |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Small Script Requests
The turret should be stationary, and I don't think the script will work when you're controlling it. hit ~ for any errors. I can't debug it without some feedback
|
Mon Jul 26, 2010 1:35 am |
|
|
BrainChild
Joined: Sun May 23, 2010 7:11 pm Posts: 193
|
Re: Small Script Requests
NO errors , tried attaching it to the acrab and the turret did nothing I was not controling the turret when I was testing
|
Mon Jul 26, 2010 2:52 pm |
|
|
BrainChild
Joined: Sun May 23, 2010 7:11 pm Posts: 193
|
Re: Small Script Requests
#1 - a script that I can use to spawn a TDexplosive after a set amount off time if possible could it be attached to a MOSR/MOSP that is a child object of a bunker module - if the MOSR/MOSP is destroyed the spawning should stop #2 - a script that spawns MOSParticles and them moves it (if the MOSP has a life time it should still apply ) attached to a ACrab or MOSP - if the main MOSP is destroyed it should stop spawning
|
Sun Aug 08, 2010 3:50 pm |
|
|
|