• 🏆 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!

Simple Spell Power System v1.4 [GUI]

  • Like
Reactions: maddeem
- This system will allow your unit to have a spell that deals various of damage depending on your Spell Power Value.

- This system is useful for maps such as Hero Arena / Survival / You name it.

- You have a same unit with your enemy players but you have more Spell Power than him, thus will grant your spell to deal extra damage.


- Open World Editor --- File - Preferences... --- General Tab --- Tick the Automatically create unknown variables while pasting trigger data
- Copy the Simple Spell Power System folder.
- Further instructions inside the SP Setup Trigger.

- If you want to use the Spell Power Value from a unit, simply sets which unit;
  • Actions
    • Set SP_Unit = (Triggering unit)
    • Trigger - Run SP Get <gen> (ignoring conditions)
SP Value = SP_CurrentValue
Like if you want to deal damage based on SP Value of a unit, simply use SP_CurrentValue as the damage (Spell Power Value).
I have included examples in there, you should be able to understand it.


  • SP Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_SP_Hashtable = InitHashtable()
      • -------- CONFIGURABLES --------
      • -------- ////////// --------
      • -------- SP_ItemType = which item-type --------
      • -------- SP_Value = how much Spell Power does SP_ItemType holds --------
      • -------- After you have set both of that variables, REMEMBER TO ALWAYS RUN SP SAVE TRIGGER --------
      • -------- Repeat the same steps for a new item-type --------
      • -------- ////////// --------
      • -------- To access a Spell Power Value from a unit, simply set SP_Unit to which Unit and run the SP Get Trigger to get SP_CurrentValue from the early set SP_Unit --------
      • -------- EXAMPLE --------
      • -------- Set SP_Unit = (Triggering unit) --------
      • -------- Run Get SP <gen> (ignoring conditions) --------
      • -------- You have now obtain the Spell Power Value from (Triggering unit), and to use it, simply use SP_CurrentValue --------
      • -------- ////////// --------
      • -------- ITEM #1 --------
      • Set SP_ItemType = Weak Staff
      • Set SP_Value = 50.00
      • Trigger - Run SP Save <gen> (ignoring conditions)
      • -------- ITEM #2 --------
      • Set SP_ItemType = Moderate Staff
      • Set SP_Value = 100.00
      • Trigger - Run SP Save <gen> (ignoring conditions)
      • -------- ITEM #3 --------
      • Set SP_ItemType = Mage Staff
      • Set SP_Value = 200.00
      • Trigger - Run SP Save <gen> (ignoring conditions)
      • -------- END OF CONFIGURABLES --------
      • Set PlayerColor[1] = |CFFFF0303
      • Set PlayerColor[2] = |CFF0042FF
      • Set PlayerColor[3] = |CFF1CB619
      • Set PlayerColor[4] = |CFF540081
      • Set PlayerColor[5] = |CFFFFFF01
      • Set PlayerColor[6] = |CFFFE8A0E
      • Set PlayerColor[7] = |CFF20C000
      • Set PlayerColor[8] = |CFFE55BB0
      • Set PlayerColor[9] = |CFF959697
      • Set PlayerColor[10] = |CFF7EBFF1
      • Set PlayerColor[11] = |CFF106246
      • Set PlayerColor[12] = |CFF4E2A04
      • -------- When a player types "-sp" when they are selecting unit(s), they will see current Spell Power value --------
      • For each (Integer LoopingInteger) from 1 to 12, do (Actions)
        • Loop - Actions
          • Trigger - Add to SP Check 1 <gen> the event (Player - (Player(LoopingInteger)) types a chat message containing -sp as A substring)
  • SP Acquire
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set TempItem = (Item-type of (Item being manipulated))
      • Custom script: set udg_SP_Key = udg_SP_ItemType
      • Set SP_Value = (Load 0 of SP_Key from SP_Hashtable)
      • Set SP_Unit = (Triggering unit)
      • Custom script: set udg_SP_Key = GetHandleId(udg_SP_Unit)
      • Set SP_CurrentValue = (Load 1 of SP_Key from SP_Hashtable)
      • Set SP_CurrentValue = (SP_CurrentValue + SP_Value)
      • Hashtable - Save SP_CurrentValue as 1 of SP_Key in SP_Hashtable
  • SP Lose
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Set TempItem = (Item-type of (Item being manipulated))
      • Custom script: set udg_SP_Key = udg_SP_ItemType
      • Set SP_Value = (Load 0 of SP_Key from SP_Hashtable)
      • Set SP_Unit = (Triggering unit)
      • Custom script: set udg_SP_Key = GetHandleId(udg_SP_Unit)
      • Set SP_CurrentValue = (Load 1 of SP_Key from SP_Hashtable)
      • Set SP_CurrentValue = (SP_CurrentValue - SP_Value)
      • Hashtable - Save SP_CurrentValue as 1 of SP_Key in SP_Hashtable
  • SP Save
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_SP_Key = udg_SP_ItemType
      • Hashtable - Save SP_Value as 0 of SP_Key in SP_Hashtable
  • SP Get
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_SP_Key = GetHandleId(udg_SP_Unit)
      • Set SP_CurrentValue = (Load 1 of SP_Key from SP_Hashtable)
