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 General Discussion »Need help with scripting

Author Topic: Need help with scripting (10 messages, Page 1 of 1)
Moderators: Dennis

EmmanuelCD
Joined: Jan 7, 2015

End my suffering


Posted: Jan 9, 2015 06:52 PM    Msg. 1 of 10       
Hi guys, can i bother you with some help with scripting lives in a firefight map? I already have the infinit round script, what kind of comand do i need to put lives? Everthing is ready i only need that, thank you


UnevenElefant5
Joined: May 3, 2008

she/her this fag bashes back


Posted: Jan 9, 2015 08:55 PM    Msg. 2 of 10       
Without seeing your exact scripts it's hard to say what will work in your structure but the general idea is to have a variable that decreases by 1 every time you "die".

It's tricky because I believe Gamma fooled around with this for Firefight-Portent and since the game resets when you die you can't actually let the player "die".

I'm not sure if he actually ever got it working but you could use (unit_get_health <unit>) to check the player's health, then if it gets to something really low, teleport them to the start point and reset their health and ammo.


;starting number of lives for your player
(global short lives 7)

(script continuous death_water
(if
(= (unit_get_health (list_get (players) 0)) 0.001)
(begin
;teleports you back to the start, this is a "flag" in Sapien, under the Game Data section.
(object_teleport (list_get (players) 0) respawn_flag)
;subtracts 1 from the current value of the var
(set lives_variable (- alerted_enemies 1))
(player_add_equipment (unit (list_get (players) 0)) regen_health true)

)
)
)


You'll need a flag in sapien named "respawn_flag" and a player starting profile in your scenario (you can add these in guerilla) named "regen_health" where you can set the health and shields to 1 each, and even give the player starting weapons. These will override the player's weapons that they were holding when they died.

That's just off the top of my head, I don't know if it will actually work but it's what I'd try.
Edited by UnevenElefant5 on Jan 9, 2015 at 08:58 PM


EmmanuelCD
Joined: Jan 7, 2015

End my suffering


Posted: Jan 10, 2015 02:36 PM    Msg. 3 of 10       
Yeah thanks man, I was trying to figure it out some how with that, I saw it in the scripting bible i wasnt sure how to apply it, still thanks, I will rey it


FtDSpartn
Joined: May 1, 2009

Verified AI.


Posted: Jan 10, 2015 10:26 PM    Msg. 4 of 10       
Didn't Gamma also set deathless player on and then just check if the health was zero?


EmmanuelCD
Joined: Jan 7, 2015

End my suffering


Posted: Jan 12, 2015 09:15 PM    Msg. 5 of 10       
I think i got another problem, but th e script didnt compile correctly, in debug it was saying "[livess line 5] i expected a unit, but this function returns a object.: (list_get (players) 0)) 0.001)" my exact script is the following

(global short lives 12)

(script continuous Alter
(if
(= (unit_get_health player0 0)) 0.001)
(begin
(player_enable_input 0)
(fade_out 1 1 1 30)
(sleep 100)
(object_teleport players respawn_flag)
(set lives_variable (- alerted_enemies 1))
(player_add_equipment (unit (list_get (players) 0)) start true)
(player_enable_input 1)

)
)
)


UnevenElefant5
Joined: May 3, 2008

she/her this fag bashes back


Posted: Jan 12, 2015 10:06 PM    Msg. 6 of 10       
This line is your problem:
(= (unit_get_health player0 0)) 0.001)

It should look like this:
(= (unit_get_health (list_get (players) 0)) 0.001)

At least that's my guess. I'm not actually compiling or testing these scripts but I /believe/ this should fix it.


Nickster5000
Joined: Dec 11, 2010


Posted: Jan 12, 2015 11:55 PM    Msg. 7 of 10       
Here's what I did for Sector 09:

