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 »question about weapon respawns (scripting?)

Author Topic: question about weapon respawns (scripting?) (4 messages, Page 1 of 1)
Moderators: Dennis

Yoda
Joined: Jan 30, 2011

Do or do not, there is no try


Posted: Feb 13, 2013 10:28 AM    Msg. 1 of 4       
Hey,

I need to know if there is some way or some script that would allow me to prevent a weapon from respawning until it has been dropped and dissappeared.

It is for the triggerable explosives that I made for Halo Star Wars. I need to make it so that if it is picked up by a player it will not respawn until that player drops it and it dissappears. If more than one exist in the map at any given time then they conflict with eachother.

Thanks


Sceny
Joined: Nov 20, 2010

Awesome Faggot!


Posted: Feb 13, 2013 04:33 PM    Msg. 2 of 4       
Could probably be simplified. Place the weapon you want in sapien (not the item collection tag).

(global short rox 0)

(script continuous rox_more
(set rox 0)
(sleep 300)
(if (= rox 0) (object_create_anew rocket_launcher))
)

(script continuous no_rox
(begin (if (unit_has_weapon (unit (list_get (players) 0)) "weapons\rocket launcher\rocket launcher")
(set rox 1)))
)


Yoda
Joined: Jan 30, 2011

Do or do not, there is no try


Posted: Feb 13, 2013 06:59 PM    Msg. 3 of 4       
Quote: --- Original message by: Sceny
Could probably be simplified. Place the weapon you want in sapien (not the item collection tag).

(global short rox 0)

(script continuous rox_more
(set rox 0)
(sleep 300)
(if (= rox 0) (object_create_anew rocket_launcher))
)

(script continuous no_rox
(begin (if (unit_has_weapon (unit (list_get (players) 0)) "weapons\rocket launcher\rocket launcher")
(set rox 1)))
)


This will cause it to wait until the weapon dissappears to spawn a new one?


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Feb 13, 2013 08:36 PM    Msg. 4 of 4       
If you just want a new one to respawn when the other one is gone, just use an object_create. that way, it can only create one when the other one is gone (create_anew deletes the old one, and replaces it)

Both of those posted have large problems. Its only checking player0, and sali's, if player0 doesnt pick it up before it despawns, it will never respawn.

Anyways, easiest way is to just have a continuous script with object_create, that only runs on the host machine (use host testing) because if clients run the script, they will create fakes that only they can see, etc.
(global boolean host false)
(script startup host_check
(sleep 5)
(if (!= (unit_get_health HOST_TESTING_VEHICLE) -1) (set host true))
)
(script continuous respawn_weapon
(sleep 30)
(if host (object_create RANDOMWEAPON))
)

If you have a random pit that you want it to automatically respawn from, just place a trigger volume down there with an object_destroy or object_create_anew.

 

 
Previous Older Thread    Next newer Thread







Time: Fri January 20, 2023 1:34 PM 140 ms.
A Halo Maps Website