- Heavily inspired by The Black Road RPG that uses this similar system, so I decided to create one for public resource.
- Fixed some Floating Text properties --- KnnO
- Optimize the code the idea on new custom function --- maddeem
- Removed Floating Text BJs --- mckill2009


v1.0
- Initial release

v1.1
- Fixed some Floating Text properties
- Code has been optimized
- Supports player color now
- Spell Power value for each item has been rescaled

v1.2
- Added new function: GetUnitSP()
- This function will allow you to get the unit's current SP Value

v1.3
- All Floating Text BJs are now removed
- Item-type configuration can now be achieved by using GUI function
- There are 2 separate functions now; GetUnitSP and ShowUnitSP
- Fixed some minor tooltips on the ability
- Instruction now is rearranged

v1.4
- Removed Custom Function
- Removed ShowUnitSP Function
- System now just acquire you to only run SP Get Trigger to obtain SP_CurrentValue
- Encapsulation on setup has been added


Keywords:
spell, power, spell power, defskull, damage, extra, hero arena, survival, rpg, item, hashtable.
Contents

Just another Warcraft III map (Map)

Reviews
Approved The system works fine and is easy to use. You could do SP_Value != 0 check in save and lose triggers, and skip the rest of the actions if it is 0. 20:09, 15th Jul 2012 Pharaoh_: The custom function is not really flexible at the...

Moderator

M

Moderator

Reviewed by Maker, Simple Spell Power System v1.4, 6th Jan 2013

Approved
The system works fine and is easy to use.

You could do SP_Value != 0 check in save and lose triggers,
and skip the rest of the actions if it is 0.

20:09, 15th Jul 2012

Pharaoh_: The custom function is not really flexible at the moment.
Make it get Unit as a parameter and return real:
JASS:
function GetUnitSpellPower takes unit u returns real
    return LoadReal (udg_SP_Hashtable, GetHandleId (u), 1)
endfunction
What is more, ShowSP function is not necessary, just add a flag in the GetUnitSpellPower function, e.g.
function GetUnitSpellpower takes unit u, boolean b returns real
check in the function if b then -> create tag. In both cases (outside of the if/then), return the Spell Power value.


22:07, 6th Jul 2012

Fix the BJ's; address it to Triggers & Scripts, if necessary.
 
Level 8
Joined
Sep 18, 2011
Messages
195
  • I was expecting some spells example. I know how to use it, but from seeing the spell thumbnail I thought there must be some demo spells
    I think you can post them in a hidden tag other than triggers ^^

  • The Idea of this is really nice, so now for example you can reserve leveling your abilities
    for other things like lowering cd/mana ..etc

  • I like the "-sp" trigger, it can be used with the system immediately in the user's map, but it needs a better floating text display though, I would change the text properties to these (just so it would be noticable):
    • Velocity: 64 -> 32
    • Lifespan: 1.5 -> 2.5
    • FadeAge: 0.75 -> 1.5
    (Because I was typing -sp for alot of time while expecting a text message, not a floating one ':) )
    I think I didn't notice it because of the static tip message...
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I was expecting some spells example. I know how to use it, but from seeing the spell thumbnail I thought there must be some demo spells
I think you can post them in a hidden tag other than triggers ^^
There was an example of usage in the test map, yeah :)
Do you mean to include the trigger example in the description (here) ?
I think I should just put the main trigger here.

I like the "-sp" trigger, it can be used with the system immediately in the user's map, but it needs a better floating text display though, I would change the text properties to these (just so it would be noticable):
Velocity: 64 -> 32
Lifespan: 1.5 -> 2.5
FadeAge: 0.75 -> 1.5
(Because I was typing -sp for alot of time while expecting a text message, not a floating one ':) )
I think I didn't notice it because of the static tip message...
Well, it works well for my eyes, I could notice the message in 1.5s :)
This system will work if you select multiple units at once (MUI), that's why I made a Floating Text instead of Game Message because we don't know which units do we refer to.

