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 »How to synchronize scripted weapons

Author Topic: How to synchronize scripted weapons (2 messages, Page 1 of 1)
Moderators: Dennis

SGWraith
Joined: Apr 15, 2006

[SG] Clan


Posted: Aug 9, 2007 01:03 PM    Msg. 1 of 2       
I am trying to make a H2 Fiesta mode script for Halo Ce but I am running into a lot of synchronization issues. I'm trying to adapt the player_add_equipment command for use in this script with unit_get_health and some global variables as my loop controls.

In starting equipment I gave everyone a pistol, then using my script I will give them a random secondary weapon. For now its not random for debugging purposes but here are some of the crazy things that happen after the script has been running for awhile:

Quote:
* Player switches from their secondary to their pistol and on everyone else's screen the secondary appears to have been left in midair where they switched. If they switch back it dissappears. Both weapons behave normally otherwise, make sound, and do damage.

* Player switches from the pistol to their secondary but everyone else sees the owner holding their pistol out. If the owner shoots the weapon no one takes damage, no one sees the damage effect, and no one hears a weapon being fired. If they switch back to the pistol they can do damage again but not with the secondary out.

* Player switches from the pistol to their secondary and again no one can see the secondary. This time though the owners hands are out and appear to be holding it. It can not be heard and the projectiles can not be seen but it does damage anyway.


I partially understand how a vehicle syncing script works (there is a sample in EHSv2) and thought some of the same principles might apply. However, I can't name weapons for use with the player_add_equipment command and when I tried to include the is_server concept the script only affected the host player but with all the aforementioned issues still present.

I guess if I can't get player_add_equipment to sync I guess this idea is sunk. Any suggestions would be appreciated. If you want to use this script idea go ahead, all I ask is credit for the original idea and that if you get it to work you share it with the rest of us.

* I can post the code if people are interested, though its still buggy and far from being complete.


SGWraith
Joined: Apr 15, 2006

[SG] Clan


Posted: Aug 9, 2007 04:42 PM    Msg. 2 of 2       
*Edit* I was afraid of that Kenney. There isn't a way around it is there? */Edit*

Here is the code. I think most of what I was trying to do gets explained by my comments. The veh_sev code is from EHSv2 and I was trying to use it for script syncing. The flashlight power code is Kirby's. The final version will use something else to trigger it, probably unit_get_health most likely. Profile1 is the name of a starting profile I created for use with the script. It consists of shield value of 1 and a secondary weapon only.


(global boolean is_server false)
(global boolean fiesta_ready true)
(global boolean fiesta_1_ready true)
(script startup veh_sev
(begin
(if (= (unit_get_health check_vehicle) 0.0)
(begin
(set is_server true)
(object_destroy check_vehicle)
) ;; End Begin
) ;; End If unit health
) ;; End Begin
) ;; End Script
(script continuous fiesta
(begin
(if (= is_server true)
(begin
(sleep_until (= (unit_get_current_flashlight_state (unit (list_get (players) 0))) true))
(if (= fiesta_ready true)
(begin
(player_add_equipment (unit (list_get (players) 0)) profile1 true)
(set fiesta_ready false)
) ;; 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
)
) ;; End Sleep
(set fiesta_ready true)
) ;; End Begin
) ;; End If is server
) ;; End Begin
) ;; End Script

(script continuous fiesta_1
(begin
(if (= is_server true)
(begin
(sleep_until (= (unit_get_current_flashlight_state (unit (list_get (players) 1))) true))
(if (= fiesta_1_ready true)
(begin
(player_add_equipment (unit (list_get (players) 1)) profile1 true)
(set fiesta_1_ready false)
) ;; End Begin
) ;; End IF
(sleep_until
(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 Sleep
(set fiesta_1_ready true)
) ;; End Begin
) ;; End If is server
) ;; End Begin
) ;; End Script



Edited by SGWraith on Aug 9, 2007 at 04:59 PM

 

 
Previous Older Thread    Next newer Thread







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