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 »Scripting Thread

Page 1 of 7 Go to page: · [1] · 2 · 3 · 4 · 5 · 6 · 7 · Next
Author Topic: Scripting Thread (231 messages, Page 1 of 7)
Moderators: Dennis

kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 3, 2012 05:30 PM    Msg. 1 of 231       
So, I am disappointed in the lack of people writing scripts. I decided I would start writing series of tutorials to focus on certain things. I'm going to use this thread as the headquarters (Any question that ends up asked here a lot could end up getting its whole own tutorial dedicated to it, etc. If you want to learn something, ask.) People can show off their scripts (which could help raise more questions about things, and help further peoples understandings)

Basically, scripting thread, here, plus tutorials.


In the tutorials, I've tried to color code most things in the examples (The tutorials are almost entirely examples. A bit of brief explanation, then commented examples to show the points I made)
Light blue - named object
Purple - thing in the map that isn't an object, but is required
Orange - Boolean (true/false, 1/0)
Light Green - Number (Integer, short, real)
Pink - Hooked globals (.. idk how to explain it, you should understand when you see it)
Red - Strings (Text, tag locations, markers, seat names, etc)
Yellow highlighted - Comments

Tutorials:
Basics
(Script types, globals, saving scripts, compiling scripts, common errors, etc)
Using tags to perform script actions
Armor Abilities
Passing Data Between Maps (NEW)



I can't know what you people want to learn without you telling me; to me, scripting is just basic stuff like English and tutorials would be overboard, but only I am me, while you are you.
Edited by kirby_422 on Aug 24, 2013 at 11:21 PM


Dumb AI
Joined: Sep 18, 2011

Dead.


Posted: Sep 3, 2012 06:08 PM    Msg. 2 of 231       
I have a question.How do you give the local player(player in SP)active camouflage for about 20 seconds when he/she presses the flashlight on?I feel that this question would be best answered by one script command.
Edited by Dumb AI on Sep 3, 2012 at 06:13 PM


ChBgt909
Joined: Sep 10, 2011

ᶘ ᵒᴥᵒᶅ


Posted: Sep 3, 2012 06:12 PM    Msg. 3 of 231       
*just subscribing to this thread*


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 3, 2012 06:22 PM    Msg. 4 of 231       
There isn't the most commands for controlling camo. If you use the default camo commands, you'll stay camo'd until you die; Rather than using a command to turn on camo, merely spam a damage that only effects camo (to get rid of it when you don't want it on).

Next approach would be either spawning, or moving a camo powerup on the player, that lasts the 20 seconds. Moving an existing one is better, as if they do already have camo and they dont pick it up, you can move it away.

Example
(script static unit player0 (unit (list_get (players) 0)))
(script continuous camo_flashlight
(sleep_until (unit_get_current_flashlight_state (player0)) 5) ;;Wait for flashlight to be on
(object_create_anew random_camo_powerup) ;;Create the powerup
(objects_attach (player0) "body" random_camo_powerup "") ;;Move the powerup to the player
(objects_detach (player0) random_camo_powerup)
(unit_set_desired_flashlight_state (player0) 0) ;;Turn the flashlight off.
(sleep 10) ;;Wait 1/3rd a second
(object_destroy random_camo_powerup) ;;If it still exists, get rid of it
(sleep 600) ;;Wait 20seconds before allowing re-use.
)


Third, use OS
(unit_data_set_real (unit (list_get (players) 0)) camo_power 1)
you have to keep using it for the whole period you want to be camo'd, or else it will fade.


Lone Warrior
Joined: Dec 14, 2008

-Himalayan Wizard and Mystical Guru of the Mts.-


Posted: Sep 3, 2012 06:32 PM    Msg. 5 of 231       
I've seen a few people asking about the whole screen blur business when health is low, so I figured I'd post it here. This script was originally made by a guy called Rob, who handed it over to BeachPartyClan, who then handed it to me for use in The Flood: Forgotten Exile.



(global short blur 0)
(global short tempStore 0)
(global boolean stop false)

( script continuous healthstuff
(if
(= stop false)
(begin
(cinematic_screen_effect_start 1)
(set blur (* (- (* (unit_get_health (player)) 8) 8) -1))
(cinematic_screen_effect_set_convolution 1 2 blur blur 1)
(cinematic_screen_effect_set_filter_desaturation_tint 200 0 0)
)
)
)



This contains both the stuff needed to make the screen blur when players health gets lower, but also to stop it during cutscenes.

All you need to add to your cutscene script to get the blur to stop is:


( set stop true )
( set tempStore blur )
( cinematic_screen_effect_set_convolution 1 2 0 0 1 )


As I said, I take no credit for these scripts. The Health Blur script was designed by Rob, and the script for stopping blur during cutscene was made by Gamma.

Secondly, I'd also like to mention some scripts that can be very handy.

The first is unit_impervious.

unit_impervious is used to stop a unit playing the ping animations when it gets hit.

So say for example you changed the player biped to that of a Flood, but you get these annoying situations where you can't fire after being hit because a ping animation is playing. You can use this script to disable it for the player.

 

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

( script startup impervious
( unit_impervious ( list_get ( players ) 0 ) 1 )
)



Simply add that to the top of your script and your set to go.

Next up is some handy script commands for disabling parts of the HUD.


( hud_show_crosshair 0 )
( hud_show_motion_sensor 0 )
( hud_show_health 0 )


These are pretty self-explanatory, but can be useful if you're trying to get rid of something like the Motion Tracker if you're playing as a Marine or whatever.

Third is your generic killbox script, taken straight from the original campaign scripts.


( script startup kill_box_1
( sleep_until ( volume_test_objects killb1 ( players )))
( damage_object "effects\damage effects\guaranteed plummet to untimely death" ( unit ( list_get ( players ) 0 )))
)


