Warcraft III: MapsModelsSkinsIconsSpellsToolsTutorials
WC3 JASS: Code SnippetsJASS and vJASS Spells and SystemsJass Tutorials
Chat @Discord

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Kam

Pages: [1]
1
JASS News / Producer Update: Natives List
« on: January 12, 2018, 04:08:02 PM »
JASS improvements for the upcoming versions of Warcraft III

This post comes from https://www.hiveworkshop.com/threads/producer-update-natives-list.301405/
Code: jass  [Select]
  1. /*
  2.  
  3.     //NEW FEATURES
  4.    
  5.         LIBRARIES & SCOPES
  6.         http://www.wc3c.net/vexorian/jasshelpermanual.html#lib
  7.    
  8.         GLOBALS BLOCK
  9.         The ability to declare global variable directly in code. This tremendously facilitates installation of new system without the need for a separate 'variable creator' trigger.
  10.         http://www.wc3c.net/vexorian/jasshelpermanual.html#gdf
  11.  
  12.         STRUCTS
  13.         http://www.wc3c.net/vexorian/jasshelpermanual.html#stru
  14.    
  15.         2D ARRAYS
  16.         http://www.wc3c.net/vexorian/jasshelpermanual.html#twodarray
  17.  
  18.  
  19.     //NEW NATIVES
  20.  
  21.         Dynamically Change Fields At Runtime: the following is just a list of commonly requested
  22.         properties that map-makers would enjoy having access to via triggers:
  23.         - Get and set a unit’s ability/item cooldown time
  24.         - Get and set attack damage, armor, attack range, attack speed, attack index, backswing, etc.
  25.         - Get and set object editor fields at runtime, e.g. a unit’s model, a unit’s attack missile, set tooltips
  26.         for units/abilities/items, set icons, etc.
  27.         - Set a unit’s facing, pitch, and roll instantly (setting a unit’s facing currently has turn-speed delay)
  28.         - Better control over a unit’s portrait
  29.         - Set a unit’s maximum hit points and mana points++
  30.         - Get a unit’s damage type
  31.         - ‘Attack released event’ - an event that fires when an attack is released i.e. released projectile
  32.  
  33.         Some example are provided below, but in order of importance, 'getters' come before 'setters'. (eg: GetUnitGoldCost() is more important that SetUnitGoldCost(),
  34.         though having both would be tremendously helpful in a lot of circumstances)
  35.  
  36. */
  37.  
  38. //Fixes
  39. native GetWidgetLife takes widget w returns real                                             //The real is not exact? Details lacking.
  40. native EnableOcclusion takes boolean flag returns nothing                                    //Possibly in reference to occlusion being broken in general? Details lacking.
  41. native TriggerRegisterUnitStateEvent takes trigger whichTrigger, unit whichUnit, unitstate whichState, limitop opcode, real limitval returns event
  42.                                                                                              //EQUAL is broken? Details lacking.
  43. native AddUnitToStock takes unit whichUnit, integer unitId, integer currentStock, integer stockMax returns nothing
  44.                                                                                              //The main tooltip of the added unit will always ignore color tags so the text will always appear to be white. Color tags should be parsed the same as all unit tooltips.
  45. /*
  46.     With each of call of this function, the minimap is modified in a bugged way :
  47.     The positions of units and the fog of war are modified to fit to the new camera bound but not the terrain, nor the destructables.
  48.     The minimap is compressed (vertically) according to the current camera's rotation. With a rotation of 90°, there is no compression. With a rotation of 227.40, the minimap is fully compressed. Between 227.5 and 312.6, the game crashes.
  49.     Moreover, the camera bounds will also be adjusted according to the rotation of the current camera. The camera bounds created will be a rectangle going trough the 4 points given and whose sides will be parallel to the camera.
  50. */
  51. native SetCameraBounds takes real x1, real y1, real x2, real y2, real x3, real y3, real x4, real y4 returns nothing
  52.  
  53. /*
  54.     Destroy all bound triggeraction objects.
  55.     Currently it only destroys all bound events, triggercondition and the trigger itself leaving all triggeraction objects to leak unless explicitly destroyed before.
  56.     Also destroy all currently scheduled trigger threads from that trigger.
  57.     Currently destroying a trigger with scheduled trigger threads can cause handle stack corruption which has a high chance to cause Warcraft III to crash.
  58. */
  59. native DestroyTrigger takes trigger whichTrigger returns nothing
  60.  
  61. function SmartCameraPanBJ takes player whichPlayer,location loc,real duration returns nothing
  62.                                                                                              //This BJ function is currently not net safe. Details explained: https://www.hiveworkshop.com/threads/fixing-smartcamerapanbj-desync.243334/
  63.  
  64. constant native GetEventDamage takes nothing returns real                                    //Return the amount of life damage taken through an imperfect mana shield. Currently returns 0 or negative only even if the unit takes life damage through the shield.
  65.  
  66. //Change suggestions
  67. native SetUnitState takes unit whichUnit,unitstate whichUnitState,real newVal returns nothing
  68.                                                                                              //Add support for modifying both maximum and regeneration for life and mana. Currently only supports modifying current life.
  69. native DisplayTimedTextToPlayer takes player toPlayer, real x, real y, real duration, string message returns nothing
  70.                                                                                              //Change it so that displaying text to a player with unique x and y does not move any other messages.

