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 »Flashlight Scripting and Single Player questions

Author Topic: Flashlight Scripting and Single Player questions (18 messages, Page 1 of 1)
Moderators: Dennis

shadowce9
Joined: Mar 13, 2010

Learning Halo CE Scripting.


Posted: Mar 28, 2010 02:12 PM    Msg. 1 of 18       
This time, I'll get to the point.


1) What is the scripting command for the script to check to see if the player's (in single player) flashlight is on or not?

2) How would I go add a flashlight to bipeds such as the h3 spartans released on the website?

3) Cutscenes are recommended to use jmw animations, correct? But, if I make an animation for MC such as walking, and put him on a platform above ground, then will he walk off the platform if the platform and fall to the floor and continue the animation or will he keep floating to continue the animation?

4) I'm making an airstrike script as a flashlight script, but how would I go about spawning projectiles (such as the scorpian cannon, since I want the explosions to leave a trial from my longsword)?

5) Alright, the last question, how would I "limit" flash light usage since I don't want airstrikes spammed. What I mean is something like you can only use the airstrike (through flash lights) every minute or so instead of spamming it.


Nametaker40
Joined: Sep 1, 2009


Posted: Mar 28, 2010 03:20 PM    Msg. 2 of 18       
1. I believe its (unit_get_current_flashlight_state ).
2. If it does not already have a flashlight, you would need to add another marker to the model.
3. Not completely sure, but I believe MC would continue walking and still be floating, unless you animate him to fall..
4. Create some flags in sapien where you want the explosions to be, set up a script and get the timing right so that as the longsword flys over, the explosion is created at the flags.
5. Not a clue. I suppose you could set a loop to happen which stops the script every time you press it after the first time, but there is probably an easier way.


shadowce9
Joined: Mar 13, 2010

Learning Halo CE Scripting.


Posted: Mar 28, 2010 03:24 PM    Msg. 3 of 18       
Thanks for the reply, but I just realized something. I don't even have an option for exporting jmw animations in my blitzkrieg. It only allows me to export JMA, JMM, JMT, JMR, and JMO. How do I export my animations as JMWs?


Nametaker40
Joined: Sep 1, 2009


Posted: Mar 28, 2010 03:26 PM    Msg. 4 of 18       
I don't use blitzkreig, so I wouldn't know. You could always try the animation exporter on this site.


shadowce9
Joined: Mar 13, 2010

Learning Halo CE Scripting.


Posted: Mar 28, 2010 04:07 PM    Msg. 5 of 18       
The animation exporter on this site offers the same exporting options as blitzkreig ...

I still don't know how to export animations for my cutscenes as jmw's. However, it seems that many other people can export jmw's and can anyone help me?

Edit: I searched around the internet and saw that CAD's animation exporter exports in jmw as well. Do anyone know where to get it?
Edited by shadowce9 on Mar 28, 2010 at 04:19 PM


Nametaker40
Joined: Sep 1, 2009


Posted: Mar 28, 2010 04:31 PM    Msg. 6 of 18       


shadowce9
Joined: Mar 13, 2010

Learning Halo CE Scripting.


Posted: Mar 28, 2010 07:42 PM    Msg. 7 of 18       
Lol. I feel dumb now xD.
About the flash light script, I tried it out, like this:

(script dormant airstrike
(wake air_obj8)
(sleep 150)
(wake air_obj9)
(activate_team_nav_point_flag default_red "player" strike1 0.6)
(activate_team_nav_point_flag default_red "player" strike2 0.6)
(activate_team_nav_point_flag default_red "player" strike3 0.6)
(activate_team_nav_point_flag default_red "player" strike4 0.6)
(activate_team_nav_point_flag default_red "player" strike5 0.6)
(activate_team_nav_point_flag default_red "player" strike6 0.6)
(activate_team_nav_point_flag default_red "player" strike7 0.6)
(activate_team_nav_point_flag default_red "player" strike8 0.6)
(sleep 210)
(wake air_obj10-14)
(sleep 90)
(wake air_underway)
(effect_new "vehicles\scorpion\shell explosion" strike8)
(sleep 30)
(effect_new "vehicles\scorpion\shell explosion" strike6)
(sleep 15)
(effect_new "vehicles\scorpion\shell explosion" strike3)
(sleep 30)
(effect_new "vehicles\scorpion\shell explosion" strike5)
(sleep 10)
(effect_new "vehicles\scorpion\shell explosion" strike7)
(effect_new "vehicles\scorpion\shell explosion" strike1)
(sleep 30)
(effect_new "vehicles\scorpion\shell explosion" strike2)
(sleep 15)
(effect_new "vehicles\scorpion\shell explosion" strike4)
(sleep 30)
(wake air_finished)
(deactivate_team_nav_point_flag "player" strike1)
(deactivate_team_nav_point_flag "player" strike2)
(deactivate_team_nav_point_flag "player" strike3)
(deactivate_team_nav_point_flag "player" strike4)
(deactivate_team_nav_point_flag "player" strike5)
(deactivate_team_nav_point_flag "player" strike6)
(deactivate_team_nav_point_flag "player" strike7)
(deactivate_team_nav_point_flag "player" strike8)
)