Simple script used for killing players when they enter a trigger volume. You'll be able to get that damage effect by ripping b40/c40.

P.S: For those of you wondering, ';' can be used to add comments to scripts without Sapien trying to compile it as a script.

Awesome thread btw, about time someone made a thread devoted to scripting.


HaloExtreme117
Joined: May 5, 2012

~Gone~


Posted: Sep 4, 2012 12:21 AM    Msg. 6 of 231       
*Just subbing to epic thread*


ally
Joined: Jun 23, 2010

Aye Ready


Posted: Sep 4, 2012 05:14 AM    Msg. 7 of 231       
thanks, although in the past i learned a bit of C and pearl hce scripting was something i never really took a proper look at. the pdfs will be handy.


HaloExtreme117
Joined: May 5, 2012

~Gone~


Posted: Sep 4, 2012 08:43 AM    Msg. 8 of 231       
Quote: --- Original message by: kirby_422
Light Green

Kirby is colour blind
And aLTis is too!


HaloExtreme117
Joined: May 5, 2012

~Gone~


Posted: Sep 4, 2012 08:46 AM    Msg. 9 of 231       
Quote: --- Original message by: aLTis
Quote: --- Original message by: haloextreme117
Quote: --- Original message by: kirby_422
Light Green

Kirby is colour blind
And aLTis is too!

no im not. im the one who noticed this.

Indeed you are.
Merry christmas color blind one!


MatthewDratt
Joined: Sep 11, 2010

HaloCE3.com MattDratt.com


Posted: Sep 4, 2012 09:18 AM    Msg. 10 of 231       


HaloExtreme117
Joined: May 5, 2012

~Gone~


Posted: Sep 4, 2012 09:19 AM    Msg. 11 of 231       
Quote: --- Original message by: MatthewDratt

I'm not blind.
Edited by haloextreme117 on Sep 4, 2012 at 09:20 AM
Edited by haloextreme117 on Sep 4, 2012 at 09:20 AM


bourrin33
Joined: Oct 19, 2009

HEK not installed tho


Posted: Sep 4, 2012 09:27 AM    Msg. 12 of 231       
I'd like to know scripting, but my eyes can't accept command lines...


HaloExtreme117
Joined: May 5, 2012

~Gone~


Posted: Sep 4, 2012 09:28 AM    Msg. 13 of 231       
I like halo scripting. It's alot like lisp imo.
I prefer c++ tho.


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 4, 2012 01:07 PM    Msg. 14 of 231       
Quote: --- Original message by: haloextreme117
Quote: --- Original message by: kirby_422
Light Green

Kirby is colour blind
And aLTis is too!

