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 »Arbiter style Active Camouflage Button script

Author Topic: Arbiter style Active Camouflage Button script (10 messages, Page 1 of 1)
Moderators: Dennis

SGWraith
Joined: Apr 15, 2006

[SG] Clan


Posted: Aug 9, 2007 05:14 PM    Msg. 1 of 10       
I was trying to script an active camo button out of the flashlight but I ran into two problems.

The first was a syncing problem where you were only active camo'ed on your own screen but not everyone elses. I've heard that only death syncs so I might have to do some tricks with dumb bipeds or vehicles and the object destroy command. I've seen it used for scripted vehicle syncing so that could work here perhaps, right?

The second problem, which can't be fixed, is that the active camo won't wear off unless you die, thus limiting its use to machinima. (You can always make a custom gametypes if you wanted people to have active camo for normal gameplay)

Here is part of my beta script. This is code for player zero's active camo button. It uses Kirby's flashlight power code I read in a tutorial he uploaded here to the site:


(global boolean camo_ready true)

(script continuous camo
(begin
(sleep_until (= (unit_get_current_flashlight_state (unit (list_get (players) 0))) true))
(if (= camo_ready true)
(begin
(cheat_active_camouflage_local_player 0) ;; Give Active Camo to Player Zero
(set camo_ready false) ;; A control variable
) ;; End Begin
) ;; End IF
(sleep_until
(or
(= (unit_get_health (unit (list_get (players) 0))) 0) ;; Check if dead
(= (unit_get_health (unit (list_get (players) 0))) -1) ;; Check if out of game ie they left the server
)
) ;; End Sleep
(set camo_ready true) ;; Resets for respawn or for some who joins later
) ;; End Begin
)



The control variable may be unnecessary but I might tie it to a sync setup if I can figure one out. I didn't use cheat_active_camouflage because it only affected player zero or the host.

I've heard that there are some commands that won't sync and this may be one of them. But if not, this script could be really cool. If only it would wear off like normal camo.


SGWraith
Joined: Apr 15, 2006

[SG] Clan


Posted: Aug 9, 2007 06:31 PM    Msg. 2 of 10       
I looked at the powerup cheat before and it spawns them around the player in a circle. Better then nothing I suppose. I'll look into the object_attach command that may work, though I may need some help figuring out how to use it.

Quote:
(objects_attach <object> <string> <object> <string>)
attaches the second object to the first; both strings can be empty


What would I put for the object argument? Something like: active camouflage.equipment or something? And what are the strings for?

Perhaps I should name some invisi's and place those in an inaccessible place on the map, that might work better.


Rm860
Joined: Sep 7, 2006

Dennis sleeps like this!


Posted: Aug 9, 2007 07:19 PM    Msg. 3 of 10       
what about making a gun that shot a stealth powerup but it did not move forward just droped at your feet so when moving forward you would kind of run into it. i think you can start off with more then 2 weapons so make like a 3rd weapon that is the stealth gun. it's not what you want but would it work perhaps?


SGWraith
Joined: Apr 15, 2006

[SG] Clan


Posted: Aug 9, 2007 07:38 PM    Msg. 4 of 10       
*edit* A gun isn't quit what I had in mind but if the camo has a damage effect I could use that with what I have. If the gun shot it backwards it would hit me so thats a thought. */edit*

*edit2* Perhaps a secondary fire a weapon like the plasma sword? */edit*


http://img235.imageshack.us/my.php?image=camoattachke9.jpg

Lol, thats what happened when I used my script. I fall out of the map a few seconds after the attachment. It looks pretty cool before you die though as your head is inside the active camo spawn. Its the inset screenie in the upper right.

I may have some unnecessary code in there but here is what I have so far:


(global boolean is_server false)
(global boolean camo_ready true)

(script startup veh_sev
(begin
(if (= (unit_get_health check_vehicle) 0.0)
(begin
(set is_server true)
(object_destroy check_vehicle)
(object_create active_cam0)
) ;; End Begin
) ;; End If unit health
) ;; End Begin
) ;; End Script

(script continuous camo_client
(begin
(if (= is_server true)
(begin
(if (= (volume_test_object veh_box active_cam0) false)
(begin
(object_create active_cam0)
(set camo_ready true)
) ;; End Begin
) ;; End If volume test
) ;; End Begin
) ;; End If is server
) ;; End Begin
) ;; End Script
(script continuous camo
(begin
(sleep_until (= (unit_get_current_flashlight_state (unit (list_get (players) 0))) true))
(if (= camo_ready true)
(begin
(objects_attach active_cam0 "" (list_get (players) 0) "")
(set camo_ready false)
) ;; End Begin
) ;; End IF
(sleep_until
(or
(= (volume_test_object veh_box active_cam0) true) ;; Check if camo respawned
(= (unit_get_health (unit (list_get (players) 0))) -1) ;; Check if out of game
)
) ;; End Sleep
(set camo_ready true)
) ;; End Begin
) ;; End Script


