HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Make him stop!!.. hehe. (jass)

04-10-2004, 03:10 AM#1
sans
I've used some of Vex's spells as reference and a grounds to further develop two of my own, one of them is based off heal. In an *ideal* situation, if the hero tried to cast heal on one of his friendly units and had 0 souls collected, it would out-right tell the player "You have no souls to perform this spell..." Sort of like what happens when you try to cast raise dead without any corpses around. "No usable souls." Or whatever... ANYWAYS.. I got it working where it wont actually heal the unit when the hero has no souls to use, but it loops. The hero will cast and cast and cast and not stop until I give him a new order. And it's kinda retarded that it shows the Hero casting the spell when it's doing absolutely nothing. Here's my code..

Code:
constant function Merge_AbilityId takes nothing returns integer
    return 'A00J' //* Vengence's Ability Rawcode
endfunction

function Merge_MinimumSouls takes nothing returns boolean
    return ( udg_soulharvestSouls > 0 )
endfunction

constant function Merge_HealAmount takes integer level returns real
    return level * 200.00 //* Merge's Heal Formula
endfunction

function Trig_merge_Conditions takes nothing returns boolean
    if ( not GetBooleanAnd( GetSpellAbilityId() == 'A00J', Merge_MinimumSouls() ) ) then
        return false
    endif
    return true
endfunction

function Trig_merge_Actions takes nothing returns nothing
    local unit caster=GetTriggerUnit()
    local integer a=GetUnitAbilityLevel(caster, Merge_AbilityId())
    local real heal=Merge_HealAmount(a)
    call TargetHeal( GetSpellTargetUnit(), ( heal ) )
    set udg_soulharvestSouls = ( udg_soulharvestSouls - 1 )
    call ConditionalTriggerExecute( gg_trg_strength_of_many_ii )
endfunction

//===========================================================================
function InitTrig_merge takes nothing returns nothing
    set gg_trg_merge = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_merge, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_merge, Condition( function Trig_merge_Conditions ) )
    call TriggerAddAction( gg_trg_merge, function Trig_merge_Actions )
endfunction

I would prefer a method that would completely disable the hero's ability to cast the spell, without "removing" it. But, if I could at least -interupt- the hero from attempting to cast the spell before he actually does it, that would be okay. I just think that would interfere with the autocasting... if a player has autocast on and no souls the hero would continuously try to heal, but be interupted every time....

I really need to work on making more sense.. :P
04-10-2004, 03:13 AM#2
fugly
can you post function "target heal"?
04-10-2004, 03:27 AM#3
sans
Quote:
Originally Posted by fugly
can you post function "target heal"?

If I knew the answer to that I wouldn't have asked.. hahaha.. I dunno. I've not seen the use of a "post" function...

There are a whole bunch of "unit begins **** an ability" which means they click and execute, but I haven't learned of anyway to make a trigger that stops a unit from using an ability *BEFORE* it "begins" or whatever..

But I just had an idea.. and I would like some comments.