I'm not colorblind. Why dont you click the quote button again, and read what color the forums think that is, because it says 'limegreen'. I agree that that is most certainly mostly blue rather than green, but I don't care to change it, the forums state otherwise (and who knows, maybe one of these years someone in Dennis' company will fix it, and it WILL be limegreen)



I'm thinking I'll do a PDF on armor abilities today (its gonna be long, and ima makeup whatever I want for abilities; its the system its gonna be about. you can add whatever you want in it.), because I want to get out at least one more PDF before heading back to college tomorrow (And camo is the only question asked, and idk how much longer I could make a PDF about camo than just the post I made already lol)


nihao123456ftw
Joined: Mar 24, 2012


Posted: Sep 5, 2012 05:36 AM    Msg. 15 of 231       
I'm not a very good scripter but here's what I got:

Flashlight camouflage

Quote: --- Original message by: Dumb AI

I have a question.How do you give the local player(player in SP)active camouflage for about 20 seconds when he/she presses the flashlight on?I feel that this question would be best answered by one script command.
Edited by Dumb AI on Sep 3, 2012 at 06:13 PM


My way that I made up is kinda dodgy but oh well (doesn't work with multiple people)

-In globals.globals tag in tags\globals delete (backup tag first) everything in cheat all powerups block

-Open the active camouflage tag and at the bottom there is a field that sets the amount of time the camouflage lasts for, i think it's set to 45 seconds by default. Set it to 20 and save as a different tag

-I think that setting the bounding radius to like 1-5 might help because I think it might increase the area where the powerup can be picked up by the player (scroll to top and find the field)

-Back in the globals tag add 1 block in cheat_all powerups tag and point that to the new camouflage tag you created

Now you can just write a script that detects when the player presses flashlight it will turn it back off, then spawn cheat_all_powerups, but since you deleted everything in the powerups block except for one so it will only spawn that powerup, then you can have the script sleep for however long you want the cooldown to be


(script continuous flashlight_camo
(sleep_until (= (unit_get_current_flashlight_state (unit (list_get (players) 0))) true))
(unit_set_desired_flashlight_state (unit (list_get (players) 0)) 0)
(cheat_all_powerups)
(sleep <however long you want the cooldown in seconds times 30>)
)


If this causes exceptions, restore your backup (keep another backup) and just make a blank new .equipment tag and save and reference that to all the fields in the globals tag's cheat all powerups fields except for one which should be the 20 sec camouflage you did above ^

Vehicle teleporters

This works in both single player and multiplayer, I believe this is similar to Coldsnap's vehicle teleporters


  • Place a trigger volume around the area where you want to define the teleporter regions

  • Place a cutscene flag at the area where you want to teleport the vehicle to

  • If you want to make it a two-way teleporter or make more teleporters, do above in your desired places

  • Give your vehicles, trigger volumes and cutscene flags names

  • copy the script down and then replace {name of} with the names of the vehicles, trigger volumes and cutscene flags you did last step^ (get rid of the {}s as well)




(script continuous vehicle_teleport
(if
(volume_test_object {name of trigger volume} {name of vehicle})
(begin
(object_teleport {name of vehicle} {name of cutscene flag})
(sleep_until
(= (volume_test_object {name of other trigger volume if this is a two-way teleporter, if not just fill in the name of the first trigger volume or delete sleep_until part of script} {name of vehicle}) false)
)
)
)
;;if you want to make this a two-way or make more vehicle teleporters...
(if
(volume_test_object {name of other trigger volume} {name of vehicle})
(begin
(object_teleport {name of vehicle} {name of cutscene flag})
(sleep_until
(= (volume_test_object {name of the first trigger volume from above script if this is a two-way teleporter} {name of vehicle}) false)
)
)
)
)

Eject players from vehicle if in a region you don't want them to be in

I have made different types of scripts the first one below just ejects the player, waits 3 seconds, then respawns the vehicle back to it's starting point. This is what I used in cerazine version 2 to prevent players from dropping all the vehicles down to undesired places:


  • Place a trigger volume over the area you don't want the vehicle(s) to go in

  • Give the trigger volume and your vehicles names

  • Copy those names into the {name of ...} fields below (get rid of the {}s as well)



(script continuous vehicle_respawn_volume
(if (= (volume_test_object {name of trigger volume} {name of vehicle}) true)
(begin
(vehicle_unload {name of vehicle} "")
(sleep 90)
(object_create_anew {name of vehicle})
)
)
)

This script isn't tested, but it should just kill the player inside the vehicle, that's all. Not supposed to kill if a player is inside the region but is not in the vehicle. Single player only:

(script continuous killzone_if_in_vehicle_player0
(if
(and
(volume_test_object {name of trigger volume} (unit (list_get (players) 0)))
(vehicle_test_seat {name of vehicle} "" (unit (list_get (players) 0)))
)
(unit_kill (unit (list_get (players) 0)))
)
)

This script isn't tested either, but this will eject the player and then make the player not able to get inside any seats in the vehicle like in Lumoria Episode 1

(script continuous vehicle_respawn_volume
(if (= (volume_test_object {name of trigger volume} {name of vehicle}) true)
(begin
(vehicle_unload {name of vehicle} "")
(unit_set_enterable_by_player (unit (list_get (players) 0)) 0)
(unit_set_enterable_by_player (unit (list_get (players) 0)) 1) ;;If this is a multiplayer map, keep copying this pattern and change the numbers until you get to (unit_set_enterable_by_player (unit (list_get (players) 0)) 15), otherwise just delete this row of script if it's singleplayer only
)
)
)

Spawning more than 6 vehicles in a multiplayer map

I owe all credit to kirby for theorising this script:

  • Give all your vehicles names

  • Place a big trigger volume around the first vehicle you placed on the map, but make sure it doesn't go over any other vehicle spawn points besides the first one



(script startup vehicle_spawn
(if
(!= (unit_get_health {any vehicle from the first to sixth vehicle in the list of vehicles in sapien}) -1.00)
(begin
(object_create_anew {vehicle 1})
(object_create_anew {vehicle 2})
(object_create_anew {vehicle 3});;repeat this object_create_anew pattern for all your vehicles

;;After the vehicles respawn for some odd reason they respawn on the first vehicle you placed in the list. To counter this, use this script. Fill vehicle slots only with vehicles after the 6th vehicle

(script continuous vehicle_respawn
(if
(= (volume_test_object {name of trigger volume around first vehicle} {name of vehicle}) true)
(object_create_anew {name of vehicle})
)
(if
(= (volume_test_object {name of trigger volume around first vehicle} {name of another vehicle}) true)
(object_create_anew {name of another vehicle})
)
(if
(= (volume_test_object {name of trigger volume around first vehicle} {name of yet another vehicle}) true)
(object_create_anew {name of yet another vehicle})
)
;;repeat this pattern for all vehicles besides the first 6 vehicles
)


Ultimate CTF Plan



More of just a command you can type ingame


  • Open any scenario and place a rock scenery or any named object, even a vehicle would work

  • give that rock a name



compile, then ingame type:

objects_attach {scenery name} "" (unit (list_get (players) 0)) ""

Edited by nihao123456ftw on Sep 5, 2012 at 06:41 AM


ChBgt909
Joined: Sep 10, 2011

ᶘ ᵒᴥᵒᶅ


Posted: Sep 8, 2012 01:11 PM    Msg. 16 of 231       
is there a way to make an object spawn or certain script run with an specific gametype in multiplayer? (i.e certain vehicle, object or event to happen ONLY in race gametype)

i know there is a way i think i've seen it and i've tried different ways to do it, but i couldn't, some help would be appreciated :)
Edited by ChBgt909 on Sep 8, 2012 at 01:11 PM


killzone64
Joined: Jun 9, 2010

Mostly active on discord


Posted: Sep 8, 2012 01:17 PM    Msg. 17 of 231       
Quote: Ultimate CTF Plan

http://video.xfire.com/58798a-4.jpg

More of just a command you can type ingame


  • Open any scenario and place a rock scenery or any named object, even a vehicle would work

  • give that rock a name




XD i like that idea i may just use that as an easteregg, any way to script that so it works when you grab a powerup?


Spiral
Joined: Apr 3, 2011

I hope i'm out of the way


Posted: Sep 8, 2012 01:18 PM    Msg. 18 of 231       
xD

rocks.


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 8, 2012 01:47 PM    Msg. 19 of 231       
Quote: --- Original message by: ChBgt909
is there a way to make an object spawn or certain script run with an specific gametype in multiplayer? (i.e certain vehicle, object or event to happen ONLY in race gametype)

i know there is a way i think i've seen it and i've tried different ways to do it, but i couldn't, some help would be appreciated :)

With OS, you can use (game_engine_data_get_integer <string>)


Without OS, you can use vehicles or netgame_equipment (vehicle is overall easier and nicer, but it can have issues if they mess with their vehicle settings for their gametype)
Make a vehicle that only spawns on a certain gametype, and is always spawned defaultly (Without scripts). You can then check whether its that gametype with (unit_get_health <vehicle>), if its -1, then the vehicle doesnt exist, if it is, or between 0 and 1, then the vehicle is spawned. This only works for the host side (So, if you want the client to do something on certain gametypes, they wont receive this message.)
If you want to use netgame equipment, make a gun that detonates after spawn, place it near some bipeds. Use a pvs camera if needed (if using portals, clusters, etc). Then check the bipeds health. If the biped has been damaged or died, then you know its that gametype.
Quote: --- Original message by: killzone64
Quote: Ultimate CTF Plan

<a href="http://video.xfire.com/58798a-4.jpg" target="_blank">http://video.xfire.com/58798a-4.jpg</a>

More of just a command you can type ingame


  • Open any scenario and place a rock scenery or any named object, even a vehicle would work

  • give that rock a name




XD i like that idea i may just use that as an easteregg, any way to script that so it works when you grab a powerup?

Using it in multiplayer isnt a very good idea, as the way he has it setup, it wont remove itself when the player dies, and it doesn't track the actual players. Whenever I get around to finishing that AA setup PDF, it'll have examples of how to better track each player.

Anyways, for a powerup to do this, it would work best with SP and OS, but im assuming you dont want that. I'm to lazy right now to write up a syncing process for it, so if people join while someone has the powerup, they wont see it. Place a trigger volume, place the powerup as a powerup (not a netgame equipment), name it something,
(global unit closest_player none)
(global short number 0)
(script static unit player (unit (list_get (players) 0)))
(global unit rock_player none)

(script continuous find_closest
(if (and (volume_test_object my_trig (player)) (volume_test_object my_trig my_powerup)) (set closest_player (player))
;;If both the player and powerup are in the trigger, assign the player to a variable.
(if (not (volume_test_object my_trig closest_player)) (set closest_player none)))
;;Otherwise, if its the player outside of the trigger, remove the player from the variable
(if (< number player_spawn_count) (set number (+ number 1)) (set number 0))
;;Increment numbers. Check all players.
)
(script continuous powerup
(sleep_until (not (volume_test_object my_trig my_powerup)) 5)
;;Wait until the powerup is no longer in the trigger (Used, despawned, etc)
(if (!= closest_player none) (begin
;;If there is a player that was found in that variable for being in there, do this other stuff.
(set rock_player closest_player)
;;Set the player to a different variable.
(object_create rock)
;;Create a rock
(objects_attach rock_player "body" rock "")
;;Attach the rock
(sleep 1800) ;;1 minute
(objects_detach rock_player rock)
;;Remove the rock.
(object_destroy rock)
))
;;Recreate the powerup regardless of what happened to it (If it was not a player picking it up, it will respawn instantly. If a player did pick it up, it waits a minute)
(object_create_anew my_powerup)
)


grunt_eater
Joined: Jan 26, 2011

Everything except biped rigging.


Posted: Sep 8, 2012 05:00 PM    Msg. 20 of 231       
Hey, kirby, i'm trying to make a third person kind of effect for MP. Here's what i thought of.

Add a seat to the player biped. Make that seat driver and gunner, and invisible.

Put a named biped in the map.

Script.
(script continuous 3p
(sleep_until (unit_get_current_flashlight_state (unit (list_get (players) 0))) 1)
(camera_set_first_person "3p-biped")
(camera_control 1)
(vehicle_load_magic 3p-biped "driver" (unit (list_get (players) 0)))
)
My problem is that i feel like, since it's MP, using the "camera_set_first_person" command would affect every player. And the reason i'm not just loading the player into another biped is because i want it to have the same color.

Any ideas?


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 8, 2012 05:44 PM    Msg. 21 of 231       
Quote: --- Original message by: grunt_eater
(vehicle_load_magic 3p-biped "driver" (unit (list_get (players) 0)))
My problem is that i feel like, since it's MP, using the "camera_set_first_person" command would affect every player. And the reason i'm not just loading the player into another biped is because i want it to have the same color.

Any ideas?

Ummm.. re-read the bold areas.. You are loading the player into another biped.... thats exactly what you're doing.. And then you're setting the camera to that bipeds first person view...

If you use any camera commands, you'll loose your HUD (even if you are able to differentiate between players (With OS, you can. Without OS, if you make everyone deathless its plausable))

If you're doing it for merely seeing your body, with this camera biped in your head, you'll get something like this
http://beta.xfire.com/video/48ea1e/
You would need more head movements for better control.

Anyways, If you merely want to see your full body, camera_set_dead would be easier.

If you want to have a third person camera with aiming and HUD, then you're gonna have to load the player into a biped, but you'll sacrifice a decent amount of control doing this.
image

Anyways, you can set the camera location to somewhere else, and then use scenery on each of the bipeds bones to show the biped in FP.


There is a billion ways to do these things, just not really any way that everyone would approve of.


grunt_eater
Joined: Jan 26, 2011

Everything except biped rigging.


Posted: Sep 8, 2012 06:07 PM    Msg. 22 of 231       
1: Oops, should'v copy pasted it, instead rewrote it.
2: I'm using the scenery attach for fp for another thing.
3: I know that i'll loose the hud and ability to crouch. I'm alright with this. my question was, if i used the fixed version of the script in an MP map, would it make it so that when player 0 hit flashlight, it set every players view to his?


kornman00
Joined: Jul 15, 2010


Posted: Sep 8, 2012 06:41 PM    Msg. 23 of 231       
PDFs aren't really that great for this kind of information/knowledge collection/distribution. Why not use a wiki? Can be easily updated from anywhere, no one has to download an entire file for just one part, and parts can actually be linked to instead of "hey, download this file and goto page X"


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 8, 2012 07:02 PM    Msg. 24 of 231       
if you can determine the local player, you could have it so only that player activates the camera commands. Without OS, you dont really have many options. For it running in the background, everyone would have to be deathless, and associate a player in a spawn volume as the local player at the start (since its deathless, unless someone else joined at the same time, you should be the only one there)
Next, would be to have a UI widget. You could either use this widget to directly select a player number that you want to have considered as your local player (regardless of whether it is or not), or, have one where it uses cutscene titles, and asks you to press flashlight at certain times to figure out what player you are (which would have to be re-applied every spawn)

This script can be optimized a decent amount, but im to lazy to. Optimizing would actually make it look more complex other than removing the set true's when they arent needed (I was mostly copying and pasting. Thats where most of the shrink will come from though if you do optimize it.)
(global unit local_player none)
(global boolean local_player_0 false)
(global boolean local_player_1 false)
(global boolean local_player_2 false)
(global boolean local_player_3 false)
(global boolean local_player_4 false)
(global boolean local_player_5 false)
(global boolean local_player_6 false)
(global boolean local_player_7 false)
(global boolean local_player_8 false)
(global boolean local_player_9 false)
(global boolean local_player_10 false)
(global boolean local_player_11 false)
(global boolean local_player_12 false)
(global boolean local_player_13 false)
(global boolean local_player_14 false)
(global boolean local_player_15 false)
(global short count 0)
(script dormant assign_local_player
(cinematic_set_title have_flashlight_on)
(cinematic_set_title three)
(sleep 30)
(cinematic_set_title two)
(sleep 30)
(cinematic_set_title one)
(sleep 30)
(if (unit_get_current_flashlight_state (unit (list_get (players) 0)))
(set local_player_0 true) (set local_player_0 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 1)))
(set local_player_1 true) (set local_player_1 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 2)))
(set local_player_2 true) (set local_player_2 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 3)))
(set local_player_3 true) (set local_player_3 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 4)))
(set local_player_4 true) (set local_player_4 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 5)))
(set local_player_5 true) (set local_player_5 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 6)))
(set local_player_6 true) (set local_player_6 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 7)))
(set local_player_7 true) (set local_player_7 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 8)))
(set local_player_8 true) (set local_player_8 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 9)))
(set local_player_9 true) (set local_player_9 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 10)))
(set local_player_10 true) (set local_player_10 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 11)))
(set local_player_11 true) (set local_player_11 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 12)))
(set local_player_12 true) (set local_player_12 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 13)))
(set local_player_13 true) (set local_player_13 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 14)))
(set local_player_14 true) (set local_player_14 false))
(if (unit_get_current_flashlight_state (unit (list_get (players) 15)))
(set local_player_15 true) (set local_player_15 false))
(cinematic_set_title have_flashlight_off)
(cinematic_set_title three)
(sleep 30)
(cinematic_set_title two)
(sleep 30)
(cinematic_set_title one)
(sleep 30)
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 0)))) local_player_0)
(set local_player_0 true) (set local_player_0 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 1)))) local_player_1)
(set local_player_1 true) (set local_player_1 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 2)))) local_player_2)
(set local_player_2 true) (set local_player_2 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 3)))) local_player_3)
(set local_player_3 true) (set local_player_3 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 4)))) local_player_4)
(set local_player_4 true) (set local_player_4 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 5)))) local_player_5)
(set local_player_5 true) (set local_player_5 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 6)))) local_player_6)
(set local_player_6 true) (set local_player_6 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 7)))) local_player_7)
(set local_player_7 true) (set local_player_7 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 8)))) local_player_8)
(set local_player_8 true) (set local_player_8 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 9)))) local_player_9)
(set local_player_9 true) (set local_player_9 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 10)))) local_player_10)
(set local_player_10 true) (set local_player_10 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 11)))) local_player_11)
(set local_player_11 true) (set local_player_11 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 12)))) local_player_12)
(set local_player_12 true) (set local_player_12 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 13)))) local_player_13)
(set local_player_13 true) (set local_player_13 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 14)))) local_player_14)
(set local_player_14 true) (set local_player_14 false))
(if (and (not (unit_get_current_flashlight_state (unit (list_get (players) 15)))) local_player_15)
(set local_player_15 true) (set local_player_15 false))
(cinematic_set_title have_flashlight_on)
(cinematic_set_title three)
(sleep 30)
(cinematic_set_title two)
(sleep 30)
(cinematic_set_title one)
(sleep 30)
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 0))) local_player_0)
(set local_player_0 true) (set local_player_0 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 1))) local_player_1)
(set local_player_1 true) (set local_player_1 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 2))) local_player_2)
(set local_player_2 true) (set local_player_2 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 3))) local_player_3)
(set local_player_3 true) (set local_player_3 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 4))) local_player_4)
(set local_player_4 true) (set local_player_4 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 5))) local_player_5)
(set local_player_5 true) (set local_player_5 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 6))) local_player_6)
(set local_player_6 true) (set local_player_6 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 7))) local_player_7)
(set local_player_7 true) (set local_player_7 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 8))) local_player_8)
(set local_player_8 true) (set local_player_8 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 9))) local_player_9)
(set local_player_9 true) (set local_player_9 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 10))) local_player_10)
(set local_player_10 true) (set local_player_10 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 11))) local_player_11)
(set local_player_11 true) (set local_player_11 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 12))) local_player_12)
(set local_player_12 true) (set local_player_12 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 13))) local_player_13)
(set local_player_13 true) (set local_player_13 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 14))) local_player_14)
(set local_player_14 true) (set local_player_14 false))
(if (and (unit_get_current_flashlight_state (unit (list_get (players) 15))) local_player_15)
(set local_player_15 true) (set local_player_15 false))
(if local_player_0 (set count 1) (set count 0))
(if local_player_1 (set count (+ count 1)))
(if local_player_2 (set count (+ count 1)))
(if local_player_3 (set count (+ count 1)))
(if local_player_4 (set count (+ count 1)))
(if local_player_5 (set count (+ count 1)))
(if local_player_6 (set count (+ count 1)))
(if local_player_7 (set count (+ count 1)))
(if local_player_8 (set count (+ count 1)))
(if local_player_9 (set count (+ count 1)))
(if local_player_10 (set count (+ count 1)))
(if local_player_11 (set count (+ count 1)))
(if local_player_12 (set count (+ count 1)))
(if local_player_13 (set count (+ count 1)))
(if local_player_14 (set count (+ count 1)))
(if local_player_15 (set count (+ count 1)))
(if (!= count 1) (cinematic_set_title error_deciding_local_player) (begin
(if (local_player_0) (set local_player (unit (list_get (players) 0)))
(if (local_player_1) (set local_player (unit (list_get (players) 1)))
(if (local_player_2) (set local_player (unit (list_get (players) 2)))
(if (local_player_3) (set local_player (unit (list_get (players) 3)))
(if (local_player_4) (set local_player (unit (list_get (players) 4)))
(if (local_player_5) (set local_player (unit (list_get (players) 5)))
(if (local_player_6) (set local_player (unit (list_get (players) 6)))
(if (local_player_7) (set local_player (unit (list_get (players) 7)))
(if (local_player_8) (set local_player (unit (list_get (players) 8)))
(if (local_player_9) (set local_player (unit (list_get (players) 9)))
(if (local_player_10) (set local_player (unit (list_get (players) 10)))
(if (local_player_11) (set local_player (unit (list_get (players) 11)))
(if (local_player_12) (set local_player (unit (list_get (players) 12)))
(if (local_player_13) (set local_player (unit (list_get (players) 13)))
(if (local_player_14) (set local_player (unit (list_get (players) 14)))
(if (local_player_15) (set local_player (unit (list_get (players) 15)))
))))))))))))))))
))
)