I'll check back here if you guys have more suggestions.
Edited by SGWraith on Aug 9, 2007 at 07:40 PM
Edited by SGWraith on Aug 9, 2007 at 07:52 PM


_TheArbiter_
Joined: Apr 22, 2007

"stupidity is an epidemic " - Donut


Posted: Aug 9, 2007 09:05 PM    Msg. 5 of 10       
one question about this.....can AIs use powerups?


Orange_Geko
Joined: Nov 19, 2005

How long since I last used this account?


Posted: Aug 9, 2007 10:06 PM    Msg. 6 of 10       
Quote: --- Original message by: Tarzan
the AI in the campaign wouldn't be able to have camo...

its part of the actor varient.


_TheArbiter_
Joined: Apr 22, 2007

"stupidity is an epidemic " - Donut


Posted: Aug 9, 2007 10:14 PM    Msg. 7 of 10       
em kirby u allready know what im trying to do....and for the rest....well i wont say it again...nvm


SGWraith
Joined: Apr 15, 2006

[SG] Clan


Posted: Aug 10, 2007 02:04 AM    Msg. 8 of 10       
Quote: --- Original message by: Tarzan
try adding an object detach command immediately after the object attach - that might make it fall off his head and activate.


Right on again, Tarzan, that worked like a charm. This version is now error free and syncs over multiplayer. Thanks again guys for all your help.

Below is a syncing beta version I've decided to share with you all which manages player zero's active camo button. You may use part or all of this code if you would like to experiment with it. Just be sure to give credit to me and the people I list below if you use it in a map.

Tarzan -- For answering my questions and pointing out useful commands to try out.
Kirby_422 aka Orange Gecko -- For sharing his flashlight power code in his scripting tutorial.
EHSv2 Team -- I learned a lot about scripting thanks to that tool and what was freely included with it. Excellent program, highly recommended.
[SG] Wraith (thats me) -- The original idea for the script and for putting it all together


(global boolean is_server false)
(global boolean camo_ready true)

(script startup veh_sev ;; This is part of EHS's vehicle spawn sync code
(begin
(if (= (unit_get_health check_vehicle) 0.0)
(begin
(set is_server true)
(object_destroy check_vehicle )
(object_create active_cam0 ) ;; This is a named active camo powerup
) ;; End Begin
) ;; End If unit health
) ;; End Begin
) ;; End Script

(script continuous camo_client ;; This part is also partial from EHS's veh spawner
(begin ;; which I use to recreate the camo after use
(if (= is_server true)
(begin
(if (= (volume_test_object veh_box active_cam0) false)
(begin
(object_create active_cam0 )
(set camo_ready true) ;; Sets camo ready after renewing the object
) ;; End Begin
) ;; End If volume test
) ;; End Begin
) ;; End If is server
) ;; End Begin
) ;; End Script
(script continuous camo ;; Kirby's flashlight power code is in this section
(begin
(sleep_until (= (unit_get_current_flashlight_state (unit (list_get (players) 0))) true))
(if (= camo_ready true)
(begin
(objects_attach (list_get (players) 0) "" active_cam0 "") ;; Sticks it on MC
(objects_detach (list_get (players) 0) active_cam0 ) ;; This takes it off which causes MC to pick it up
(set camo_ready false) ;; Control variable set to false to indicate it has been used
) ;; End Begin
) ;; End IF
(sleep_until ;; Pauses the script till camo respawn or player leaves game
(or
(= (volume_test_object veh_box active_cam0) true) ;; Check if camo respawned
(= (unit_get_health (unit (list_get (players) 0))) -1) ;; Check if out of game
)
) ;; End Sleep
(set camo_ready true)
) ;; End Begin
) ;; End Script


For my more advanced version I will code for all 16 players and include balance timers to simulate camo recharge. Something I should note is that it isn't quite like the H2 version but its as good as it gets. After activation you have until it wears off to do your sneaky stuff. You should probably turn your flashlight back off after activation too, lol.

As a learning experience in scripting this was just awesome. I may eventually make a tutorial pdf on how to set this up. Something else cool about this script is that other powerups can be substituted for the active camo like the Overshield or the healthpacks. Maybe even ammo items too. An overshield switch sounds very cool but its hard to decide between that and the active camo. Anyhow, I hope this script will be fun to play with.


Thanks again all for your input.

Enjoy


Edited by SGWraith on Aug 10, 2007 at 03:13 AM


AHS_SONIC
Joined: Dec 9, 2006

mmm toasty


Posted: Aug 10, 2007 05:49 AM    Msg. 9 of 10       
ill add this to the big book of scripts if you dont mind


SGWraith
Joined: Apr 15, 2006

[SG] Clan


