• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] How would I turn this into GUI

Status
Not open for further replies.
Level 4
Joined
Feb 23, 2008
Messages
27
This is coding for an ability I'm using in a map I'm making. My friend coded this for me in JASS but I want to edit it because its unbalanced and I don't know how to edit it. Anybody know the GUI functions for this?
JASS:
RAVAGE-
// Objects used:
// 'A03Z' = Ravage (Scorpio : Axel)
// 'e00E' = Spellcaster
// 'A084' = Ravage 1

// DEBUG Trigger Number : 327
function Trig_Ravage_Conditions takes nothing returns boolean
	return GetSpellAbilityId()=='A03Z'
endfunction

function Trig_Ravage_Actions takes nothing returns nothing
	local location liD=GetUnitLoc(GetTriggerUnit())
	local location lng
	set bj_forLoopAIndex=1
	set bj_forLoopAIndexEnd=16
	loop
		exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
		call CreateNUnitsAtLoc(1,'e00E',GetOwningPlayer(GetTriggerUnit()),liD,bj_UNIT_FACING)
		call UnitAddAbility(bj_lastCreatedUnit,'A084')
		call SetUnitAbilityLevelSwapped('A084',bj_lastCreatedUnit,GetUnitAbilityLevelSwapped('A03Z',GetTriggerUnit()))
		set lng=PolarProjectionBJ(liD,100.,(22.5*I2R(bj_forLoopAIndex)))
		call IssuePointOrderByIdLoc(bj_lastCreatedUnit,OrderId("impale"),lng)
		call RemoveLocation(lng)
		set bj_forLoopAIndex=bj_forLoopAIndex+1
	endloop
	call RemoveLocation(liD)
endfunction

function StartTrigger_Ravage takes nothing returns nothing
	set gg_trg_Ravage=CreateTrigger()
	call TriggerRegisterAnyUnitEventBJ(gg_trg_Ravage,EVENT_PLAYER_UNIT_SPELL_EFFECT)
	call TriggerAddCondition(gg_trg_Ravage,Condition(function Trig_Ravage_Conditions))
	call TriggerAddAction(gg_trg_Ravage,function Trig_Ravage_Actions)
endfunction

function InitTrig_Ravage takes nothing returns nothing
endfunction[code=jass]
[/code]
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Does this help?

JASS:
////////////////////////////////////////////
//
//      These values are all references to the Object Editor's values. To find them go into the object
//      editor and press Ctrl+D to convert the object's names into their raw-code values. This will allow
//      you to manipulate which values are used from the Object Editor.
//
////////////////////////////////////////////

function RavageAbilityRawCode takes nothing returns integer
	return 'A03Z'
endfunction
function RavageSpecialUnitRawCode takes nothing returns integer
	return 'e00E'
endfunction
function RavageAddedAbilityRawCode takes nothing returns integer
	return 'A084'
endfunction
function RavageOrderString takes nothing returns string
    return "impale"
endfunction



function Trig_Ravage_Conditions takes nothing returns boolean
    return GetSpellAbilityId()==RavageAbilityRawCode()
endfunction

function Trig_Ravage_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit h
    local integer i = 1
    local integer m = 16
    local real x
    local real y
    loop
        exitwhen i > m
        
        set h = CreateUnit(GetOwningPlayer(u), RavageSpecialUnitRawCode(), GetUnitX(u), GetUnitY(u), bj_UNIT_FACING)
        call UnitAddAbility(h, RavageAddedAbilityRawCode())
        call SetUnitAbilityLevel(h, RavageAddedAbilityRawCode(), GetUnitAbilityLevel(u, RavageAbilityRawCode()))
        set x = GetUnitX(u) + 100 * Cos((22.5*I2R(i))*bj_DEGTORAD)
        set y = GetUnitY(u) + 100 * Sin((22.5*I2R(i))*bj_DEGTORAD)
        call IssuePointOrder(h, RavageOrderString(), x, y)
        
        set m=m+1
    endloop
    set u = null
    set h = null // almost forgot
endfunction