Connect it to a UI widget, and then when you're doing your checks in your other script, check 'local_player' for the conditions instead. Since local_player is gonna be different on every computer, the condition wont be met on other peoples computers when its met on yours.
There is a bunch of cinematic titles that need to be added in; telling the player to have his flashlight on or off after the countdowns finish. the countdowns themselves. and the error if it cannot single out a single player (whether it finds more than 1 player matching the criteria, or none)

Also, using camera commands doesnt effect your crouch, idk where you got that idea. It was riding a biped that messed with the ability to crouch, and it was for the biped you where riding.


grunt_eater
Joined: Jan 26, 2011

Everything except biped rigging.


Posted: Sep 8, 2012 07:33 PM    Msg. 25 of 231       
That sounds like a lot of work for something that would take so much work after completion. And camera set dead would make it so that you couldn't aim very well...Hmmmmm...Is it possible to make it so that when you're in a vehicle and it begins to move forward, it plays an animation of the player running? i'm thinking loading the player into a biped seat, fully visible. And making the biped being controlled invisible. And making it so that when you hold forward, it plays the animation, on the player in the seat, of the player running.


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 8, 2012 07:40 PM    Msg. 26 of 231       
the acc-front-back, etc, probably do it; Never really bothered that much about animations for inside vehicles. If I do, I do it lazily by just stamping some IK's for the seat, and using the vehicles animation to do whatever. You know how the warthog gunner, chief will crouch and stuff as it aims? That stuff. I'm lazy like that.

