A Community discussion forum for Halo Custom Edition, Halo 2 Vista, Portal and Halo Machinima

Home  Search Register  Login Member ListRecent Posts
  
 
»Forums Index »Halo Custom Edition (Bungie/Gearbox) »Halo CE Technical / Map Design »Random Script?

Author Topic: Random Script? (7 messages, Page 1 of 1)
Moderators: Dennis

rerout343
Joined: Aug 7, 2010

Targeted and Firing


Posted: Feb 1, 2011 09:29 PM    Msg. 1 of 7       
Is there a way to script a random event to occur? I need a script that will spawn a weapon at random or at least simulate a random weapon spawn. I have a couple of theories on how to do this but none of them will work how I want them to.


Dwood
Joined: Oct 23, 2007

Judge Ye Therefore


Posted: Feb 1, 2011 10:13 PM    Msg. 2 of 7       
begin_random

Evaluates the expressions in random order sooo you can spawn a weapon to be one thing an then when it runs out of expressions, the weapon you have left over is what you get.

Ooor something like that, lol.


rerout343
Joined: Aug 7, 2010

Targeted and Firing


Posted: Feb 1, 2011 10:23 PM    Msg. 3 of 7       
Is there a way to end a script prematurely with a command, so that when it picks a weapon, the script will end.


Jesse
Joined: Jan 18, 2009

Discord: Holy Crust#4500


Posted: Feb 2, 2011 12:34 AM    Msg. 4 of 7       
I smell a mystery box.

Here is a script Inferno wrote for me a really long time ago. It should have the weapon rising up and changing randomly, and slowing down towards then end or somesuch.

(global short "wepnum" 0) // each number will correspond to a weapon
(global boolean "randstart" false) // when this is made true the script will run 1 time then set this back to false

(script continuous "rand wep randomizer"
(sleep_until (= randstart true) ) //when you start this script will change the number every X seconds depending on the sleeps

(device_set_power rand_control 0)
(device_set_position_immediate rand_control 0) // turns of the machine and starts the script
(start box anim)
(random_range 0 2)
(sleep 10)
(random_range 0 2)
(sleep 20)
(random_range 0 2)
(sleep 30)
(random_range 0 2)
(sleep 40)
(random_range 0 2)
(sleep 50)
(random_range 0 2)
(sleep 60) // the random part is done and it waits a while so the player can take the weapon or leave it
(stupid sound command i dont know)
(sleep 180)
(reverse the box animation)
(object_destroy_containing rand_weps)
(device_set_position_immediate rand_control 0)
(device_set_power rand_control 1)
(set randstart false)



(sleep_until (= randstart false) // waits till the script ends
)


(script continuous "rand wep ingameizer" // this bit will take the numbers generated in the randomizer and make each number create a specific weapon appear on the marker that the weapons go on
(if ( = wepnum 0) //if the number = 0 it will delete all other random weps and creates the assault rifle and attatches it to the floating marker on the box
(begin
(object_destroy_containing rand_weps)
(object_create_anew rand_weps_assaultrifle)
(objects_attatch rand_weps_assaultrifle none rand_box "floating marker")
)
)



(if ( = wepnum 1) //if the number = 1 it will delete all other random weps and creates the pistol and attatches it to the floating marker on the box
(begin
(object_destroy_containing rand_weps)
(object_create_anew rand_weps_pistol)
(objects_attatch rand_weps_pistol none rand_box "floating marker")
)
)



(if ( = wepnum 2) //if the number = 2 it will delete all other random weps and creates the sniper and attatches it to the floating marker on the box
(begin
(object_destroy_containing rand_weps)
(object_create_anew rand_weps_sniper)
(objects_attatch rand_weps_sniper none rand_box "floating marker")
)
)


)


(script continuous "rand wep intialize"
(if (device_get_position rand_control 1)
(begin (set randstart true) )
)
)





NOTE: Make all weapons named rand_wep_
EX: rand_wep_shotgun rand_wep_pistol.
This will allow you to use object_destroy_containing on them and save script space.


I hope you get this working cause I've always wanted a mystery box that works.
Edited by jesse on Feb 2, 2011 at 12:36 AM


MoooseGuy
Joined: Aug 10, 2008

I Approve This Message.


Posted: Feb 2, 2011 03:02 AM    Msg. 5 of 7       
Nice dude! it's the secret to the mystery box!


rerout343
Joined: Aug 7, 2010

Targeted and Firing


Posted: Feb 2, 2011 03:59 AM    Msg. 6 of 7       
Quote: --- Original message by: jesse

I smell a mystery box.

I hope you get this working cause I've always wanted a mystery box that works.
Edited by jesse on Feb 2, 2011 at 12:36 AM


Yes, you do.

Did you figure out that it was the mysterybox just by the nature of my question, or did you see what I've been working on recently, lol. Actually I only need to randomize one part of my script not the cycling weapons(I have another way to do that), but thank you for the script. I'll see how much of it I can use for my setup.
Edited by rerout343 on Feb 2, 2011 at 04:00 AM


MoooseGuy
Joined: Aug 10, 2008

I Approve This Message.


Posted: Feb 2, 2011 05:38 AM    Msg. 7 of 7       
Rerout, PM me your scripts.

 

 
Previous Older Thread    Next newer Thread







Time: Fri January 20, 2023 1:11 AM 156 ms.
A Halo Maps Website