| 09-22-2002, 01:43 AM | #1 |
Guest | Or even how to capture them in conditions? I've added an Item - Summon Skeletons ability to a unit. However, with no cooldown and no cost, it lies solely on the user not to abuse the ability and summon ten-thousand skeletons. While I would like to believe that most people would understand the unreasonability of doing so, I cannot believe that no one would, and so would like to prevent them from doing so. How do I either create a cooldown for the item ability, or at least be able to capture when they use it, so that I can then remove the ability from the unit, making it a one-time use? As a side, why can't abilities be added to units, but only removed? Or if they can, how please? Thanks. |
| 09-22-2002, 05:06 AM | #2 |
Guest | Yes, abilities cannot be added, dunno why... Anyways, for the item... hmm... interesting... Try doing something like: Event: Hero Uses an Item Condition: item = summon skeletons SkeletonTimer=0 Action: Start SkeletonTimer (6 seconds or so) Display text: Item used! Create 2 skeletons at position of unit manipulating item Event: Hero Uses an Item Condition: item = summon skeletons SkeletonTimer NotEqual to 0 Action: Display text: Item cannot be used for string=value of timer So that makes it so the timer HAS to run out to use the item. These trigegrs can me modified too. |
| 09-22-2002, 06:02 AM | #3 |
Guest | I thought that I tried that or something like that already, but I'll try it again. The problem with it, and why I doubt it, is that the unit is not a hero, and the item isn't really an item, it's just the ability of an item. The unit is actually a building. I just want it to have the ability to summon skeletons like a Book of the Dead (4 skeleton warriors and 4 skeleton archers). That part works fine, but when I wrote a trigger to echo the command (converted to string), nothing returned. So I don't know what the command is called either. |
| 09-22-2002, 06:05 AM | #4 |
Guest | While we're on it, any ideas on how to convert trained elementals to summoned elementals? Currently, I'm writing triggers to capture their finishing training, waiting 75 seconds, and then killing them. But there's no way for the user to know how many seconds are left before it expires. If I could just convert it to a summoned creature, he or she could see. |
| 09-22-2002, 06:14 AM | #5 |
Guest | I should mention, that I was able to get the trigger to run based on Event - Unit - A unit owned by Player 1 (Red) Is issued an order with no target. So that's also why I don't think the hero trigger will work. It's capturing it as an order and not uses item. Anyway, enough talk, let me go try. |
| 09-22-2002, 06:23 AM | #6 |
Guest | for summing units specifically, you can use the event player's unit action and the action being being summoned although i think using a book of dead will call this event 8 times... |
| 09-22-2002, 06:40 AM | #7 |
Guest | Well, it didn't work. Nothing was captured by the building. I did use a hero to test it, and it doesn't quite work right either. It did give me the "cannot be used for...." message, but that was after I'd already used it anyway. So it would need to capture it before the item was used for that to work. But I really don't want to prevent heroes from using the book of the dead if they find one. I would likely want a cooldown time closer to twenty seconds. Anyway, here's the trigger if you want to look at it. _______________________________ function Trig_Summon_Skeletons__Hero_Conditions takes nothing returns boolean if ( not ( GetItemTypeId(GetManipulatedItem()) == 'fgsk' ) ) then return false endif if ( not ( TimerGetRemaining(udg_SkeletonTimer) == 0.00 ) ) then return false endif return true endfunction function Trig_Summon_Skeletons__Hero_Actions takes nothing returns nothing call StartTimerBJ( udg_SkeletonTimer, false, 6.00 ) call QuestMessageBJ( GetForceOfPlayer(ConvertedPlayer(GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())))), bj_QUESTMESSAGE_UNITACQUIRED, "TRIGSTR_548" ) endfunction //=========================================================================== function InitTrig_Summon_Skeletons__Hero takes nothing returns nothing set gg_trg_Summon_Skeletons__Hero = CreateTrigger( ) call TriggerRegisterPlayerUnitEventSimple( gg_trg_Summon_Skeletons__Hero, Player(0), EVENT_PLAYER_UNIT_USE_ITEM ) call TriggerAddCondition( gg_trg_Summon_Skeletons__Hero, Condition( function Trig_Summon_Skeletons__Hero_Conditions ) ) call TriggerAddAction( gg_trg_Summon_Skeletons__Hero, function Trig_Summon_Skeletons__Hero_Actions ) endfunction _______________________________ and the trigger to feedback time left.... _______________________________ function Trig_Summon_Skeletons_Cooldown_Conditions takes nothing returns boolean if ( not ( GetItemTypeId(GetManipulatedItem()) == 'fgsk' ) ) then return false endif if ( not ( TimerGetRemaining(udg_SkeletonTimer) > 0.00 ) ) then return false endif return true endfunction function Trig_Summon_Skeletons_Cooldown_Actions takes nothing returns nothing call QuestMessageBJ( GetForceOfPlayer(ConvertedPlayer(GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())))), bj_QUESTMESSAGE_UPDATED, ( "Item may not be used for " + ( R2S(TimerGetRemaining(udg_SkeletonTimer)) + " more seconds." ) ) ) endfunction //=========================================================================== function InitTrig_Summon_Skeletons_Cooldown takes nothing returns nothing set gg_trg_Summon_Skeletons_Cooldown = CreateTrigger( ) call TriggerRegisterPlayerUnitEventSimple( gg_trg_Summon_Skeletons_Cooldown, Player(0), EVENT_PLAYER_UNIT_USE_ITEM ) call TriggerAddCondition( gg_trg_Summon_Skeletons_Cooldown, Condition( function Trig_Summon_Skeletons_Cooldown_Conditions ) ) call TriggerAddAction( gg_trg_Summon_Skeletons_Cooldown, function Trig_Summon_Skeletons_Cooldown_Actions ) endfunction |
| 09-22-2002, 07:34 AM | #8 | ||
Guest | Quote:
GoldenUrg figured out a way to do this the other day... Quote:
Give it a go. For your first problem... it's not going to be easy or pretty. I haven't really got any ideas. |
| 09-22-2002, 07:46 AM | #9 |
Guest | DrunkOM: Thanks. That sounds great. I'll give it a go. To the nasty bit, I tried going the other way, and instead of limiting it to the item ability, I tried checking against the nots. ie._____________ if ( not ( GetIssuedOrderIdBJ() != String2OrderIdBJ("raisedead") ) ) then return false endif However, even though I thought that I had it, Animate Dead (Neutral Hostile) returns a null string for the command name. That's the same as what the Summon Skeletons string returns. So using that triggers the function. -( My last thought is to make a custom unit, and when it finishes training, to replace it with the skeletons. Now with this from GoldenUrg, I could have summoned skeletons. The only downside to this is that if I use the build time to act as cooldown time, it comes on the front side of the summons. In addition, none of the other abilities will work (ie. the raise dead) while training. So I may need to write a delay timer and enable, disable training of the unit. What a hassle, no? p) |
| 09-22-2002, 08:21 AM | #10 |
Guest | Okay, I guessed at what I should write, because I don't actually know the custom text code. But I got it wrong. At least it compiled incorrectly. Here's what I wrote: function Trig_Elemental_Timer_Red_Actions takes nothing returns nothing call UnitApplyTimedLife( GetTrainedUnit(), BFig, 75.00 ) endfunction I searched for the text in the forums, but couldn't find GoldenUrg's original post. Did you find it on another site, DrunkOM? Thanks for your help. |
| 09-22-2002, 08:32 AM | #11 |
Guest |
| 10-06-2002, 07:27 AM | #12 |
Guest | Add apostrophes to sandwich BFig. So... UnitApplyTimedLife( <Getwhatever>, 'BFig', <some number>) |
| 10-07-2002, 07:52 AM | #13 |
Guest | Thank-you so much. Such a little thing these things often are. |
| 10-07-2002, 02:05 PM | #14 |
A few things Event Unit uses skeleton summoning item Action Turn off this trigger Wait 10 seconds (cooldown) turn on this trigger Problem solved ;) Be more creative if you want to add an error message. Also, abilities CAN be added -- just add them to the unit editor beforehand, disable them at map init, and then enable them when you want to give them to the unit. It'll appear as if they've got a enw skill. |
| 10-09-2002, 09:08 AM | #15 |
Guest | Thanks dataangel. I'll remember that. |
