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 »[Script]Theoretically This Should Work Right?

Author Topic: [Script]Theoretically This Should Work Right? (11 messages, Page 1 of 1)
Moderators: Dennis

Co1t3r
Joined: Dec 13, 2008


Posted: Jan 30, 2010 04:28 PM    Msg. 1 of 11       
I'm trying to fix the server problems in lolcano, but I had to redo the script.
(script continuous killtrigger
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 0)))
(unit_kill (unit (list_get (players) 0)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 1)))
(unit_kill (unit (list_get (players) 1)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 2)))
(unit_kill (unit (list_get (players) 2)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 3)))
(unit_kill (unit (list_get (players) 3)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 4)))
(unit_kill (unit (list_get (players) 4)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 5)))
(unit_kill (unit (list_get (players) 5)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 6)))
(unit_kill (unit (list_get (players) 6)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 7)))
(unit_kill (unit (list_get (players) 7)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 8)))
(unit_kill (unit (list_get (players) 8)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 9)))
(unit_kill (unit (list_get (players) 9)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 11)))
(unit_kill (unit (list_get (players) 11)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 12)))
(unit_kill (unit (list_get (players) 12)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 13)))
(unit_kill (unit (list_get (players) 13)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 14)))
(unit_kill (unit (list_get (players) 14)))
)
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) 15)))
(unit_kill (unit (list_get (players) 15)))
)
)

(script startup lolcano
(wake killtrigger)
)

Just want to be sure there are no problems with this.


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Jan 30, 2010 04:33 PM    Msg. 2 of 11       
a) You don't wake continuous scripts
b) It's horribly optimized
c) Would look better if you used a variable instead of brute-forcing the whole thing. Here's a shorter killbox script:


(global short plyrnum 0)

(script continuous kill
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) plyrnum)))
(begin
(unit_kill (unit (list_get (players) plyrnum)))
)
(begin
(if
(= plyrnum 15)
(set plyrnum 0)
(set plyrnum (+ plyrnum 1))
)
)
)
)


Co1t3r
Joined: Dec 13, 2008


Posted: Jan 30, 2010 04:39 PM    Msg. 3 of 11       
This should work but really it's just a cleaner version of my script which doesn't really matter once compiled. Also I don't think your increment works. Wouldn't this make more sense?


(global short plyrnum 0)

(script continuous kill
(if
(volume_test_object trigger_vol_lava (unit (list_get (players) plyrnum)))
(begin
(unit_kill (unit (list_get (players) plyrnum)))
)

(set plyrnum (+ plyrnum 1))

(if

(= plyrnum 16)
(set plyrnum 0)
)
)




Also, what does begin do?
Edited by colter13 on Jan 30, 2010 at 04:52 PM
Edited by colter13 on Jan 30, 2010 at 05:47 PM


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Jan 30, 2010 07:17 PM    Msg. 4 of 11       
This is the first time I've done it this way, as an experiment to see if it works. Quick quiz, what does this do?

x = 1;
while ( x < 6 )
x++;
x*2;

In plain english, it says:

initialize x as 1
while x is less than six
increment x by 1
multiply x by 2

The final result is 12. Why? When you don't include brackets around the code you want looped, it ONLY loops the code DIRECTLY beneath it. In this case, it'd only execute x++ in the while loop. The (begin is essentially the same as the brackets. So, you'd start with x at 0, and increment it until its no longer less than 6, which means that x would be at 6. Then, you multiply it by two, which results in 12.

Essentially, when I have this:

(if
(= plyrnum 15)
(set plyrnum 0)
(set plyrnum (+ plyrnum 1))
)

Look at the syntax for the if command.
(if (cond) (then) (else) )
So, if plyrnum is equal to fifteen, you set it to 0. Otherwise, you'd set it to plyrnum + 1.

In your post, you said that you didn't THINK it works. Which is it? Does it work? Or did you doubt it because of lexical reasons?


Co1t3r
Joined: Dec 13, 2008


Posted: Jan 30, 2010 07:47 PM    Msg. 5 of 11       
AHAHAHAHA, never question the Halo Script master. I got confused by Halo's horrible syntax. The overuse of brackets makes it confusing to understand the flow. All I needed to know was that that the third statement in a HS if is an else. Sorry, but the math tutorial was a waste of time for both of us.
Edited by colter13 on Jan 30, 2010 at 07:48 PM


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Jan 30, 2010 08:10 PM    Msg. 6 of 11       
Math tutorial? It's a computer science tutorial. This will come in handy sometime in the future. In fact, the problem above was a problem on my finals last year.


Co1t3r
Joined: Dec 13, 2008


Posted: Jan 30, 2010 08:14 PM    Msg. 7 of 11       
x = 1;
while ( x < 6 )
x++;
x*2;

If only the first line under the condition is executed, shouldn't x be 4? Also thanks for the help, I just don't like it when people try to tell me things I already know.

Do you take Computer Science in school? Where I live they teach you to use Microsoft Office in computers class
Edited by colter13 on Jan 30, 2010 at 08:24 PM
Edited by colter13 on Jan 30, 2010 at 08:26 PM


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Jan 30, 2010 08:46 PM    Msg. 8 of 11       
AP Computer Science AB

And x is initially initialized at 1. At one iteration of the while loop, you would increase x by one, until it's no longer less than six. So it'd look like this:

x = 1 --- Program start
x = 2 --- One iteration of while loop. Still less than six.
x = 3 --- Another iteration. Still less than six.
x = 4
x = 5 --- Still less than six. Will go for another iteration.
x = 6 --- This isn't less than six. It won't go for another iteration. Instead, it'll go for the next line.
x = 12 --- Multiply by 2.

The reason why I made the post in the first place, was to demonstrate that this:

while (x < 6)
x++;
x*=2;

Is equal to

while (x < 6)
{
x++;
}
x*=2;
Edited by Gamma927 on Jan 30, 2010 at 08:54 PM


UnevenElefant5
Joined: May 3, 2008

its been fun yall, i'll never forget this site :')


Posted: Jan 30, 2010 08:59 PM    Msg. 9 of 11       
Quote: --- Original message by: colter13
Where I live they teach you to use Microsoft Office in computers class

The only computers class I took was "advanced" computers which consisted of powerpoint and digital photography.
Oh and a bit of HTML, but nothing that's actually useful >_>
You wouldn't believe the regular computers class D:


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Jan 30, 2010 09:06 PM    Msg. 10 of 11       
Computer applications teaches Microsoft Office and stuff like that. Introduction to Computer Programming teaches java basics, which includes the question I posted above. AP Computer Science delves into computer algorithms and other stuff.


chrisk123999
Joined: Aug 10, 2008

=CE= Chris [Captain] [=]


Posted: Jan 30, 2010 11:23 PM    Msg. 11 of 11       
Your script would work (the first post) but Halo messes up when you try to search for the player to many times in one tick. Use Gamma's script.

 

 
Previous Older Thread    Next newer Thread







Time: Fri January 20, 2023 1:42 PM 156 ms.
A Halo Maps Website