Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Destructible - Pick every destructible within 256.00 of Point_Variable and do (Actions)
Loop - Actions
maybe after that check if its tree or no, have more solution for that, depend how much tree type u use on ur map, if only few then maybe use if else use tree detection system from spell section, i guess Almia posted the last
Ok I only understand a bit of JASS
plz make this:
I need a periodic event (every 0,05 s) to check if there is a tree within 375 range of a unit named "Blend_Into_Nature_Target" (variable)
[trigger=s]
Untitled Trigger 004
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Destructible - Pick every destructible within 2323.00 of (Position of (Triggering unit)) and do (Actions)
Loop - Actions
Custom script: if GetDestructableTypeId(GetEnumDestructable() ) == 'soid' then
Custom script: set udg_counter = udg_counter + 1
Custom script: endif
[trigger=s]
Untitled Trigger 004
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Destructible - Pick every destructible within 375.00 of (Position of (Blend_Into_Nature_Target)) and do (Actions)
Loop - Actions
Custom script: if GetDestructableTypeId(GetEnumDestructable() ) == 'soid' then
Custom script: set udg_x = udg_cx + 1
Custom script: endif
here is the trigger
I made x to be shown when the trigger occures but it shows always 0
Blend into Nature End
Events
Time - Every 0.10 seconds of game time
Conditions
Blend_nito_Nature_Target Not equal to No unit
Actions
Set x = (0)
Destructible - Pick every destructible within 375.00 of (Position of Blend_nito_Nature_Target) and do (Actions)
Loop - Actions
Custom script: if GetDestructableTypeId(GetEnumDestructable() ) == 'soid' then
Custom script: set udg_x = udg_x + 1
Custom script: endif
Game - Display to (All players) the text: (String(x))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
x Not Equal to 0
Then - Actions
Do nothing
Else - Actions
Unit - Remove Blend Into Nature buff from Blend_nito_Nature_Target
Set Blend_nito_Nature_Target = (No Unit)
I saw something in JassCraft:
JASS:
function IsDestructableTree takes destructable d returns boolean
local gamecache g=CSCache()
local string k=I2S(GetDestructableTypeId(d))
local boolean b
if HaveStoredBoolean(g,"trees",k) then
set b=GetStoredBoolean(g,"trees",k)
set g=null
return b
else
set b=IsDestructableTree_withcs(d)
call StoreBoolean(g,"trees",k,b)
endif
set g=null
return b
endfunction
library IsDestTree
/**************************************************
*
*
* IsDestTree
* BY: Almia
*
*
***************************************************
*
* Allows to check trees
* Also has a function that destroys trees
*
***************************************************
*
* API
*
* function IsDestTree takes destructable d returns boolean
* - Checks if destructable is tree or not
* function DestroyTree takes destructable d returns nothing
* - Destroys trees
*
****************************************************/
globals
private unit HARVESTER
endglobals
function IsDestTree takes destructable d returns boolean
return IssueTargetOrderById(HARVESTER,852018,d) and IssueImmediateOrderById(HARVESTER,851972)
endfunction
function DestroyTree takes destructable d returns nothing
if IsDestTree(d) and GetWidgetLife(d) > 0.405 then
call KillDestructable(d)
endif
endfunction
private module Init
private static method onInit takes nothing returns nothing
set HARVESTER = CreateUnit(Player(15),'hpea',0,0,0)
call ShowUnit(HARVESTER,false)
call UnitAddAbility(HARVESTER,'Aloc')
endmethod
endmodule
private struct SysInit
implement Init
endstruct
endlibrary
2. use this code for your detect destructable trigger
[trigger=t]
Ability Cast
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Destructible - Pick every destructible within 256.00 of (Position of Footman 0089 <gen>) and do (Actions)
Loop - Actions
Custom script: if IsDestTree(GetEnumDestructable()) then
Custom script: set udg_x = udg_x + 1
Custom script: endif
Game - Display to (All players) the text: (String(x))
[/trigger]
just replace footman with your unit
thats all you have to do i tested it and it works fine
the problem with the trigger you posted is that 'soid' is probably not the id of any destructable in your map i just wrote it as an example so the condition returns false every time the trigger runs thus not setting x + 1 if you are to replace 'soid' with a standart id then it will work you can find the id of the destructable go to the destructables tab in the object editor and press ctrl + d however you dont need to do this with the system i posted above because it automatically checks if the destructable is a TREE or some other type like barrel or cage
library IsDestTree
/**************************************************
*
*
* IsDestTree
* BY: Almia
*
*
***************************************************
*
* Allows to check trees
* Also has a function that destroys trees
*
***************************************************
*
* API
*
* function IsDestTree takes destructable d returns boolean
* - Checks if destructable is tree or not
* function DestroyTree takes destructable d returns nothing
* - Destroys trees
*
****************************************************/
globals
private unit HARVESTER
endglobals
function IsDestTree takes destructable d returns boolean
return IssueTargetOrderById(HARVESTER,852018,d) and IssueImmediateOrderById(HARVESTER,851972)
endfunction
function DestroyTree takes destructable d returns nothing
if IsDestTree(d) and GetWidgetLife(d) > 0.405 then
call KillDestructable(d)
endif
endfunction
private module Init
private static method onInit takes nothing returns nothing
set HARVESTER = CreateUnit(Player(15),'hpea',0,0,0)
call ShowUnit(HARVESTER,false)
call UnitAddAbility(HARVESTER,'Aloc')
endmethod
endmodule
private struct SysInit
implement Init
endstruct
endlibrary
2. use this code for your detect destructable trigger
[trigger=t]
Ability Cast
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Destructible - Pick every destructible within 256.00 of (Position of Footman 0089 <gen>) and do (Actions)
Loop - Actions
Custom script: if IsDestTree(GetEnumDestructable()) then
Custom script: set udg_x = udg_x + 1
Custom script: endif
Game - Display to (All players) the text: (String(x))
[/trigger]
just replace footman with your unit
thats all you have to do i tested it and it works fine
the problem with the trigger you posted is that 'soid' is probably not the id of any destructable in your map i just wrote it as an example so the condition returns false every time the trigger runs thus not setting x + 1 if you are to replace 'soid' with a standart id then it will work you can find the id of the destructable go to the destructables tab in the object editor and press ctrl + d however you dont need to do this with the system i posted above because it automatically checks if the destructable is a TREE or some other type like barrel or cage
I created a new trigger, converted it into text, removed everything in it pasted the script you posted, disabled then enabled the trigger there is something wrong and about that I think there is a problem at the begining:
JASS:
/**************************************************
*
*
* IsDestTree
* BY: Almia
*
*
***************************************************
*
* Allows to check trees
* Also has a function that destroys trees
*
***************************************************
you need jassnewgenpack 5d to be able to use most jass recources it is a preprocessor that adds extensions to the original language and makes wc3 modding easier in general
you will be fine just click yes
JNGP was made on an older version which means some of the gui stuff isnt usable but all of the jass is usable.
note: even if ur map has the gui stuff tht isnt in this one it will not break ur map.
if ur still a little scared make a copy of ur map save it to a new location then load the other one onto jngp and there u go now u have a backup
you will be fine just click yes
JNGP was made on an older version which means some of the gui stuff isnt usable but all of the jass is usable.
note: even if ur map has the gui stuff tht isnt in this one it will not break ur map.
if ur still a little scared make a copy of ur map save it to a new location then load the other one onto jngp and there u go now u have a backup
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.