Page 1 of 8

[Resources] Script Library

Posted: Fri Nov 03, 2006 6:57 pm
by -DeToX-
Well I don't think anyone has done this yet, but to help some people out, I made this topic. Basically what you will do is post any scripts that you may find useful (Big Scripts, Small Useful ones), That everyone will be able to use pubically for their mods(As long as they give credit). So Instead of having scripts in many topics split all over, post any scripts here so that other users may learn from them or them.

These are resources for the Halo 2 Engine. Therefore in my opinion, should be kept.

This Topic May Be Used For:
-Script Posting
-Getting Scripts
-Requesting Scripts
-Script Help(We may fix your scripts.)
I'll start the topic with a simple script.

Random Gravity(Changes randomly in game):

Code: Select all

(script continuous random_gravity 
  (begin 
   (physics_set_gravity 0.5) 
   (sleep (random_range 900 1800)) 
    (begin 
     (begin_random 
      (begin 
       (print "stopping") 
       (physics_set_gravity 1 (random_range 10 20)) 
       (sleep (random_range 900 1800)) 
       (print "restarting") 
       (physics_set_gravity 0.5 (random_range 10 20)) 
       (sleep (random_range 900 1800))
      ) 
       (begin 
        (print "light grav") 
        (physics_set_gravity 0.8 (random_range 10 20)) 
        (sleep (random_range 900 1800))
       ) 
        (begin 
         (print "light grav") 
         (physics_set_gravity 0.1 (random_range 10 20)) 
         (sleep (random_range 900 1800))
        ) 
         (begin 
          (print "heavy grav") 
          (physics_set_gravity 2 (random_range 10 20)) 
          (sleep (random_range 900 1200)) 
          (physics_set_gravity 0.4 (random_range 10 20)) 
          (sleep (random_range 900 1200))
         )
        )
       )
      )
)
In Order to make the above script work, replace your db.txt(In your ScriptTools folder with this one.
Everyone Else post yours to help the community.

Also... Post Saying...
<Name>
<Description>
<How To Use(If Needed)>
<Script>

That way it is organized.

Posted: Fri Nov 03, 2006 6:59 pm
by foxfanatic23I7
Awsome idea for the scripts libary, and a GREAT way to start off the libary as well :)

Posted: Fri Nov 03, 2006 7:05 pm
by CptnNsan0
Im just getting into scripting so give me soem time and i will post my first one

Posted: Fri Nov 03, 2006 7:11 pm
by Agent ME
AI Respawn script. Make sure to put the name of your ai squad replacing 'aisquad'

Code: Select all

(script continuous aisquad_respawn
  (begin
    (sleep_until (<= (ai_living_count aisquad) 0))
    (sleep (* 5 30))
    (ai_place aisquad)
  )
)
You can replace the 5 in there with how many seconds you want the game to wait before respawning the squad.

Posted: Fri Nov 03, 2006 7:13 pm
by -DeToX-
Great thanks for contributing. :)

Posted: Fri Nov 03, 2006 7:16 pm
by Soldier of Lite
Great idea. Here's an interesting one for you guys to play with:

Code: Select all

(object_create gun)
(weapon_hold_trigger gun 0 true)
(sleep x)
(weapon_hold_trigger gun 0 false)
(object_destroy gun)
Makes an instance of the script object "gun" and fires it for x seconds, then deletes it. This is how the SP scarab guns work.

Also, all of these scripts can be compiled using my new program ScriptTools ;).

Posted: Fri Nov 03, 2006 7:17 pm
by foxfanatic23I7
Thats so cool sol, thanks for that one!

Posted: Fri Nov 03, 2006 7:18 pm
by Agent ME
Too bad that wouldn't sync up right in system link - as far as I can tell from my tests, local object weapons don't appear to the clients unless its in someone's hands, and they disappear after a while like a gun that was moved.

Posted: Fri Nov 03, 2006 7:20 pm
by snakejknight
hey detox, not sure wats up but whenever i try to use ur script i get an error :(

Posted: Fri Nov 03, 2006 7:32 pm
by -DeToX-
My bad... My database was being gay for that script... If you want to compile that one... Ill upload my database for you to use...(Replace your current db.txt with this one:

Posted: Fri Nov 03, 2006 7:32 pm
by latinomodder

Code: Select all

(script continuous Sputnik
  (begin
   
(sleep_until unit_has_weapon objects\weapons\multiplayer\ball\head_sp.weapon) )

(physics_set_gravity 0.5)

(print "Sputnik") 
)
I don't know but it should work if you bring over the SP head. This is done to recreate sputnik.

Posted: Fri Nov 03, 2006 7:35 pm
by Agent ME
That script won't work at all. Look at this part:

Code: Select all

(unit_has_weapon objects\weapons\multiplayer\ball\head_sp.weapon)
unit_has_weapon takes more than one parameter.

MP maps don't have "objects\weapons\multiplayer\ball\head_sp.weapon" in them, so you'll need to use "objects\weapons\multiplayer\ball\head.weap"

And it's a bit redundant - why did you bother with the or in there?

Posted: Fri Nov 03, 2006 7:39 pm
by latinomodder
I know you need the SP head I mentioned it in the post. Fixed it up a little sorry I had in in a txt document and just copied over

Posted: Fri Nov 03, 2006 7:39 pm
by Soldier of Lite
That also won't work because you're missing the unit to check for the weapon.

Posted: Fri Nov 03, 2006 7:46 pm
by -DeToX-
Fixed Latinomodders script:

Code: Select all

(script continuous Sputnik
  (begin
(sleep_until (unit_has_weapon <scriptunit> objects\weapons\multiplayer\ball\ball.weap) (unit_has_weapon <scriptunit>  objects\weapons\multiplayer\ball\ball.weap) 1)
(physics_set_gravity 0.5)
(print "Sputnik")
  )
)
It will Set the gravity as 0.5 when the oddball is picked up. Where it says <scriptunit> you replace it with your actual script unit

Posted: Fri Nov 03, 2006 7:53 pm
by PyroBlizzard
Just for an idea MB you could have an archive in first post of what scripts are in here.

Posted: Fri Nov 03, 2006 7:55 pm
by -DeToX-
PyroBlizzard wrote:Just for an idea MB you could have an archive in first post of what scripts are in here.
But i just posted the topic and I got some scripts, eventually It will grow too much it people keep posting.

Posted: Fri Nov 03, 2006 7:57 pm
by Loonycgb2
woh it works really good my scripts r working

Posted: Fri Nov 03, 2006 7:59 pm
by -DeToX-

Code: Select all

(script continuous teleporter
 (begin
  (object_teleport (list_get (volume_return_objects <trigger_volume>) 0) <cutscene_flag>)
 )
)
SoL: ta da
SoL: it will teleport any object that goes into the zone :roll:

Posted: Fri Nov 03, 2006 8:05 pm
by PyroBlizzard
-DeToX- wrote:

Code: Select all

(script continuous teleporter
 (begin
  (object_teleport (list_get (volume_return_objects <trigger_volume>) 0) <cutscene_flag>)
 )
)
SoL: ta da
SoL: it will teleport any object that goes into the zone :roll:
So could u make that so if i went a certain area in a MP level say..(foundation room1) it would teleport me to the center of the map?