• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Need help in creating a script/trigger

Status
Not open for further replies.
Level 6
Joined
Feb 16, 2014
Messages
193
I'm making a shooter map,I'm gonna change the gold to bullets in the Game interface settings because i want everytime a unit attacks/shoots then 1 gold will be subtracted to the owner of the unit.So how do i create a trigger/script to do that? :vw_wtf:
 
Last edited:
Level 15
Joined
Aug 7, 2013
Messages
1,342
You can use a unit event--I tried googling but couldn't find an ammo system/tutorial I could link you to.

In any case, trying using an event like Event - A unit is attacked.

Inside the trigger action, you will get the attacking unit, and from that get the owner of the attacking unit. Then simply subtract their gold based on how much ammo is used in each shot (could vary based on weapons).

Note this won't prevent someone from shooting if they have no ammo--instead you'd have to detect when a player's gold is 0, and then order their unit to stop attacking.
 
Level 12
Joined
Nov 3, 2013
Messages
989
How does shooting work? Is it an ability? normal auto attack?

If it's an ability you could maybe even use the ability "charge gold and lumber" as a base.

if you want a target ability or so then you should reduce gold when the ability is cast with trigger and it should be a tech tree requirement for the ability to have "ammo", either an upgrade or a unit, so that you can use the ability without having gold. (you'd make it so when a player doesn't have any gold you remove the upgrade or unit)
 
Level 6
Joined
Feb 16, 2014
Messages
193
Thx for the answers guys :) @sethmachine I tried what u said and it worked Thx :)
Well, +rep for all of you :D
 
Last edited:
Status
Not open for further replies.
Top