Posted: Aug 11, 2007 01:27 AM    Msg. 10 of 10       
Sonic - that would be cool but please wait until I iron out some of the bugs. I'll pm you a functional 16 player build for the book when I have one if you like.

Tarzan - I gave your suggestion a shot but it broke the code. Having only one camo for all 16 players didn't work properly so I was forced to create 16 camos, one for each. Its kinda hard to loop around individually named objects so I'm going to have to stick to a script for every player. Also, my more functional builds always had a dedicated script for every player and this setup has given me the least amount of problems so I'm going to stick with that for now.

The most stable version right now seems to be the one I posted yesterday :/ The only odd thing about that one is that if you leave your flashlight on it will keep attaching/detaching camos to you and other players will be able to see it . . . I tried to modify the sleep function to wait until you either left game or died before letting it loop again but this has had buggy results so far. I also tried to get it to shut your flashlight off for you but that version had something else wrong with it I think.

So, the latest code is still partially broken but here it is so you guys can see what I've changed about the script.

(global boolean is_server false)
(global boolean camo_ready true) (global boolean camo1_ready true) (global boolean camo2_ready true)
(global boolean camo3_ready true) (global boolean camo4_ready true) (global boolean camo5_ready true)
(global boolean camo6_ready true) (global boolean camo7_ready true) (global boolean camo8_ready true)
(global boolean camo9_ready true) (global boolean camo10_ready true) (global boolean camo11_ready true)
(global boolean camo12_ready true) (global boolean camo13_ready true) (global boolean camo14_ready true)
(global boolean camo15_ready true)

(script startup veh_sev
(begin
(if (= (unit_get_health check_vehicle) 0.0)
(begin
(set is_server true)
(object_destroy check_vehicle )
(object_create_containing "active_cam" )
) ;; End Begin
) ;; End If unit_get_health
) ;; End Begin
) ;; End Veh_Sev script

(script continuous camo_client
(begin
(if (= is_server true)
(begin
(if (or
(= (volume_test_object cam_box active_cam0) false) (= (volume_test_object cam_box active_cam1) false)
(= (volume_test_object cam_box active_cam2) false) (= (volume_test_object cam_box active_cam3) false)
(= (volume_test_object cam_box active_cam4) false) (= (volume_test_object cam_box active_cam5) false)
(= (volume_test_object cam_box active_cam6) false) (= (volume_test_object cam_box active_cam7) false)
(= (volume_test_object cam_box active_cam8) false) (= (volume_test_object cam_box active_cam9) false)
(= (volume_test_object cam_box active_cam10) false) (= (volume_test_object cam_box active_cam11) false)
(= (volume_test_object cam_box active_cam12) false) (= (volume_test_object cam_box active_cam13) false)
(= (volume_test_object cam_box active_cam14) false) (= (volume_test_object cam_box active_cam15) false)
) ;; End (or
(begin ;; if any of the above (= statements return true, the code below will get run
(object_create_containing "active_cam" ) ;; makes all the "active cam" objects again
) ;; End Begin block
) ;; End (if (or
) ;; End Begin
) ;; End (if is_server
) ;; End Script Begin
) ;; End Camo_Client script
(script continuous camo
(begin
(sleep_until (= (unit_get_current_flashlight_state (unit (list_get (players) 0))) true))
(if (= camo_ready true)
(begin
(objects_attach (list_get (players) 0) "" active_cam0 "")
(objects_detach (list_get (players) 0) active_cam0 )
(set camo_ready false)
) ;; End Begin
) ;; End IF
(sleep_until
(and
(= (volume_test_object cam_box active_cam0) true) ;; Check if camo respawned
(or
(= (unit_get_health (unit (list_get (players) 0))) 0) ;; Check if dead
(= (unit_get_health (unit (list_get (players) 0))) -1) ;; Check if out of game
) ;; End (or
) ;; End (and
) ;; End Sleep
(set camo_ready true)
) ;; End Begin
) ;; End Script
(script continuous camo1
(begin
(sleep_until (= (unit_get_current_flashlight_state (unit (list_get (players) 1))) true))
(if (= camo1_ready true)
(begin
(objects_attach (list_get (players) 1) "" active_cam1 "")
(objects_detach (list_get (players) 1) active_cam1 )
(set camo1_ready false)
) ;; End Begin
) ;; End IF
(sleep_until
(and
(= (volume_test_object cam_box active_cam1) true) ;; Check if camo respawned
(or
(= (unit_get_health (unit (list_get (players) 1))) 0) ;; Check if dead
(= (unit_get_health (unit (list_get (players) 1))) -1) ;; Check if out of game
) ;; End (or
) ;; End (and
) ;; End Sleep
(set camo1_ready true)
) ;; End Begin
) ;; End Script

 

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 5:01 PM 125 ms.
A Halo Maps Website