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 »[Script] how does?

Author Topic: [Script] how does? (6 messages, Page 1 of 1)
Moderators: Dennis

Sceny
Joined: Nov 20, 2010

Awesome Faggot!


Posted: May 10, 2012 10:40 AM    Msg. 1 of 6       
How does this command work in a script and how to get it to recognize if the player has a the weapon or not?

(unit_has_weapon <unit> <object_definition>)


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: May 10, 2012 02:36 PM    Msg. 2 of 6       
unit would be the player, object_definition is the tag path for the weapon.

So, seeing if player 0 has a default H1 Pistol, it would be
(unit_has_weapon (unit (list_get (players) 0)) "weapons\pistol\pistol")
If the player has a pistol, it will return true, otherwise false.

You can also use unit_has_weapon_readied to see if its the weapon they currently have in their hands.


Sceny
Joined: Nov 20, 2010

Awesome Faggot!


Posted: May 10, 2012 03:28 PM    Msg. 3 of 6       
Thank you :)


Muscl3r
Joined: May 22, 2010

dont pray 4 easy lives...pray to be STRONGER MEN


Posted: May 13, 2012 03:30 PM    Msg. 4 of 6       
So would this be a valid command?

(if (= (unit_has_weapon (unit (list_get (players) 0)) "weapons\pistol\pistol") 1)
(set (unit_has_weapon (unit (list_get (players) 0)) "weapons\pistol\pistol") 0))


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: May 13, 2012 03:42 PM    Msg. 5 of 6       
nope, set is for global variables. The unit_has_weapon is merely a check, it can't effect the state anyways, there is another command for effecting your items:
(player_add_equipment <unit> <starting_profile> <boolean>)
adds/resets the player's health, shield, and inventory (weapons and grenades) to the named profile. resets if third parameter is true, adds if false.

Use that instead, if you make the boolean at the end true, it will remove their current items and replace it completely with the starting profile you entered.


Muscl3r
Joined: May 22, 2010

dont pray 4 easy lives...pray to be STRONGER MEN


Posted: May 14, 2012 02:34 AM    Msg. 6 of 6       
I remeber experimenting with the loadout commands for a firefight but I could never get it right. Either the player would end up with 6 frags, 3 weapons and half an overshield or, the closest I got, the secondary (un-readied) weapon would be removed, the readied weapon would become secondary and you'd have a new primary weapon. But I couldn't get that to work to replace both the guns. Haven't used that script in a while though so I'm probably capable of getting it to work now.

 

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 7:38 AM 141 ms.
A Halo Maps Website