Thanks for comments and feedbacks :)
 
Sounds likem something based off of LoL, So what this is, basically is a "system" which increases SP when you get given an item, and you lose it when you drop it, giving the unit a value which can be adde in spell formula to increase spell damage or decrease spell damage, however only applies /really/ to custom spells?

And you must put in every item individually to do this (obviously)

Well, I think it's a nice idea, it's not practical really for others, but a nice idea I guess, most custom spells do not have a damage formula as part of the configurables and most do not use hashtables - even so it'd require modification by somebody who understands hashtables to actually use the values and thus require them to go delving into potentially complicated spells to find where they should be adding this data. Thus it can't /really/ be used by people who don't already have a semi-decent understanding of spell-making, who could also easily recreate this effect in a manner.

Also, I think the system is /far/ too simple to warrant the use of hashtables. Since you're saving one value for each unit (the SP) it could just all be stored in a dynamic array and then you can find the unit in the array during the spell being cast using a second array variable and then you could get the value more easily. As for the items SP the exact same could be done, just with an array for item-types.

Edit: Oh and on the -sp trigger you should have it in conditions to check that once the string is converted into lowercase (or uppercase) that it matches "-sp" or "-SP" (depending on which way you convert it so that it cannot be triggered by a sentence which just happens to have it in.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Sounds likem something based off of LoL, So what this is, basically is a "system" which increases SP when you get given an item, and you lose it when you drop it, giving the unit a value which can be adde in spell formula to increase spell damage or decrease spell damage, however only applies /really/ to custom spells?

And you must put in every item individually to do this (obviously)

Well, I think it's a nice idea, it's not practical really for others, but a nice idea I guess, most custom spells do not have a damage formula as part of the configurables and most do not use hashtables - even so it'd require modification by somebody who understands hashtables to actually use the values and thus require them to go delving into potentially complicated spells to find where they should be adding this data. Thus it can't /really/ be used by people who don't already have a semi-decent understanding of spell-making, who could also easily recreate this effect in a manner.

Also, I think the system is /far/ too simple to warrant the use of hashtables. Since you're saving one value for each unit (the SP) it could just all be stored in a dynamic array and then you can find the unit in the array during the spell being cast using a second array variable and then you could get the value more easily. As for the items SP the exact same could be done, just with an array for item-types.

Edit: Oh and on the -sp trigger you should have it in conditions to check that once the string is converted into lowercase (or uppercase) that it matches "-sp" or "-SP" (depending on which way you convert it so that it cannot be triggered by a sentence which just happens to have it in.
Blur~

I don't know where to start, I think the system currently good enough before I go far more advance such as dynamic array and what not.
I did not even know what that is.

I think I'll stick to the current setup trigger since it does not give any bugs at all.
 
It looks so so much better, but to make it easier for a GUIer to read you can set udg_SP_Key directly to an item type, instead of an integer and it will act the same way :p
Other then that, 5/5
Thus it can't /really/ be used by people who don't already have a semi-decent understanding of spell-making, who could also easily recreate this effect in a manner.
You could make a function like call GetUnitSpellPower(udg_Unit) that would return a real. But then you would have to add some vjass, and some people hate vjass xD

But for anyone who doesn't understand this system, it allows you to add a custom stat to any item, and load that stat any time you please.
It seems pretty flexible, and with slight configuration you could easily add more than 1 custom stat to an item.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
The system has been updated (check the changelogs)

without having to hit that chat text all the time
At that time, that action acts as an "example" on how to execute (check) the current unit's SP Value, now I added a new custom function, it's gonna be easy to retrieve the value from units.
I also added 3 more examples how to check current SP Value for units.

Additionally, you could merge a multiboard system to make this system visible on it; it would be destined for such uses anyway
I said it earlier, this system is MUI, you can't have too much unit to keep track of the info in the multiboards, it will become messy.

The unit group leaks.
I do not care about Leaks or Unefficient Coding outside of the Simple Spell Power System folder because that's just showing an example on how to use this system.
That is why I don't bother at all to clean location leaks or unit group leaks, because that is up to the user to use this function and clean for themselves, that trigger is just an example.

Please moderate it again, thank you :)

Also, if you guys know how to exactly execute all these actions in JASS, please tell me;
  • Floating Text - Create floating text that reads (String((Integer(SP_CurrentValue)))) above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
  • Floating Text - Change (Last created floating text): Disable permanence
  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
  • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
Currently, my custom function contains all BJs which is not good.
 
Top