Data Realms Fan Forums
http://45.55.195.193/

Small Script Requests
http://45.55.195.193/viewtopic.php?f=75&t=19275
Page 1 of 1

Author:  BrainChild [ Sun Jul 18, 2010 10:44 am ]
Post subject:  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

Author:  Geti [ Sun Jul 18, 2010 12:11 pm ]
Post subject:  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.

Author:  411570N3 [ Sun Jul 18, 2010 12:18 pm ]
Post subject:  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.

Author:  Geti [ Sun Jul 18, 2010 12:21 pm ]
Post subject:  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.

Author:  BrainChild [ Sun Jul 18, 2010 1:20 pm ]
Post subject:  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

Author:  Geti [ Sun Jul 18, 2010 9:50 pm ]
Post subject:  Re: Small Script Requests

To your ACrab turret?

Author:  BrainChild [ Mon Jul 19, 2010 2:14 pm ]
Post subject:  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

Author:  BrainChild [ Sun Jul 25, 2010 1:57 pm ]
Post subject:  Re: Small Script Requests

Bump and double post

Author:  Geti [ Mon Jul 26, 2010 1:35 am ]
Post subject:  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

Author:  BrainChild [ Mon Jul 26, 2010 2:52 pm ]
Post subject:  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

Author:  BrainChild [ Sun Aug 08, 2010 3:50 pm ]
Post subject:  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

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