(script static void respawn
(object_teleport (unit (list_get (players) 0 )) test234)
(camera_control 1)
(camera_set c1 1)
(sleep 30)
(player_add_equipment (unit (list_get (players) 0 )) balls false)
(sleep 30)
(player_add_equipment (unit (list_get (players) 0 )) empty true)
(if
(<= support_vehicle -2)
(begin
(set support_vehicle 0)
)
)
(if
(<= support_infantry -2)
(begin
(set support_vehicle 0)
)
)
(set support_infantry (- support_infantry 0.5))
(set support_vehicle (- support_vehicle 1))
(rasterizer_decals_flush)
(garbage_collect_now)
(enable_hud_help_flash true)
(show_hud_help_text true)
(hud_set_help_text die)
(hud_set_objective_text die)
(player_action_test_reset)
(sleep_until (= (player_action_test_primary_trigger) 1))
(sleep 30)
(wavebegin)
(set live_count (- live_count 1))
(set support_infantry (- support_infantry 1))
(set support_vehicle (- support_vehicle 2))
(show_hud_help_text false)
(enable_hud_help_flash false)
(player_add_equipment (unit (list_get (players) 0)) respawn true)
(camera_control 0)
(lives_checker)
)


This is what happens after you die, and you still have lives to continue playing. (I took snippets from Descent. It has a lot of useful information.) The infantry and vehicle modifiers add in my firefight, and the higher number they are the more support is sent. When you die, it resets to make it easier for you.

(script static void ending
(sound_impulse_start "RZS_Halo\s9\assets\sounds\ff_dia\survival_game_over.wav" none 1)
(fade_out 0 0 0 100)
(sleep 30)
(fade_in 0.8 0.4 0.2 30)
(camera_set ec1 1)
(camera_set ec2 750)
(fade_out 0 0 0 100)
(sleep 30)
(game_lost)
)


This is what happens after you die, but you are out of lives. The game ends.

(script static void uh_oh
(sound_impulse_start "RZS_Halo\s9\assets\sounds\ff_dia\survival_0_lives_left.wav" none 1)
(sleep_until (!= live_count 0))
)

(script static void 1lifeleft
(sound_impulse_start "RZS_Halo\s9\assets\sounds\ff_dia\survival_1_life_left.wav" none 1)
(sleep_until (= live_count 0))
)
(script static void 5livesleft
(sound_impulse_start "RZS_Halo\s9\assets\sounds\ff_dia\survival_5_lives_left.wav" none 1)
(sleep_until (= live_count 1))
)


These detect how many lives you have. If you have a certain live amount, the dialogue plays.

(script static void die
(if
(>= live_count 0)
(respawn)
)
(if
(< live_count 0)
(ending)
)
)

(script continuous healthcheck
(sleep_until (= beginhealthscripts 1))
(if
(= (unit_get_health (unit (list_get (players) 0))) 0)
(die)
)
)


The first script determines if you're still eligible to respawn, and activates the correct static void script. The second one continuously checks your health. The "beginhealthscripts" is a Boolean I added so that the scripts do not begin until after you finish the introduction portion.

I know it's a lot to take in, but this is how I approached the lives system in my way. I hope this helps!


EmmanuelCD
Joined: Jan 7, 2015

End my suffering


Posted: Jan 14, 2015 03:50 PM    Msg. 8 of 10       
I will try both methods, but some if them are really complex, I will try it out, I hope that sapien doesnt screw me. But still it is good information.


Nickster5000
Joined: Dec 11, 2010


Posted: Jan 30, 2015 02:51 AM    Msg. 9 of 10       
This is the thread that inspired me to make a tutorial. I explain the basics of scripting and then actually create a lives system script as an example of application.

http://forum.halomaps.org/index.cfm?page=topic&topicID=47665

I hope this is more helpful than trial/error to get a jump start into scripting!


Edited by Nickster5000 on Jan 30, 2015 at 02:52 AM


EmmanuelCD
Joined: Jan 7, 2015

End my suffering


Posted: Feb 1, 2015 04:18 PM    Msg. 10 of 10       
Ok, I will accept your help, but I think it will be more like Airlock firefight, only one life, I hace a lot of proyect to do

 

 
Previous Older Thread    Next newer Thread







Time: Thu July 2, 2020 6:30 AM 172 ms.
A Halo Maps Website