Anyways, if you're doing that with a biped, idk how well it will respond. Normally when entering a biped, you repeat the entry animation over and over again...


grunt_eater
Joined: Jan 26, 2011

Everything except biped rigging.


Posted: Sep 8, 2012 10:42 PM    Msg. 27 of 231       
I believe that's because it's a script continuous. like
(script continuous blah
(sleep_until (unit_get_current_flashlight_state (unit (list_get (players) 0))) 1)
(vehicle_load_magic warthog "driver" (unit (list_get (players) 0)))
)
I believe a way to fix this is with a script like this
(script dormant blah_blah
(unit_set_desired_flashlight_state (unit (list_get (players) 0)) 0)
(vehicle_load_magic warthog "driver" (unit (list_get (players) 0)))
)
(script continuous blah
(sleep_until (unit_get_current_flashlight_state (unit (list_get (players) 0))) 1)
(wake blah_blah)
)


Am i right, or mistaken?


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 8, 2012 11:12 PM    Msg. 28 of 231       
you're mistaken. Its just bipeds. Loading a vehicle works fine. Also, things that only activate while you are inside the unit (like the invisible driver) will activate, which is showing that you aren't exiting and re-entering.


game user10
Joined: Dec 9, 2011

Who is the Overseer?


Posted: Sep 9, 2012 12:39 AM    Msg. 29 of 231       
Man this is epic.
Is it possible to make AI use teleporters?
I'm trying to script five AI encounters (one AI each) to use teleporters in ratrace.
So far, I've named the teleporters: Teleporter1a, Teleporter1b, Teleporter2a and Teleporter2b