2
Triggers & Scripting / [GUI] No Target Order
« on: August 05, 2012, 01:44:13 PM »
This is fairly simple. I have this ability that when activated converts resources to mana for a casting structure. The primary ability is a dummy ability based on immolation. When activated it adds a dummy ability that catches a every second timed trigger that does the resource conversion.

The problem I discovered is that when you use a "no target" order event anything the structure does starts the trigger, even despite having a condition that immolation/unimmolation be the only acceptable orders.

I mostly solved this by having another trigger that removes the dummy and resets the primary abilities when another type of order is given. This works accept when the building begins construction. How can I solve this?

Trigger: Test 2055701320
   
           
  • Conversion Setup
  •     Events
  •         Unit - A unit Is issued an order with no target
  •     Conditions
  •         Or - Any (Conditions) are true
  •             Conditions
  •                 (Unit-type of (Triggering unit)) Equal to Rift
  •                 (Unit-type of (Triggering unit)) Equal to Bastion
  •                 (Unit-type of (Triggering unit)) Equal to Parapet
  •         Or - Any (Conditions) are true
  •             Conditions
  •                 (Issued order) Equal to (Order(immolation))
  •                 (Issued order) Equal to (Order(unimmolation))
  •     Actions
  •         If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  •             If - Conditions
  •                 (Level of Mana Conversion (Dummy) for (Triggering unit)) Equal to 0
  •             Then - Actions
  •                 Unit - Add Mana Conversion (Dummy) to (Triggering unit)
  •             Else - Actions
  •                 If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  •                     If - Conditions
  •                         (Level of Mana Conversion (Dummy) for (Triggering unit)) Equal to 1
  •                     Then - Actions
  •                         Unit - Remove Mana Conversion (Dummy) from (Triggering unit)
  •                     Else - Actions
           
Trigger: Test 1499198018
   
           
  • Conversion Check
  •     Events
  •         Time - Every 1.00 seconds of game time
  •     Conditions
  •     Actions
  •         Set Conversion_Group = (Units in (Playable map area) matching ((Level of Mana Conversion (Dummy) for (Matching unit)) Equal to 1))
  •         Unit Group - Pick every unit in Conversion_Group and do (Actions)
  •             Loop - Actions
  •                 If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  •                     If - Conditions
  •                         ((Owner of (Picked unit)) Current gold) Greater than or equal to 5
  •                         (Mana of (Picked unit)) Not equal to (Max mana of (Picked unit))
  •                     Then - Actions
  •                         Player - Set (Owner of (Picked unit)) Current gold to (((Owner of (Picked unit)) Current gold) - 5)
  •                         Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 1.00)
  •                     Else - Actions
  •                 If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  •                     If - Conditions
  •                         ((Owner of (Picked unit)) Current lumber) Greater than or equal to 10
  •                         (Mana of (Picked unit)) Not equal to (Max mana of (Picked unit))
  •                     Then - Actions
  •                         Player - Set (Owner of (Picked unit)) Current lumber to (((Owner of (Picked unit)) Current lumber) - 10)
  •                         Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 1.00)
  •                     Else - Actions
  •         Custom script:   call DestroyGroup (udg_Conversion_Group)
           
Trigger: Test 1253417990
   
           
  • Conversion Upgrade Reset
  •     Events
  •         Unit - A unit Begins an upgrade
  •         Unit - A unit Finishes an upgrade
  •         Unit - A unit Cancels an upgrade
  •         Unit - A unit Begins construction
  •         Unit - A unit Finishes construction
  •         Unit - A unit Begins research
  •         Unit - A unit Cancels research
  •         Unit - A unit Finishes research
  •     Conditions
  •         Or - Any (Conditions) are true
  •             Conditions
  •                 (Unit-type of (Triggering unit)) Equal to Rift
  •                 (Unit-type of (Triggering unit)) Equal to Bastion
  •                 (Unit-type of (Triggering unit)) Equal to Parapet
  •     Actions
  •         Unit - Remove Mana Conversion (Dummy) from (Triggering unit)
  •         Unit - Remove Conversion  from (Triggering unit)
  •         Unit - Add Conversion  to (Triggering unit)
           

Pages: [1]
Blizzard Modding Information Center Wacraft III Modding Information Center WC3JASS.com - The JASS Vault Chronicles of Darkness - A Warcraft III mod Jetcraft - A Starcraft II mod Troll Smash - A Warcraft III Arena Starcraft II Modding Information Center
  Mod DB - Change the Game Power of Corruption - A Warcraft III altered melee map Chaos Realm - The world of Game modders and wc3 addicts Follow us on Facebook!!