HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help Writing Custom Script

10-27-2007, 08:33 PM#1
XGC
Hm, So I was reading through vexorian's readme and I couldnt get a custom script to create a "dummy" unit at various locations and use cast a spell around a unit. (much like a nova, but not moving. So like a ring spell)


This is my GUI for the entire trigger right now without any custom scripts...

Also, anyone know how to remove the stupid swirly effect on units for thunderclap? (I removed the animations, but one or two units will still get swirlies over their head.)

Both my "Stomp" spells are based off of Thunderclap.


Trigger:
Frost Stomp 1 Working
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Frost Stomp [1]
Collapse Actions
Set UnitVar = (Triggering unit)
Set StompLVL = (Level of Frost Stomp [1] for UnitVar)
Set FtStompCast = (Position of (Triggering unit))
Collapse For each (Integer A) from 1 to 1, do (Actions)
Collapse Loop - Actions
Collapse For each (Integer B) from 1 to 18, do (Actions)
Collapse Loop - Actions
Set FtStompLoc = (FtStompCast offset by 150.00 towards (20.00 x (Real((Integer B)))) degrees)
Unit - Create 1 caster (Caster System) for (Owner of UnitVar) at FtStompLoc facing Default building facing degrees
Set DummyUnit = (Last created unit)
Unit - Add FtStomp to (Last created unit)
Unit - Set level of FtStomp for DummyUnit to StompLVL
Unit - Order DummyUnit to Human Mountain King - Thunder Clap
Unit - Add a 2.00 second Generic expiration timer to DummyUnit
Custom script: call RemoveLocation (udg_FtStompLoc)
10-28-2007, 02:15 PM#2
Vexorian
What tutorial?

I am moving this thread to a better forum.
10-28-2007, 02:45 PM#3
iNfraNe
For each (Integer A) from 1 to 1, do (Actions)

this made me lol :)
10-28-2007, 05:45 PM#4
aaero
The swirly things above units heads are because of the buff associated with the Thunder Clap spell. Even if you remove the buff in the spell, the default buff (swirly things) will still appear unless you create a custom buff to take it's place. To create a custom buff, go to the buff editor, make a copy of the thunder clap buff and change it's name/icon to match your spell, then change the art - model field appropriately.

To use Vex's caster system in GUI, you can look at the function documentation. You want

function CasterCastAbilityPointLoc takes player owner, integer abilid, string order, location loc, boolean instant returns unit

So, your custom script will be

Collapse JASS:
call CasterCastAbilityPointLoc ( GetOwningPlayer(UnitVar), 'YourAbilityID', 'thunderclap', udg_FtStompLoc, true )

You'll need to replace 'YourAbilityID' with the actual ability ID of your custom ThunderClap, you can see it by pressing Ctrl + D in the object editor while your ability is selected - it will be the first 4 digits before the colon.

That one line can replace everything between "Set FtStompLoc = ..." and "call RemoveLocation(...". The caster system takes care of cleaning everything up.

Edit: Also, that Foreach Integer A from 1 to 1...completely unnecessary, as far as I can tell. That says : "Run the following code once." Which is what it would do anyway.

Edit2: Also (before Pyrogasm comes in here) it would be faster to get the X and Y values of the location and use those instead of calling CasterCastAbilityPointLoc, but the speed difference probably won't matter much here.
10-30-2007, 11:55 PM#5
XGC
See I tried using that script, but it only casts at one location...
I followed the function documentation, and I can only get the caster unit to cast the spell at one location not multiple. However, without the custom script and what I have listed above, it casts it in multiple locations which i want.

Basic spell..

A warstomp / thunderclap, but the "animation" effects is a bunch of frost novas around the casting unit. (as for removing swirlies, still doesnt work. I copy base the spell off of thunderclap, and it still gives me swirlies from time to time. damnit!)

Quote:
For each (Integer A) from 1 to 1, do (Actions)

this made me lol :)

=) I wasnt sure if I needed to make it loop or not, because in SC editor, if the trigger already happend, it wont happen again unless you loop it. :) I've learnt since Ive made the post. but thanks for making it obvious :D
10-31-2007, 04:45 PM#6
aaero
If it doesn't cast in multiple locations, I would guess that you removed the line

"Set FtStompLoc = ..."

Your loop code should look like this

Trigger:
For each (Integer B) from 1 to 18, do (Actions)
Loop - Actions
Set FtStompLoc = (FtStompCast offset by 150.00 towards (20.00 x (Real((Integer B)))) degrees)
Custom script: call CasterCastAbilityPointLoc ( GetOwningPlayer(UnitVar), 'YourAbilityID', 'thunderclap', udg_FtStompLoc, true )
Custom script: call RemoveLocation (udg_FtStompLoc)

Is that what you did?
11-03-2007, 12:54 AM#7
XGC
Thanks it works now. But at the end of the custom script, i needed to change from True to False. :D