(script continuous air_check
(if (= (unit_get_current_flashlight_state "player" ) 1) (wake airstrike))
)


But it gives an error.

[test_map 260] this is not a valid object name.: player" ) 1) (wake airstrike))

That's the main part of the error. How would I fix this? I tried player0 but that didn't work either.


Nametaker40
Joined: Sep 1, 2009


Posted: Mar 28, 2010 08:12 PM    Msg. 8 of 18       
I believe you have to make the player an object. Not sure how to go about doing this though.


shadowce9
Joined: Mar 13, 2010

Learning Halo CE Scripting.


Posted: Mar 29, 2010 09:02 AM    Msg. 9 of 18       
I'm not sure how to refer the player as an object however I tried to use the "player" team in general (which usually works) but that didn't work either.


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Mar 29, 2010 08:10 PM    Msg. 10 of 18       
(list_get (players) 0) for the first player. Change the 0 to the index of each player.


shadowce9
Joined: Mar 13, 2010

Learning Halo CE Scripting.


Posted: Mar 29, 2010 09:28 PM    Msg. 11 of 18       
Thank you for the command gamma, but may I see it used in a flashlight script? I mostly learn off of other scripts as I experiment on my own.

EDIT: I tried it out like this:

(script static void airstrike
(wake air_obj8)
(sleep 150)
(wake air_obj9)
(activate_team_nav_point_flag default_red "player" strike1 0.6)
(activate_team_nav_point_flag default_red "player" strike2 0.6)
(activate_team_nav_point_flag default_red "player" strike3 0.6)
(activate_team_nav_point_flag default_red "player" strike4 0.6)
(activate_team_nav_point_flag default_red "player" strike5 0.6)
(activate_team_nav_point_flag default_red "player" strike6 0.6)
(activate_team_nav_point_flag default_red "player" strike7 0.6)
(activate_team_nav_point_flag default_red "player" strike8 0.6)
(sleep 210)
(wake air_obj10-14)
(sleep 90)
(wake air_underway)
(effect_new "vehicles\scorpion\shell explosion" strike8)
(sleep 30)
(effect_new "vehicles\scorpion\shell explosion" strike6)
(sleep 15)
(effect_new "vehicles\scorpion\shell explosion" strike3)
(sleep 30)
(effect_new "vehicles\scorpion\shell explosion" strike5)
(sleep 10)
(effect_new "vehicles\scorpion\shell explosion" strike7)
(effect_new "vehicles\scorpion\shell explosion" strike1)
(sleep 30)
(effect_new "vehicles\scorpion\shell explosion" strike2)
(sleep 15)
(effect_new "vehicles\scorpion\shell explosion" strike4)
(sleep 30)
(wake air_finished)
(deactivate_team_nav_point_flag "player" strike1)
(deactivate_team_nav_point_flag "player" strike2)
(deactivate_team_nav_point_flag "player" strike3)
(deactivate_team_nav_point_flag "player" strike4)
(deactivate_team_nav_point_flag "player" strike5)
(deactivate_team_nav_point_flag "player" strike6)
(deactivate_team_nav_point_flag "player" strike7)
(deactivate_team_nav_point_flag "player" strike8)
)


(script continuous air_check
(if (= (unit_get_current_flashlight_state (list_get (players) 0)) 1) (airstrike))
)

But it keeps telling me that it expected a unit at player0 but it's an object.
Edited by shadowce9 on Mar 29, 2010 at 09:31 PM


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Mar 29, 2010 09:38 PM    Msg. 12 of 18       
An object is not necessarily a unit. For example, in the hierarchy view in Sapien, there are three subcategories or more under objects. Objects can be units, items, or scenery. In this case, you need to cast the object to an unit, like so:

(unit (list_get (players) 0))

In your script, you'd do something like:


(script continuous air_check
(if
(unit_get_current_flashlight_state (list_get (players) 0))
(airstrike)
)
)


Though, this checks every second whether or not your flashlight is on, and once you turn on your flashlight, there is no script to turn it off, so it'll continuously call airstrike forever. A much better script would be like so:


(script continuous air_check
(sleep_until (unit_get_current_flashlight_state (list_get (players) 0)) 15)
(unit_set_desired_flashlight_state (unit (list_get (players) 0)) false)
(airstrike)
)


Thus, once you turn on the flashlight, it'll turn off the flashlight AND THEN execute the airstrike command.


Me KS
Joined: Feb 2, 2008

Desire is Reality. Xfire: jetmaster23


Posted: Mar 29, 2010 09:39 PM    Msg. 13 of 18       
Then use (unit (list_get (players) 0)).

Or you could just add this static script to the beginning of the scripts:

(script static "unit" p0
(unit (list_get (players) 0))
)

And then whenever you want to refer to the player just type in (p0). Saves effort.

Edit: ^ Lol beat me to it.
Edited by Me KS on Mar 29, 2010 at 09:40 PM


shadowce9
Joined: Mar 13, 2010

Learning Halo CE Scripting.


Posted: Mar 30, 2010 11:42 AM    Msg. 14 of 18       
I tried both Gamma's and ME KS's script and got the same error. The closest I got was ME KS's script, where I made a static unit script and called it player0, then did this:


(script static unit player0
(unit (list_get (players) 0))
)


(script continuous air_check
(sleep_until (unit_get_current_flashlight_state (player0) true) 15)
(unit_set_desired_flashlight_state (player0) false)
(airstrike)
)


However, I get a new error. It keeps telling me that (unit_get_current_flashlight_state) requires exactly 1 argument(s).

Also, Gamma's script still tells me that it was expecting an unit.


Me KS
Joined: Feb 2, 2008

Desire is Reality. Xfire: jetmaster23


Posted: Mar 30, 2010 02:57 PM    Msg. 15 of 18       
Quote: --- Original message by: shadowce9
(script continuous air_check
(sleep_until (unit_get_current_flashlight_state (player0) true) 15)
(unit_set_desired_flashlight_state (player0) false)
(airstrike)
)


It's saying it needs one argument because you added 'true' as if it was a second argument. What you meant to do was test whether the function (unit_get_blah_flashlight) is equal to 'true', right? Well you need the test function (= [expression] [value]) for that.

So the [expression] is the flashlight function written in parentheses (functions and scripts are always in parentheses), and the value you're testing for is 'true' (values and variables are written in without parentheses). So here's the corrected line:

(= (unit_get_current_flashlight_state (player0)) true)


shadowce9
Joined: Mar 13, 2010

Learning Halo CE Scripting.


Posted: Mar 30, 2010 05:02 PM    Msg. 16 of 18       
Thank you! Well, I had to add an extra parenthesis at the end of
(= (unit_get_current_flashlight_state (player0)) true) to make it work. However, is there a way to "limit" flash light usage so air strikes do not get spammed? Like the player is only allowed 1 airstrike per 2 minutes or something similar?

Also, is it possible to "Unlock Airstrike" so that it's only usable after a certain wave. (I think it is since I saw one of Gamma's videos and it said >>Airstrike Unlocked)


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Mar 30, 2010 06:27 PM    Msg. 17 of 18       
Oh oops. I forgot to add the (unit ) around the (list_get (players) 0) when giving you the script.

As for restrictions, it can be done by adding a sleep command as such:


(script continuous air_check
(sleep_until (unit_get_current_flashlight_state (unit (list_get (players) 0))) 15)
(unit_set_desired_flashlight_state (unit (list_get (players) 0)) false)
(airstrike)
(sleep 7200)
)


The added (sleep 7200) waits two minutes before the flashlight check works again. Though you can continuously mash the flashlight button, nothing will happen. If you want to display HUD text that it's not available, you'd probably wish to try out variables.


shadowce9
Joined: Mar 13, 2010

Learning Halo CE Scripting.


Posted: Apr 1, 2010 08:57 PM    Msg. 18 of 18       
Thanks Gamma and ME_KS, I ended up with a script like this:

(global boolean no_airstrike_yet 0)


(script static unit player0
(unit (list_get (players) 0))
)


[I put the airstrike script in between here]


(script continuous air_check
(sleep_until (= (unit_get_current_flashlight_state (player0)) true))
(unit_set_desired_flashlight_state (player0) false)
(airstrike)
(set no_airstrike_yet 1)
(sleep 1800)
(set no_airstrike_yet 0)
)


(script continuous no_air_check
(sleep_until (= (unit_get_current_flashlight_state (player0)) true))
(unit_set_desired_flashlight_state (player0) false)
(sleep_until (= no_airstrike_yet 1))
(no_airstrike)
)


Now I know when I can use airstrike or not :D

 

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 2:10 AM 156 ms.
A Halo Maps Website