View Full Version : Serpent Ward Trigger
Kabel
03-30-2009, 03:46 PM
I use Summon Serpent Ward spell to summon a unit.
The unit is not summoned for free, a trigger removes a set amount of gold and lumber every time a unit is summoned. But if a player has 50 gold in his bank and the spell "costs" 100 gold, the spell is casted anyway and only the 50 gold is removed.
I want this spell to be cast only if:
- Casting player has required amount of gold
- Casting player has required amount of lumber
- Casting player has enough food
So players can not summon units this way if they dont have enough gold and lumber to pay for the unit. Same goes with food, they need to have farms etc.
Any ideas how to make this?
M4stah
03-30-2009, 03:56 PM
Use the event Unit starts casting a ability, it starts when you click the button. Make a if/then/else trigger with the conditions and as else(Or then, depends on your trigger) Order triggering unit to stop
krisserz
03-30-2009, 04:00 PM
Ok so look. I have created the easiest trigger. Of course you will have to add costs of this spell etc. I didn`t have enough time to set food costs.
toofless
03-30-2009, 04:04 PM
No problem.
make this trigger:
YOUR TRIGGER
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to YOURABILITY
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of (Triggering unit)) Current gold) Less than 100
Then - Actions
Unit - Order (Triggering unit) to Stop
Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: Not enough gold!
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of (Triggering unit)) Food used) Greater than (((Owner of (Triggering unit)) Food max) - 5)
Then - Actions
Unit - Order (Triggering unit) to Stop
Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: Not enough food!
Else - Actions
Change the ability in the first IF to your summon ability.
In the last IF
"((Owner of (Triggering unit)) Food used) Greater than (((Owner of (Triggering unit)) Food max) - 5)"
Change 5 to the TOTAL food cost of the spell.
Kabel
03-30-2009, 04:12 PM
Thanks a lot for the quick answears!
alfreeedo
03-30-2009, 04:27 PM
hm.. i dont know if i undrestood ur mean correctly but . i have an aidea.
1 ) make a integer var to save the level of ur spell of ur unit.
2 ) make a dummy passive spell (which does nothing ) also play with this new spell tooltips to add what kind of resource is required as a string.
3 ) set ur dummy spell icon similar to ur main spell but with black border and a little more dark...so it looks like a disabled icon .
// i dont know how ur unit earn golds.. or lumber or food..
but anyhow via some triggers
check if u dont have enough resources
---- set the integer u made before to level of ur main ability of ur unit
---- remove ur main ability from ur unit
---- add ur dummy ability to ur unit
// so he cant cast now becuase his spell is a disbaled spell
then
check when u have greatthan or equal than the amount of resources u want
---- remove ur dummy spell from ur unit
---- add ur main spell to ur unit
---- set level of ur main spell of ur unit to the integer u saved before.
i hope it be close to what u r looking for.
this is kinda better than ordering unit to stop casting becuase his spell is still click able ;P i more like to see players cant click on their spells if they dont have what that spell required.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.
Search Engine Optimization by
vBSEO 3.5.1 PL2