Manix
Well-Known Member
- Reaction score
- 29
RPG Floating Texts
System
System
Hello there,
This is the RPG floating texts system I just created, it really helps your map to be more user-friendly, aswell as increasing the level of the gameplay interface.
Features:
- Floating Text on Level Up
- Floating Text on Each Attack (Approximate Damage)
- Floating Text on Unit Orders (Optional)
- Floating Text on Player Chat Message (Optional)
- Floating Text on Ability Cast
- Player Color Codes (Set)
How to use:
The system is REALLY easy to import, make sure you have your "File>Preferences/General>Automatically Create unknown Variables while Pasting Trigger Data" checked, just download the map, attached to the post, then copy the category and paste it into your map.
There's an Initialization trigger in which you need to set some variables depending on your map, I'm guessing no RPG map has more than 15-20 unique heroes, so that wouldn't be a problem for you.
Notice: The floating text for your hero's damage is approximate, in order to get the exact ammount make sure that your heroes' values in the fields "Combat - Attack - Damage Number of Dice" and "Combat - Attack - Damage Sides per Die" in your object editor are set to 1.
I'm open for suggestions and I'll be upgrading and adding stuff to my system if your responses are positive and actually find it useful.
Codes:
Trigger:
- RPGInitialization
- Events
- Map initialization
- Conditions
- Actions
- -------- Setting Player Colors --------
- Trigger - Run RPGSetPlayerColors <gen> (checking conditions)
- -------- Setting the Heroes --------
- Set RPG_Hero[1] = Paladin
- Set RPG_Hero[2] = Archmage
- Set RPG_Hero[3] = Mountain King
- Set RPG_Hero[4] = Blood Mage
- -------- Setting Heroes' Base Damage --------
- -------- ( Value from "Combat - Attack 1/2 - Damage Base" ) --------
- Set RPG_HeroDamage[1] = 0.00
- Set RPG_HeroDamage[2] = 0.00
- Set RPG_HeroDamage[3] = 0.00
- Set RPG_HeroDamage[4] = 0.00
- -------- Setting Damage Bonus Per Each Primary Attribute Point --------
- Set RPG_DamagePerAttributePoint = 1.00
- -------- Setting Heroes' Primary Attribute --------
- -------- 1 = Strenght --------
- -------- 2 = Agility --------
- -------- 3 = Intelligence --------
- Set RPG_HeroAttribute[1] = 1
- Set RPG_HeroAttribute[2] = 3
- Set RPG_HeroAttribute[3] = 1
- Set RPG_HeroAttribute[4] = 3
- -------- Setting the Ammount of Heroes available --------
- Set RPG_HeroesCount = 4
- -------- Setting the Size of Floating Texts --------
- Set RPG_TextsSize = 10.00
- -------- Setting Show Orders On/Off --------
- Set RPG_Orders = False
- -------- Setting Player Chat Texts On/Off --------
- Set RPG_PlayerChat = True
- -------- --------
- -------- D - O - N - E --------
- -------- --------
- Events
JASS:
function Trig_RPGSetPlayerColors_Actions takes nothing returns nothing
set udg_RPG_PlayerColors[1] = "|CFFFF0000"
set udg_RPG_PlayerColors[2] = "|CFF0000FF"
set udg_RPG_PlayerColors[3] = "|CFF18E7BD"
set udg_RPG_PlayerColors[4] = "|CFF520084"
set udg_RPG_PlayerColors[5] = "|CFFFFFF00"
set udg_RPG_PlayerColors[6] = "|CFFFF8A08"
set udg_RPG_PlayerColors[7] = "|CFF18BE00"
set udg_RPG_PlayerColors[8] = "|CFFE759AD"
set udg_RPG_PlayerColors[9] = "|CFF949694"
set udg_RPG_PlayerColors[10] = "|CFF7BBEF7"
set udg_RPG_PlayerColors[11] = "|CFF086142"
set udg_RPG_PlayerColors[12] = "|CFF4A2800"
endfunction
function InitTrig_RPGSetPlayerColors takes nothing returns nothing
set gg_trg_RPGSetPlayerColors = CreateTrigger( )
call TriggerAddAction( gg_trg_RPGSetPlayerColors, function Trig_RPGSetPlayerColors_Actions )
endfunction
Trigger:
- RPGPlayerChatText
- Events
- Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
- Player - Player 2 (Blue) types a chat message containing <Empty String> as A substring
- Player - Player 3 (Teal) types a chat message containing <Empty String> as A substring
- Player - Player 4 (Purple) types a chat message containing <Empty String> as A substring
- Player - Player 5 (Yellow) types a chat message containing <Empty String> as A substring
- Player - Player 6 (Orange) types a chat message containing <Empty String> as A substring
- Player - Player 7 (Green) types a chat message containing <Empty String> as A substring
- Player - Player 8 (Pink) types a chat message containing <Empty String> as A substring
- Player - Player 9 (Gray) types a chat message containing <Empty String> as A substring
- Player - Player 10 (Light Blue) types a chat message containing <Empty String> as A substring
- Player - Player 11 (Dark Green) types a chat message containing <Empty String> as A substring
- Player - Player 12 (Brown) types a chat message containing <Empty String> as A substring
- Conditions
- RPG_PlayerChat Equal to True
- Actions
- Set RPG_UnitGroup[(Player number of (Triggering player))] = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
- Set RPG_HeroLoc[(Player number of (Triggering player))] = (Position of (Random unit from RPG_UnitGroup[(Player number of (Triggering player))]))
- Floating Text - Create floating text that reads (((RPG_PlayerColors[(Player number of (Triggering player))] + (Name of (Triggering player))) + :|r ) + (Entered chat string)) at RPG_HeroLoc[(Player number of (Triggering player))] with Z offset 0.00, using font size RPG_TextsSize, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
- Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
- Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
- Custom script: call DestroyGroup( udg_RPG_UnitGroup[GetConvertedPlayerId(GetTriggerPlayer())])
- Custom script: call RemoveLocation( udg_RPG_HeroLoc[GetConvertedPlayerId(GetTriggerPlayer())])
- Events
Trigger:
- RPGSpellText
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- ((Triggering unit) is A Hero) Equal to True
- Actions
- Set RPG_HeroLoc[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
- Floating Text - Create floating text that reads ((RPG_PlayerColors[(Player number of (Owner of (Triggering unit)))] + (Name of (Ability being cast))) + (( - + (String((Level of (Ability being cast) for (Triggering unit))))) + |r)) at RPG_HeroLoc[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size RPG_TextsSize, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
- Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
- Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
- Custom script: call RemoveLocation( udg_RPG_HeroLoc[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
- Events
Trigger:
- RPGLevelUp
- Events
- Unit - A unit Gains a level
- Conditions
- ((Triggering unit) is A Hero) Equal to True
- Actions
- Set RPG_HeroLoc[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
- Floating Text - Create floating text that reads ((RPG_PlayerColors[(Player number of (Owner of (Triggering unit)))] + ((Reached Level: + (String((Hero level of (Triggering unit))))) + !)) + |r) at RPG_HeroLoc[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size RPG_TextsSize, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
- Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
- Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
- Custom script: call RemoveLocation( udg_RPG_HeroLoc[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
- Events
Trigger:
- RPGAttackText
- Events
- Unit - A unit Is attacked
- Conditions
- ((Attacking unit) is A Hero) Equal to True
- Actions
- Set RPG_HeroLoc[(Player number of (Owner of (Attacking unit)))] = (Position of (Attacking unit))
- For each (Integer A) from 1 to RPG_HeroesCount, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Unit-type of (Attacking unit)) Equal to RPG_Hero[(Integer A)]
- Then - Actions
- If (RPG_HeroAttribute[(Integer A)] Equal to 1) then do (Set RPG_TempDamage[(Player number of (Owner of (Attacking unit)))] = (RPG_HeroDamage[(Integer A)] + ((Real((Strength of (Attacking unit) (Include bonuses)))) x RPG_DamagePerAttributePoint))) else do (Do nothing)
- If (RPG_HeroAttribute[(Integer A)] Equal to 2) then do (Set RPG_TempDamage[(Player number of (Owner of (Attacking unit)))] = (RPG_HeroDamage[(Integer A)] + ((Real((Agility of (Attacking unit) (Include bonuses)))) x RPG_DamagePerAttributePoint))) else do (Do nothing)
- If (RPG_HeroAttribute[(Integer A)] Equal to 3) then do (Set RPG_TempDamage[(Player number of (Owner of (Attacking unit)))] = (RPG_HeroDamage[(Integer A)] + ((Real((Intelligence of (Attacking unit) (Include bonuses)))) x RPG_DamagePerAttributePoint))) else do (Do nothing)
- Floating Text - Create floating text that reads ((RPG_PlayerColors[(Player number of (Owner of (Attacking unit)))] + (String((Integer(RPG_TempDamage[(Player number of (Owner of (Attacking unit)))]))))) + |r) at RPG_HeroLoc[(Player number of (Owner of (Attacking unit)))] with Z offset 0.00, using font size RPG_TextsSize, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Set the velocity of (Last created floating text) to 96.00 towards 90.00 degrees
- Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
- Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Custom script: call RemoveLocation( udg_RPG_HeroLoc[GetConvertedPlayerId(GetOwningPlayer(GetAttacker()))])
- Events
Trigger:
- RPGOrdersText
- Events
- Unit - A unit Is issued an order targeting an object
- Unit - A unit Is issued an order targeting a point
- Unit - A unit Is issued an order with no target
- Conditions
- ((Triggering unit) is A Hero) Equal to True
- RPG_Orders Equal to True
- Actions
- Set RPG_HeroLoc[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
- Floating Text - Create floating text that reads ((RPG_PlayerColors[(Player number of (Owner of (Triggering unit)))] + (String((Issued order)))) + |r) at RPG_HeroLoc[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size RPG_TextsSize, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
- Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
- Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
- Custom script: call RemoveLocation( udg_RPG_HeroLoc[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
- Events