PDA

View Full Version : Scripting help



leorimolo
May 25th, 2009, 02:09 PM
Well this inst exactly for Halo CE but its basically the same script engine for all halo's.

(script continuous cinematic_fade_to_white
(begin
(if (and (volume_test_objects_all tv_e1_cov_inf2_2_unsafe (players)) (= (structure_bsp_index)1)))
(Begin
(Object_teleport (list_get (volume_return_objects spawn) 15) bsp2)
)
)Basically I need to know if this script would work, right now its supposed to test if there are players are in said trigger volume and if it is in the first bsp.
This would then grab all the players in the trigger volume and teleport them to a said location. I need to know if this script looks correct because I am going to manually inject it for halo 2. The only scripting program is being incredibly gay with this script.

Here is a cleaner version

(script continuous Teleporter
(begin
(if (and (volume_test_objects_all <trigger_volume> (players)) (= (structure_bsp_index)1)))
(Begin
(Object_teleport (list_get (volume_return_objects <trigger_volume>) 15) <cutscene_flag>)
)
)This is meant to be used for respawning in halo 4 player Co-Op. Since there is a set spawn on the first bsp we needed a solution that would teleport the people who respawned after the bsp changed. So we are making rally points with weapons in each bsp along with the fabricated "spawn"

leorimolo
May 26th, 2009, 11:29 AM
Anyone? Please?

L0d3x
May 26th, 2009, 11:58 AM
At first glance, I don't see anything that wouldn't make it work like you want it to. I speak of the first code you post, the second one still had syntax stuff in it...

Though I think you forgot a ")" to close your second begin.

p0lar_bear
May 26th, 2009, 01:35 PM
You're not using the if statement correctly, and you do not need to use the begin statements with your current setup. Yes, old tutorials say to put in a begin, but those are old. The only time you need to use it is when you need an if statement to execute more than one thing when the condition is met.

The syntax for if is

(if <boolean condition> <execute if true> <execute if false; optional>)

When writing a script, sometimes if statements can get messy. Personally, I like to format them like this:

(if
<boolean condition>
<execute if true>
<execute if false; optional>
)

Example:

(if
(= (+ 2 2) 5)
(print "My math is awesome!")
(begin
(print "hurf durf i am dum.")
(print "i should go bakc 2 skool.")
)
)
That previous statement will print "hurf durf i am dum. i should go bakc 2 skool." to the console while in developer mode (or Sapien).

Cleaned up script:

(script continuous Teleporter
(if
(and (volume_test_objects_all <trigger_volume> (players)) (= structure_bsp_index 1))
(object_teleport (list_get (volume_return_objects <trigger_volume>) 15) <cutscene_flag>)
)
)

e: Please tell me that you are actually putting the names of your trigger volumes and cutscene flags into the script, and you're not actually using <trigger_volume> and <cutscene_flag>.

L0d3x
May 26th, 2009, 02:11 PM
Good point on the begin stuff. But apart from a missing ")" near the end, the syntax was correct.

p0lar_bear
May 26th, 2009, 02:25 PM
His if statement would have executed nothing, he closed it before the rest of the code.

leorimolo
May 26th, 2009, 03:11 PM
Thanks on the corrections, I understand the system quite well just that I can't correct myself based on observations, and trial and error most of the time can't be done with the utterly bad tools available. Not to bash on SOL who made them, its simply very buggy to make them function for more complicated scripts. Ill try to implement this tonight on our Co-op campaign maps see if I get it all sorted out

L0d3x
May 26th, 2009, 03:20 PM
His if statement would have executed nothing, he closed it before the rest of the code.

Oh yea you're right, I overlooked one of the hooks :(

leorimolo
June 16th, 2009, 01:46 AM
One more thing, Anyone have info how you run a script from the UI like in Cold Snap where you change time of day.

leorimolo
June 16th, 2009, 02:13 PM
Up.

p0lar_bear
June 16th, 2009, 05:23 PM
The flag to make a widget execute a script was blocked out for some reason in kornman00v2. You'll need FireScythe's widget editor: http://hce.halomaps.org/index.cfm?fid=1427

Check off the "execute script" flag (or whatever it says, something like that) and then type the name of the static or dormant script you wish to execute in the field there.