// Looking at this code right now, what the -hell- is this supposed to do?
function InitTrig_Ravage takes nothing returns nothing
    set gg_trg_Ravage=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Ravage,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Ravage,Condition(function Trig_Ravage_Conditions))
    call TriggerAddAction(gg_trg_Ravage,function Trig_Ravage_Actions)
endfunction

I usually use vJass, but it seems like you don't really know your way around. I've tried to make the code readable to you, I hope it helps. The configuration functions are at the very top.
 
EDIT: Berb is quick to post. ;o

Here you go:
  • Ravage
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to <Ravage Ability>
    • Actions
      • Set PointVariable = (Position of (Triggering unit))
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Unit - Create 1 <Spellcaster Dummy Unit> for (Owner of (Triggering unit)) at PointVariable facing Default building facing degrees
          • Unit - Add <Ravage 1> to (Last created unit)
          • Unit - Set level of <Ravage 1> for (Last created unit) to (Level of (Ability being cast) for (Triggering unit))
          • Set PointVariable2 = (PointVariable offset by 100.00 towards (22.50 x (Real((Integer A)))) degrees)
          • Unit - Order (Last created unit) to Undead Crypt Lord - Impale PointVariable2
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_PointVariable2)
      • Custom script: call RemoveLocation(udg_PointVariable)
Create 2 point variables named "PointVariable" and "PointVariable2".
Change <Ravage Ability> to the ability you want this trigger to fire for. In your friend's code it is listed as 'A03Z' = Ravage
Change <Spellcaster Dummy Unit> to the dummy unit that you want to create. I added a generic expiration timer so that the units won't stay there forever. In your friend's code, it is the thing listed as Spellcaster = 'e00E'
Change <Ravage 1> to the dummy ability you want the dummy unit to have. This should be whatever the impale ability that your friend had. Its order string should be impale in the object editor. It is the thing listed in his code as Ravage 1 = 'A084'

Good luck finding the problem with the spell. =D

EDIT: Yeah, I accidentally added a space to the trigger causing the remove loc functions to be outside of the loop. Actually, the were outside of the actions too. =P
 
Last edited:
Level 22
Joined
Feb 3, 2009
Messages
3,292
EDIT: Berb is quick to post. ;o

Here you go:
  • Ravage
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to <Ravage Ability>
    • Actions
      • Set PointVariable = (Position of (Triggering unit))
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Unit - Create 1 <Spellcaster Dummy Unit> for (Owner of (Triggering unit)) at PointVariable facing Default building facing degrees
          • Unit - Add <Ravage 1> to (Last created unit)
          • Unit - Set level of <Ravage 1> for (Last created unit) to (Level of (Ability being cast) for (Triggering unit))
          • Set PointVariable2 = (PointVariable offset by 100.00 towards (22.50 x (Real((Integer A)))) degrees)
          • Unit - Order (Last created unit) to Undead Crypt Lord - Impale PointVariable2
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_PointVariable2)
      • Custom script: call RemoveLocation(udg_PointVariable)
Create 2 point variables named "PointVariable" and "PointVariable2".
Change <Ravage Ability> to the ability you want this trigger to fire for. In your friend's code it is listed as 'A03Z' = Ravage
Change <Spellcaster Dummy Unit> to the dummy unit that you want to create. I added a generic expiration timer so that the units won't stay there forever. In your friend's code, it is the thing listed as Spellcaster = 'e00E'
Change <Ravage 1> to the dummy ability you want the dummy unit to have. This should be whatever the impale ability that your friend had. Its order string should be impale in the object editor. It is the thing listed in his code as Ravage 1 = 'A084'

Good luck finding the problem with the spell. =D

No, that's not right, the JASS spell is MUI while yours is not, so it's not ok...
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
From what I gathered, the spell creates several (16) dummy-units and orders them to "impale" away from the caster (using the loop-index to determine at what interval to issue the orders).

What I've done is simplified the code, made it better, and added the functions for the constant values at the top (without any vJass syntax) so that he can manipulate them to his specification. The names should be easy enough to follow, too.

If you want me to optimize the code (I coded it for readability on your end) I can do that, making it much faster than the GUI equivalent.
 
Status
Not open for further replies.
Top