• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Spell Help

Status
Not open for further replies.
Level 9
Joined
Oct 12, 2005
Messages
281
I've tried for a while now and can not get this spell to work in my map (I'm a bit of a noob) could someone implement the spell in my map for the "Heal-Mix" Ability and the "Voodoo-Mix" Ability using Rastje Herb for Healing and Mostje Herb for Voodoo.
EDIT: I got the trigger to work but I want another trigger that does the same thing except for a different item , but every time I copy the trigger and input the other data- it has an error. Here are the two triggers: //////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create Potion //
// by Kixer //
// This Spell was designed for frankie11 //
// due to his request made at my Spell Factory //
// This Spell is 100% Editable, Multi-Instanceable //
// and follows the JESP Standard. //
//////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////
// Config Section

constant function Create_Potion_Potion_Rawcode takes nothing returns integer
return 'phea' // The output item's Rawcode
endfunction

constant function Create_Potion_Requriment_Rawcode takes nothing returns integer
return 'I001' // The input item's Rawcode
endfunction

constant function Create_Potion_Ability_Rawcode takes nothing returns integer
return 'A003' // The "Create Potion" ability's Rawcode
endfunction

constant function Create_Potion_Remove_Requirement takes nothing returns boolean
return true // If you want the requirment to be removed set to true else set to false
endfunction

constant function Create_Potion_Success_Effect_Rawcode takes nothing returns string
return "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
endfunction // The Successful creation effect string code. Set to "" for no effect

constant function Create_Potion_Error_Effect_Rawcode takes nothing returns string
return "Abilities\\Spells\\Items\\AIam\\AIamTarget.mdl"
endfunction // The error creation effect string code. Set to "" for no effect

function Trig_Create_Potion_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Create_Potion_Ability_Rawcode()
endfunction

/////////////////////////////////////////////////////
// Code Section

function Trig_Create_Potion_Actions takes nothing returns nothing
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local item i
set bj_forLoopAIndex = 0
loop
set bj_forLoopAIndex = bj_forLoopAIndex + 1
exitwhen bj_forLoopAIndex > 6
set i = UnitItemInSlot(GetTriggerUnit(), bj_forLoopAIndex - 1)
if GetItemTypeId(i) == Create_Potion_Requriment_Rawcode() then
if Create_Potion_Remove_Requirement() then
call RemoveItem(i)
endif
set i = CreateItem(Create_Potion_Potion_Rawcode(),x,y)
call UnitAddItem(GetTriggerUnit(), i)
call DestroyEffect(AddSpecialEffectTarget(Create_Potion_Success_Effect_Rawcode(),GetTriggerUnit(),"origin"))
set i = null
return
endif
endloop
call DestroyEffect(AddSpecialEffectTarget(Create_Potion_Error_Effect_Rawcode(),GetTriggerUnit(),"origin"))
endfunction

/////////////////////////////////////////////////////
// Trigger section

//===========================================================================
function InitTrig_Create_Potion1 takes nothing returns nothing
set gg_trg_Create_Potion1 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Potion1 , EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Create_Potion1 , Condition( function Trig_Create_Potion_Conditions ) )
call TriggerAddAction( gg_trg_Create_Potion1 , function Trig_Create_Potion_Actions )
call Preload(Create_Potion_Success_Effect_Rawcode())
call Preload(Create_Potion_Error_Effect_Rawcode())
endfunction

___________________________________________________________
That one is for health
--------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create Potion //
// by Kixer //
// This Spell was designed for frankie11 //
// due to his request made at my Spell Factory //
// This Spell is 100% Editable, Multi-Instanceable //
// and follows the JESP Standard. //
//////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////
// Config Section

constant function Create_Potion_Potion_Rawcode takes nothing returns integer
return 'pman' // The output item's Rawcode
endfunction

constant function Create_Potion_Requriment_Rawcode takes nothing returns integer
return 'I002' // The input item's Rawcode
endfunction

constant function Create_Potion_Ability_Rawcode takes nothing returns integer
return 'A002' // The "Create Potion" ability's Rawcode
endfunction

constant function Create_Potion_Remove_Requirement takes nothing returns boolean
return true // If you want the requirment to be removed set to true else set to false
endfunction

constant function Create_Potion_Success_Effect_Rawcode takes nothing returns string
return "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
endfunction // The Successful creation effect string code. Set to "" for no effect

constant function Create_Potion_Error_Effect_Rawcode takes nothing returns string
return "Abilities\\Spells\\Items\\AIam\\AIamTarget.mdl"
endfunction // The error creation effect string code. Set to "" for no effect

function Trig_Create_Potion_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Create_Potion_Ability_Rawcode()
endfunction

/////////////////////////////////////////////////////
// Code Section

function Trig_Create_Potion_Actions takes nothing returns nothing
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local item i
set bj_forLoopAIndex = 0
loop
set bj_forLoopAIndex = bj_forLoopAIndex + 1
exitwhen bj_forLoopAIndex > 6
set i = UnitItemInSlot(GetTriggerUnit(), bj_forLoopAIndex - 1)
if GetItemTypeId(i) == Create_Potion_Requriment_Rawcode() then
if Create_Potion_Remove_Requirement() then
call RemoveItem(i)
endif
set i = CreateItem(Create_Potion_Potion_Rawcode(),x,y)
call UnitAddItem(GetTriggerUnit(), i)
call DestroyEffect(AddSpecialEffectTarget(Create_Potion_Success_Effect_Rawcode(),GetTriggerUnit(),"origin"))
set i = null
return
endif
endloop
call DestroyEffect(AddSpecialEffectTarget(Create_Potion_Error_Effect_Rawcode(),GetTriggerUnit(),"origin"))
endfunction

/////////////////////////////////////////////////////
// Trigger section

//===========================================================================
function InitTrig_Create_Potion1_Copy takes nothing returns nothing
set gg_trg_Create_Potion1_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Potion1_Copy , EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Create_Potion1_Copy , Condition( function Trig_Create_Potion_Conditions ) )
call TriggerAddAction( gg_trg_Create_Potion1_Copy , function Trig_Create_Potion_Actions )
call Preload(Create_Potion_Success_Effect_Rawcode())
call Preload(Create_Potion_Error_Effect_Rawcode())
endfunction

________________________________________________________________
That is for mana. What is wrong with the second one that makes it error?
 
Last edited:
Status
Not open for further replies.
Top