|
#31
|
|||
|
|||
|
Thank you Darvin, i wasn't exactly sure how to explain it.
|
|
#32
|
|||
|
|||
|
I would imagine it being limited, but the scripts would probably be catagorized into certain aspects. Nothing too difficult
By the way, scripting will be easier as soon as the new mini-keyboard is released for xbox 360 |
|
#33
|
||||
|
||||
|
I hope so. I would figure if gameplay was easy to learn scripting must be easier to do.
__________________
"Do not come between a Nazgul and his prey..." Feel free to check out my soundcloud: http://soundcloud.com/dylan-lang |
|
#34
|
||||
|
||||
|
Quote:
To give you an idea, this is some Jass code I wrote in the warcraft III editor. It might be difficult for you to follow, but what I will tell you is that the effect of this trigger is that any time any paladin casts a spell, he gains 15 hit points per level he has invested in devotion aura. Code:
//===========================================================================
function InitTrig_Devotion takes nothing returns nothing
set gg_trg_Devotion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Devotion, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Devotion, Condition( function Trig_devotion_Conditions ) )
call TriggerAddAction( gg_trg_Devotion, function Trig_devotion_Actions )
endfunction
function Trig_devotion_Conditions takes nothing returns boolean
if ( not ( 'H000' == GetUnitTypeId(GetSpellAbilityUnit()) ) ) then
return false
endif
return true
endfunction
function Trig_devotion_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local real healed = ( I2R(GetUnitAbilityLevelSwapped('A00L', caster)) * 15.00 )
call SetUnitLifeBJ( caster, ( GetUnitStateSwap(UNIT_STATE_LIFE, caster) + healed ) )
set caster = null
endfunction
__________________
---------------------------------------------- www.RTSCommunity.com ---------------------------------------------- |
|
#35
|
||||
|
||||
|
Well Darvin I kind of understand what that looks like as I have in school done a little bit of scripting in creating a website.
__________________
"Do not come between a Nazgul and his prey..." Feel free to check out my soundcloud: http://soundcloud.com/dylan-lang |
|
#36
|
||||
|
||||
|
Programming languages are logical, which is why if you know one, others start to look somewhat familiar.
__________________
---------------------------------------------- www.RTSCommunity.com ---------------------------------------------- |
|
#37
|
|||
|
|||
|
I understand some of it, i use to do a little messing with CAH on bfme 2
|
|
#38
|
||||
|
||||
|
I mean I understand what it means and how it's set up but I don't understand some of the codes and what those do.
__________________
"Do not come between a Nazgul and his prey..." Feel free to check out my soundcloud: http://soundcloud.com/dylan-lang |
|
#39
|
||||
|
||||
|
Code:
//===========================================================================
function InitTrig_Devotion takes nothing returns nothing
set gg_trg_Devotion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Devotion, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Devotion, Condition( function Trig_devotion_Conditions ) )
call TriggerAddAction( gg_trg_Devotion, function Trig_devotion_Actions )
endfunction
The second line is a function that adds a "register event" to the trigger. It takes as parameter the trigger variable and the type of event. In this case, it causes the trigger to execute whenever any unit casts a spell. The next line adds a condition to the trigger. The condition is itself a function which returns a boolean. If it returns true, the trigger goes ahead, if it returns false, the trigger does not go ahead. The condition is checked every time the "event" happens. The final line adds an "action" to the trigger, something that happens when the event happens and the condition is satisfied. The majority of the code (naturally) ends up in the action. Code:
function Trig_devotion_Conditions takes nothing returns boolean
if ( not ( 'H000' == GetUnitTypeId(GetSpellAbilityUnit()) ) ) then
return false
endif
return true
endfunction
Code:
function Trig_devotion_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local real healed = ( I2R(GetUnitAbilityLevelSwapped('A00L', caster)) * 15.00 )
call SetUnitLifeBJ( caster, ( GetUnitStateSwap(UNIT_STATE_LIFE, caster) + healed ) )
set caster = null
endfunction
"Caster" is literally the unit that casted the spell that triggered the script. The real (that is, a decimal value) healed is the amount that unit can expect to be healed. "GetUnitAbilityLevelSwapped" is a weird function name. It takes as parameters an ability type and a unit reference. In this case, the ability type is 'A00L', which is the code for my custom devotion aura. I2R is an explicit conversion of an integer to a real (Jass does not permit implicit conversions). The result is that the amount the caster can expect to be healed is 15 times the number of levels he has invested in the devotion aura skill. A paladin with level 3 devotion aura gains 45 hit points every time he casts a spell; a nifty bonus. Unfortunately, there is no "add health to unit" function, so I have to use "SetUnitLifeBJ" instead. I set the caster's health to his current health plus the value of "healed". GetUnitStateSwap(UNIT_STATE_LIFE, caster) returns the caster's current health, which then has the value of "healed" added to it, and his health is set to this new value (overflow over his maximum health isn't an issue with the "SetUnitLifeBJ" function). The final line is necessary due to an oversight in the map editor's scripting system. It unfortunately has an issue any time we create local variables extending "handle" (which is anything that's not a real, integer, boolean, or string...). By explicitly setting the variable to "null", it is flagged to be dereferenced when it goes out of scope. If I didn't set it to "null", it would never be dereferenced; a memory leak. That should be understandable to anyone with half a brain ^_^
__________________
---------------------------------------------- www.RTSCommunity.com ---------------------------------------------- |
|
#40
|
||||
|
||||
|
So basically one code is setup based off a trigger for a certain action to be done.
__________________
"Do not come between a Nazgul and his prey..." Feel free to check out my soundcloud: http://soundcloud.com/dylan-lang |
![]() |
| Thread Tools | |
| Display Modes | |
|
|