I'm scripting it with trigger volumes named after the teleporter they are near.

This is the script but I have no idea if this will work.

(script continuous player1teleporter1a
(if
(and (volume_test_objects "Teleporter1a" (ai_actors "Player1/Player1")) ((>= real_random_range 0 1) 0.5)
(ai_command_list Player1 Teleporter1a)
)


The rest should be copy-paste, right?
Edited by game user10 on Sep 9, 2012 at 12:42 AM


Dumb AI
Joined: Sep 18, 2011

Dead.


Posted: Sep 9, 2012 01:49 AM    Msg. 30 of 231       
Quote: --- Original message by: game user10

Man this is epic.
Is it possible to make AI use teleporters?
I'm trying to script five AI encounters (one AI each) to use teleporters in ratrace.
So far, I've named the teleporters: Teleporter1a, Teleporter1b, Teleporter2a and Teleporter2b

I'm scripting it with trigger volumes named after the teleporter they are near.

This is the script but I have no idea if this will work.

(script continuous player1teleporter1a
(if
(and (volume_test_objects "Teleporter1a" (ai_actors "Player1/Player1")) ((>= real_random_range 0 1) 0.5)
(ai_command_list Player1 Teleporter1a)
)


The rest should be copy-paste, right?
Edited by game user10 on Sep 9, 2012 at 12:42 AM

This might work.You should test it.


game user10
Joined: Dec 9, 2011

Who is the Overseer?


Posted: Sep 9, 2012 03:07 AM    Msg. 31 of 231       
A possible problem is that they will spam the teleporters indefinitely, so I think I need to revise it a bit more...


antiblood
Joined: Jul 17, 2010

Hail satan, smoke mehth


Posted: Sep 9, 2012 06:55 AM    Msg. 32 of 231       
my friend Peep210 was working on a map called Base Havoc and in a more updated version that was never uploaded to halomaps he was useing a strange way to keep his map from leaking. you had to enter some stupid dev code authc 4312 or something and in like 5 or so seconds within loading the map or else it crashed. since he is MIA i checked this out with the script extractor. idk if anyone will find this usefull but this is the script it pulled up.
if some one can tell me what the code was id be gratefull as i wouldnt mind playing the map...

(global bool server false)

(global bool init true)

(global short caat 0)

(global short authc 0)

(global bool red_fact_use false)

(global bool blue_fact_use false)

(global bool red_fact_lift false)

(global bool blue_fact_lift false)

(global bool playcred false)

(script startup void server_init
(begin
(object_destroy sync_serv_b)
(sleep 15)
(units_set_current_vitality sync_serv 1.00 1.00)
(sleep 5)
(if
(=
(unit_get_shield sync_serv) 0.00)
(begin
(set server true)
(object_create_anew sync_serv_b)
(object_destroy sync_serv)
(object_destroy sync_or0gr)
(object_destroy sync_or1gr)
(object_destroy sync_vfact0)
(object_destroy sync_vfact1)
(object_destroy sync_ff)
(object_destroy sync_cr)
(object_create ls0)
(object_create ls1)
(object_create peli0)
(object_create peli1)
(object_create ls2)
(object_create ls3)
(object_create ph)
(object_create ph2)
(object_create tur1)
(object_create tur2))
(begin
(set server false)
(object_destroy sync_or0gr_b)
(object_destroy sync_or1gr_b)
(object_destroy sync_vfact0_b)
(object_destroy sync_vfact1_b)
(object_destroy sync_ff_b)
(object_destroy sync_cr_b)))
(set init false)
(ai_place radaren/radar1)
(if server
(begin
(sleep 1000)
(if
(!= authc 4312)
(quit))))))

(script static void wait_red_vfact
(begin
(sleep_until red_fact_lift)
(device_set_position red_vfact 1.00)
(sleep 10)
(device_set_position red_vlift 1.00)
(sleep_until
(=
(device_get_position red_vlift) 1.00))
(if server
(object_create sync_vfact0_b))
(device_set_position red_vfact 0.00)
(sleep_until
(=
(device_get_position red_vfact) 0.00))
(device_set_position_immediate red_vlift 0.00)
(device_set_position_immediate red_btn_wart 0.00)
(device_set_position_immediate red_btn_tank 0.00)
(set red_fact_lift false)
(set red_fact_use false)))

(script continuous void red_bld_wart
(begin
(if init
(sleep 100))
(if server
(begin
(sleep_until
(and
(=
(device_get_position red_btn_wart) 1.00)
(not red_fact_use)))
(set red_fact_use true)
(device_set_position red_wart_sp 1.00)
(sleep 2)
(device_set_position red_wart_sp 0.00)
(set red_fact_lift true)
(object_destroy sync_vfact0_b))) red_bld_wart))

(script continuous void red_bld_tank
(begin
(if init
(sleep 100))
(if server
(begin
(sleep_until
(and
(=
(device_get_position red_btn_tank) 1.00)
(not red_fact_use)))
(set red_fact_use true)
(device_set_position red_tank_sp 1.00)
(sleep 2)
(device_set_position red_tank_sp 0.00)
(set red_fact_lift true)
(object_destroy sync_vfact0_b))) red_bld_tank))

(script static void wait_blue_vfact
(begin
(sleep_until blue_fact_lift)
(device_set_position blue_vfact 1.00)
(sleep 10)
(device_set_position blue_vlift 1.00)
(sleep_until
(=
(device_get_position blue_vlift) 1.00))
(if server
(object_create sync_vfact1_b))
(device_set_position blue_vfact 0.00)
(sleep_until
(=
(device_get_position blue_vfact) 0.00))
(device_set_position_immediate blue_vlift 0.00)
(device_set_position_immediate blue_btn_wart 0.00)
(device_set_position_immediate blue_btn_tank 0.00)
(set blue_fact_lift false)
(set blue_fact_use false)))

(script continuous void blue_bld_wart
(begin
(if init
(sleep 100))
(if server
(begin
(sleep_until
(and
(=
(device_get_position blue_btn_wart) 1.00)
(not blue_fact_use)))
(set blue_fact_use true)
(device_set_position blue_wart_sp 1.00)
(sleep 2)
(device_set_position blue_wart_sp 0.00)
(set blue_fact_lift true)
(object_destroy sync_vfact1_b))) blue_bld_wart))

(script continuous void blue_bld_tank
(begin
(if init
(sleep 100))
(if server
(begin
(sleep_until
(and
(=
(device_get_position blue_btn_tank) 1.00)
(not blue_fact_use)))
(set blue_fact_use true)
(device_set_position blue_tank_sp 1.00)
(sleep 2)
(device_set_position blue_tank_sp 0.00)
(set blue_fact_lift true)
(object_destroy sync_vfact1_b))) blue_bld_tank))

(script continuous void device_sync
(begin
(if server
(begin
(if
(=
(device_group_get or0gr) 1.00)
(object_destroy sync_or0gr_b)
(object_create sync_or0gr_b))
(if
(=
(device_group_get or1gr) 1.00)
(object_destroy sync_or1gr_b)
(object_create sync_or1gr_b))
(if
(=
(device_group_get crfl) 1.00)
(object_destroy sync_ff_b)
(object_create sync_ff_b)))
(begin
(if
(=
(unit_get_shield sync_or0gr) 0.00)
(device_group_set or0gr 1.00)
(device_group_set or0gr 0.00))
(if
(=
(unit_get_shield sync_or1gr) 0.00)
(device_group_set or1gr 1.00)
(device_group_set or1gr 0.00))
(if
(=
(unit_get_shield sync_ff) 0.00)
(device_group_set crfl 1.00)
(device_group_set crfl 0.00))
(if
(=
(unit_get_shield sync_vfact0) 0.00)
(set red_fact_lift true))
(if
(=
(unit_get_shield sync_vfact1) 0.00)
(set blue_fact_lift true))
(units_set_current_vitality sync_or0gr 1.00 1.00)
(units_set_current_vitality sync_or1gr 1.00 1.00)
(units_set_current_vitality sync_vfact0 1.00 1.00)
(units_set_current_vitality sync_vfact1 1.00 1.00)
(units_set_current_vitality sync_ff 1.00 1.00)))
(sleep 2)))

(script continuous void lift
(begin
(if
(volume_test_objects vplat
(players))
(device_set_position plat 1.00)
(device_set_position plat 0.00))))

(script continuous void odoor
(begin
(if init
(sleep 100))
(if server
(begin
(sleep_until
(and
(=
(device_get_position overred) 1.00)
(not red_fact_use)))
(set red_fact_use true)
(set red_fact_lift true)
(object_destroy sync_vfact0_b)
(device_set_position overred 0.00))) odoor))

(script continuous void ckeyatt
(begin
(if
(volume_test_object kvol
(list_get
(players) caat))
(begin
(object_create_anew ckey)
(objects_attach
(list_get
(players) caat) ckey )))
(set caat
(+ caat 1.00))
(if
(= caat 16)
(set caat 0))))

(script continuous void ckeypow
(begin
(if
(volume_test_object crvol ckey)
(device_set_power ffbtn 1.00)
(device_set_power ffbtn 0.00))))

(script continuous void creds
(begin
(sleep_until
(volume_test_objects credvol
(players)))
(device_set_position_immediate cred 0.00)
(camera_control true)
(camera_set credcam 1)
(device_set_position cred 1.00)
(sleep_until
(=
(device_get_position cred) 1.00))
(volume_teleport_players_not_inside vplat center)
(camera_control false)
(sleep 50)
(sleep_until
(=
(volume_test_objects credvol
(players)) false))))

(script continuous void credsst
(begin
(sleep_until
(=
(device_get_position ccaam) 1.00))
(device_set_position_immediate ccaam 0.00)
(volume_teleport_players_not_inside credvol cre)))

Edited by antiblood on Sep 9, 2012 at 07:02 AM


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 9, 2012 10:52 AM    Msg. 33 of 231       
Quote: --- Original message by: antiblood
my friend Peep210 was working on a map called Base Havoc and in a more updated version that was never uploaded to halomaps he was useing a strange way to keep his map from leaking. you had to enter some stupid dev code authc 4312 or something and in like 5 or so seconds within loading the map or else it crashed. since he is MIA i checked this out with the script extractor. idk if anyone will find this usefull but this is the script it pulled up.
if some one can tell me what the code was id be gratefull as i wouldnt mind playing the map...

<STUFF>
(if (!= authc 4312) (quit))
<STUFF>


For the host, it waits just over 30 seconds, and if the host hasn't used 'set authc 4312' in devmode, it will quit. Another way would be 'sleep -1 server_init' Anyways, you claim hes your friend, yet your making sure everyone knows how to play his private map?..


ChBgt909
Joined: Sep 10, 2011

ᶘ ᵒᴥᵒᶅ


Posted: Sep 9, 2012 02:32 PM    Msg. 34 of 231       
is there a way to make an AI appear in a MP game when one player stays alone in the server after certain amount of time? it keeps respawning and all, but as soon as someone else joins the server the AI disappear and if only one player remains again the AI will appear again


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 9, 2012 03:44 PM    Msg. 35 of 231       
So, are you tagging them to respawn, or are you scripting their respawn?
(script continuous tag_respawned
(if (!= player_spawn_count 1) (begin (ai_erase_all) (ai false)) (ai true))
)

If you have the settings in the scenario to respawn them, use that ^^. You can add a sleep in there if you want, but that could allow AI to spawn for short periods of time before being wiped.

(global short ai_count 10)
(script continuous script_respawn_nonwave
(if (!= player_spawn_count 1) (begin
(ai_erase_all)
(ai false)
(sleep_until (= player_spawn_count 1) 15)
)
(if (< (ai_living_count YourEncounter) ai_count) (ai_place YourEncounter))
)
)

Doing that, you want your encounter to be set to only have one spawned at a time, and the script will place a single one everytime it gets blow the ai_count. set ai_count to however many you want spawned at once.

If you want to spawn them in waves, then make your encounter have more AI, switch the great to a less than, and make ai_count the number you want it to drop below before a new wave shows up.


Anyways, the only issue is if its a dedicated server... there could be 1 player, but he wouldnt be the host. You can have a startup script that checks if player_spawn_count is 0 a few moments after the map loads, and if it is, it knows its a dedi.

 
Page 1 of 7 Go to page: · [1] · 2 · 3 · 4 · 5 · 6 · 7 · Next

 
Previous Older Thread    Next newer Thread







Time: Mon September 16, 2019 1:03 AM 500 ms.
A Halo Maps Website