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

GUI Preload System

+ This snippet allow you preload any items very easy.

+

  • Preload System
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Create PIS_Unit --------
      • Custom script: set udg_PS_Unit = CreateUnit(Player(15),'hpea',0,0,0)
      • Custom script: call ShowUnit(udg_PS_Unit, false)
      • -------- Add locust ability for PIS_Unit --------
      • Custom script: call UnitAddAbility(udg_PS_Unit,'Aloc')
      • -------- Add inventory ability for PIS_Unit --------
      • Custom script: call UnitAddAbility(udg_PS_Unit,'AInv')
      • Custom script: endfunction
      • -------- Main function - Preload Item --------
      • Custom script: function PreloadItem takes integer i returns nothing
      • Custom script: call RemoveItem(UnitAddItemById(udg_PS_Unit, i))
      • Custom script: endfunction
      • -------- Main function - Preload Ability --------
      • Custom script: function PreloadAbility takes integer i returns nothing
      • Custom script: call UnitAddAbility(udg_PS_Unit,i)
      • Custom script: endfunction
      • -------- Main function - Stop Reload --------
      • Custom script: function StopPreload takes nothing returns nothing
      • Custom script: call RemoveUnit(udg_PS_Unit)


+

-
Code:
call PreloadItem(itemtypeid)
-
Code:
call PreloadAbility(abilityid)
-
Code:
call StopPreload()
- Use in GUI:
  • Custom script: call PreloadItem('afac')
  • Custom script: call PreloadAbility('Amls')
  • Custom script: call StopPreload()

+

- NEW: Use Player(15) instead of ConvertedPlayer(15)
- OLD:
. add StopPreload function and code now is shorter.
. Remove varible PS_Loc, code now is shorter and clearlier.
. Add preload ability
. Remove PIS_Loc
. Use call UnitAddItemById(udg_PIS_Unit, i) instead of create item at .... and give it for PIS_Unit


Email: [email protected]

Keywords:
preload, item, btdonald, ability, system
Contents

Preload System Test Map (Map)

Reviews
00:40, 29th Aug 2012 Magtheridon96: Good job. 4/5
Level 17
Joined
Jul 17, 2011
Messages
1,864
hmm yea this is pretty useful but instead of having to preload only certain items why not make it like this
[trigger=trig]

Untitled Trigger 001
Events
Time - Elapsed game time is 3.00 seconds
Conditions
Actions
For each (Integer A) from 1 to 400, do (Actions)
Loop - Actions
Hero - Create (Random level -1 item-type) and give it to Blood Mage 0001 <gen>
Set count = (count + 1)
Set count2 = (count2 + 1)
Set item[(Integer A)] = (Item-type of (Last created item))
Trigger - Run Untitled Trigger 002 <gen> (checking conditions)
[/trigger]

[trigger=trig]

Untitled Trigger 002
Events
Conditions
Actions
For each (Integer count) from 1 to count, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
item[count2] Equal to item[count]
Then - Actions
Set item[count2] = (Random level -1 item-type)
Hero - Create item[count2] and give it to Blood Mage 0001 <gen>
Else - Actions

[/trigger]
[trigger=trig]

Untitled Trigger 003
Events
Unit - A unit Acquires an item
Conditions
Actions
Hero - Drop (Item being manipulated) from (Hero manipulating item)
Item - Remove (Last created item)

[/trigger]


sure this may cause the game to freeze for about 8 seconds but it will preload everything :D
 
Top