What if I created a seperate trigger that used an "order - targeting an object" event, the merge order code, and then did an if/then? if souls > 0 then run trigger "merge heal" else display "No souls." and ((cancel order or something I haven't found yet))??? Is that possible?
04-10-2004, 03:34 AM#4
fugly
no no no, i meant like, isn't there a function or trigger called "target Heal" you call it in your script, post it here so we can see it.
lol sry for the confusion
and yes that would work....
04-10-2004, 03:38 AM#5
sans
Quote:
Originally Posted by fugly
no no no, i meant like, isn't there a function or trigger called "target Heal" you call it in your script, post it here so we can see it.
lol sry for the confusion
and yes that would work....

Nope, TargetHeal is an inherent function within WC.. or JASS.. or whatever.

Also, I just tried this work around without any success..

Code:
merge i
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
        ((Issued order) Equal to (Order(deathcoil))) and ((Unit-type of (Triggering unit)) Equal to Soul Harvester)
    Actions
        If (soulharvestSouls Greater than 0) then do (Trigger - Run merge ii <gen> (checking conditions)) else do (Unit - Order soulharvestCaster to Human Priest - Deactivate Heal)
04-10-2004, 03:46 AM#6
Grater
Use the "begins casting an ability" event and order the hero to stop if there isn't enough souls, this should be seperate to the "Starts the effect of an ability" trigger, because "begins casting" happens before the unit actually starts the spell animation there shouldn't be much of a stop-start effect.
04-10-2004, 06:41 AM#7
sans
Quote:
Originally Posted by Grater
Use the "begins casting an ability" event and order the hero to stop if there isn't enough souls, this should be seperate to the "Starts the effect of an ability" trigger, because "begins casting" happens before the unit actually starts the spell animation there shouldn't be much of a stop-start effect.

Alright, that may solve the casting-when-he-shouldn't-be-able-to problem, but I have a feeling that he will do what I was talking about earlier, and just loop the casting.. over and over.

I'll test it out and get back to you.
04-10-2004, 07:19 AM#8
sans
Alright, I keep running into the same problem:

Using integer comparison for my integer global variable soulsharvesterSouls as a condition for the trigger always fails the trigger.. syntax error and shit.. it's really ****ing confusing.

I need my condition to follow that the integer variable is either "greater than zero" or "not equal to 0" or "greater than or equal to 1"... whatever.. it's failing that's all i know:

Code:
merge
    Events
        Unit - A unit Begins casting an ability
    Conditions
        ((Unit-type of (Triggering unit)) Equal to Soul Harvester) and ((Charges remaining in soulharvestVial) Greater than 0)
    Actions
        Unit - Order (Triggering unit) to Cancel
04-10-2004, 07:25 AM#9
The Gearhead
There is no JASS equivalent for "Skip remaining actions"? lol

It may be a noobish response, but cant you just do an If/Then/Else which prevents the unit from even going into the loop.

Oh, and your problem is your ordering it to cancel when you have souls. I assume greater than 0 means you have souls, so why would you want it to cancel it if it has souls?

Change:
(Charges remaining in soulharvestVial) Greater than 0
to
(Charges remaining in soulharvestVial) Equal to 0
04-10-2004, 07:48 AM#10
sans
Yeah but the problem was that the condition values were failing the entire syntax of the map... heh.. I found the culprit.. I renamed the trigger and missed the register functions naming scheme. So "merge ii" was registering "merge" and that.. well.. that will mess things up.. heh.. *sigh*
04-10-2004, 08:17 AM#11
Pheonix-IV
the other way you could do it is create a 2nd dummy ability off a passive spell give it the Disabled icon for the icon your using and the same discription but with the words "No Souls Available for Use" or something at the top in colored text, then create a trigger where if the souls remaining variable hits 0 remove the original spell and give the unit this spell, when souls goes above 0, remove this spell and replace the original spell, if its a hero spell then you'd probably have to play around with some stuff like removing the Stat points
04-10-2004, 09:00 AM#12
sans
Quote:
Originally Posted by Pheonix-IV
the other way you could do it is create a 2nd dummy ability off a passive spell give it the Disabled icon for the icon your using and the same discription but with the words "No Souls Available for Use" or something at the top in colored text, then create a trigger where if the souls remaining variable hits 0 remove the original spell and give the unit this spell, when souls goes above 0, remove this spell and replace the original spell, if its a hero spell then you'd probably have to play around with some stuff like removing the Stat points

That's a very interesting approach.. I'll definately have to give it a shot..

I've got my spells working, now I'm focusing on tweaking the animation..

Thanks for everyone's help. :)
04-10-2004, 10:45 PM#13
Vexorian
Quote:
Originally Posted by The Gearhead
There is no JASS equivalent for "Skip remaining actions"? lol

It may be a noobish response, but cant you just do an If/Then/Else which prevents the unit from even going into the loop.

Oh, and your problem is your ordering it to cancel when you have souls. I assume greater than 0 means you have souls, so why would you want it to cancel it if it has souls?

Change:
(Charges remaining in soulharvestVial) Greater than 0
to
(Charges remaining in soulharvestVial) Equal to 0
It is called return, and it won't stop a unit from casting an ability.

And TargetHeal is a WEU function that simply adds hitpoints to a unit and shows the heal effect.

Also to stop a unit from doing stop use the begins casting an ability like the one you had, but:

turn off this trigger
Pause the unit
Order the unit to stop
Show a you don't have souls message
Unpause the unit
turn on this trigger.
04-10-2004, 11:59 PM#14
sans
Quote:
Originally Posted by Lord Vexorian
It is called return, and it won't stop a unit from casting an ability.

And TargetHeal is a WEU function that simply adds hitpoints to a unit and shows the heal effect.

Also to stop a unit from doing stop use the begins casting an ability like the one you had, but:

turn off this trigger
Pause the unit
Order the unit to stop
Show a you don't have souls message
Unpause the unit
turn on this trigger.

My god you're a genious!