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 »Player health regeneration?

Author Topic: Player health regeneration? (7 messages, Page 1 of 1)
Moderators: Dennis

Hell_Jumper_056
Joined: Jan 7, 2010

Halo: Accession


Posted: Feb 19, 2014 12:33 AM    Msg. 1 of 7       
This is something that I've been trying to figure out for a while. I am personally not a fan of the player health system that we had in halo 1 and reach, but i do like how you can keep track of how much you have left with the bars. I've been looking through the player biped tags and I can't find anything that mentions regeneration or anything of the sort aside from the players shields and health.

What I want is after the players shields have fully recharged, his health will fully recharge (or maybe once the player has left combat). I have gotten one script working that I think could help:

( script startup sceneryspawner
( begin
( sleep 120 )
( effect_new_on_object_marker "levels\newmap3\effects\healthspawner" lolwarthog "driver" )
)
)


This spawns an effect file that spawns a health pack. It works perfectly, however I haven't been able to find a string that would tell it to spawn it inside the player since 'player' is not a unit type (i think). So I can't reference it to any of the player models markers.

I have seen this done before with people remaking the halo reach camo system. They caused a powerup to spawn from a function inside the player model and you could see it spawn right before the player "picked it up".

Is there another way to do this? I also want this to work in multiplayer too. I'll eventually release a script and tutorial package for everyone to use. Thanks!


ally
Joined: Jun 23, 2010

Aye Ready


Posted: Feb 19, 2014 12:25 PM    Msg. 2 of 7       
http://forum.halomaps.org/index.cfm%3Fpage=topic&topicID=38227

pretty sure that will work the way you want.
the health regen script is there.
no idea if that is any differrent to L28's
but am not at my pc to find that out.


A Juicy Frank
Joined: Oct 28, 2013


Posted: Feb 19, 2014 01:38 PM    Msg. 3 of 7       
You don't need to have a unit referenced in order for the (effect_new_on_object_marker ) command to work on a player's markers. Players are called by using (list_get (players) <player_index>), which returns an object by default.
Something along the lines of this would have the effect occur in his left hand:

(effect_new_on_object_marker "levels\newmap3\effects\healthspawner" (list_get (players) 0) "left hand")


Valid markers in the default cyborg would be: (quotation marks are only necessary when there is a space in the name)
-head
-flashlight
-"left hand"
-"right hand"
-antenna
-body
-"left foot"
-"right foot"

Of course, this would need to be run for every player in the game all the time, so having a continuous script increment a integer variable from 0 to 15 and using this variable as the player_index would be the best option.



As for the camo system, only other way I can think of would be with OS' (unit_data_get_real <unit> camo_power) command.
I've played with it before, and found that the best results are by giving the player permanent camouflage at the start of the game, and have the command change the power to a large negative number. This is done because as far as I know, a power of 1 (100%) is the same as a power of 758 (7580%). However, the distortion looks terrible at those high powers, and the script would have to constantly be upping the power to maintain the camo strength being lost. So, by working in reverse, we can avoid most of the graphical errors and let the game's camo powerup time take control and naturally hold the power at 1 by itself.


Hell_Jumper_056
Joined: Jan 7, 2010

Halo: Accession


Posted: Feb 19, 2014 06:10 PM    Msg. 4 of 7       
Ally: Thanks alot for that. That script looks like it could help. I'm still going to look into how I can get the players health to regen after he's left combat though.

A Juicy Frank: So the "(players) 0)" is similar to a unit type? I didn't understand what the Halo Scripting Keywords pdf meant by "returns an item in an object list.". I'm guessing that the "list_get" is referring to something in the globals file? or is the <player_index> the one thats doing that?


A Juicy Frank
Joined: Oct 28, 2013


Posted: Feb 19, 2014 10:15 PM    Msg. 5 of 7       
What (list_get ) does is it returns the information in an object list from a specific slot, or index. (players) is a global object list that updates when players join or leave a game, multiplayer or singleplayer, and is used to reference any player character currently in the game.

As an example, if I wanted to scale player 3 pretty small, I would run
(object_set_scale <object> 0.25 1)
while referencing that player 3 as the object.


(list_get ) is used to return an object from the global list of players:
(list_get (players) <index>)



And we use an index of 2, because (players) list is 0 indexed, or is as diagrammed below:


Final product:
(object_set_scale (list_get (players) 2) 0.25 1)



How do we know if player 3 is the one we wanted to shrink? We don't. Someone could leave, die, etc. and we'd have a new player occupying index number 2, or the one we wanted all along have been in index 5. It's up to the script writer to create a method for determining who is who during runtime.




Now... as far as returning a unit type... this is only necessary when a command requires a unit. Things like (unit_get_health <unit>), (custom_animation <unit> <animation_graph> <string> <boolean>), (vehicle_load_magic <unit> <string> <object_list>), etc. require a unit, whereas commands such as (object_beautify <object> <boolean>), (object_set_collideable <object> <boolean>), and even (effect_new_on_object_marker <effect> <object> <string>) only require an object.

It doesn't cause any problems to have a unit used in place of an object, but in order for objects to be used as a unit, then they need to be converted. Because (players) is an object_list, and (list_get ) returns objects, it is usually more convenient to everything to a unit at the time of it being called. This is why we always see (unit (list_get (players) 0)).


Hope this was at all helpful, and that I didn't completely miss the problem.


Hell_Jumper_056
Joined: Jan 7, 2010

Halo: Accession


Posted: Feb 20, 2014 03:22 AM    Msg. 6 of 7       
lmao this is perfect! I've never been able to understand how code interacts with itself and this

"It doesn't cause any problems to have a unit used in place of an object, but in order for objects to be used as a unit, then they need to be converted. Because (players) is an object_list, and (list_get ) returns objects, it is usually more convenient to everything to a unit at the time of it being called. This is why we always see (unit (list_get (players) 0))."

was extremely helpful! I knew that the code could be customized but the keywords pdf didn't seem to mention anything like that. Thanks so much!


A Juicy Frank
Joined: Oct 28, 2013


Posted: Feb 20, 2014 03:26 AM    Msg. 7 of 7       
Glad to hear. Good luck with your endeavors.

 

 
Previous Older Thread    Next newer Thread







Time: Fri January 20, 2023 7:32 PM 172 ms.
A Halo Maps Website