>> JASS/GUI requests/questions in here <<

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

grand
Member
Posts: 67
Joined: January 6th, 2008, 10:05 pm

Re: >> JASS/GUI requests/questions in here <<

Post by grand »

The trigger worked now, thank you. I was thinking, does this trigger cause memory leak or lag? If yes, how do I fix it?
1st part:
Spoiler:
trigger gg_trg_Backtrack =null
2nd part:
Spoiler:
function Trig_Backtrack_Conditions takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetTriggerUnit(), 'B03S') == true ) ) then
return false
endif
return true
endfunction

function Backtrack_Main takes nothing returns nothing
local unit lfo=GetTriggerUnit()
local real lf7=GetEventDamage()
if(lf7>0)then
if(GetRandomInt(1,100)<=(10+(15*GetUnitAbilityLevel(lfo,'A0KP'))))then
call SetUnitState(lfo,UNIT_STATE_LIFE,GetUnitState(lfo,UNIT_STATE_LIFE)+lf7)
endif
endif
endfunction

function Trig_Backtrack_Actions takes nothing returns nothing
local trigger ltt
if GetUnitAbilityLevel(GetTriggerUnit(),'A0KP')==1 then
set ltt=CreateTrigger()
call TriggerRegisterUnitEvent(ltt,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
call TriggerAddAction(ltt,function Backtrack_Main)
endif
endfunction

function StartTrig_Backtrack takes nothing returns nothing
set gg_trg_Backtrack=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Backtrack,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(gg_trg_Backtrack,Condition(function Trig_Backtrack_Conditions))
call TriggerAddAction(gg_trg_Backtrack,function Trig_Backtrack_Actions)
endfunction
last part:
Spoiler:
call StartTrigger_Backtrack()
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: >> JASS/GUI requests/questions in here <<

Post by Aero »

Yes there are memory leaks.
There is also a coding problem.
Use this:

Code: Select all

function Trig_Backtrack_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(), 'B03S')>0
endfunction

function Backtrack_Main takes nothing returns nothing
local unit lfo=GetTriggerUnit()
local real lf7=GetEventDamage()
if(lf7>0)then
if(GetRandomInt(1,100)<=(10+(15*GetUnitAbilityLevel(lfo,'A0KP'))))then
call SetWidgetLife(lfo,GetWidgetLife(lfo)+lf7)
endif
endif
call DestroyTrigger(GetTriggeringTrigger())
endfunction

function Trig_Backtrack_Actions takes nothing returns nothing
local trigger ltt=CreateTrigger()
if GetUnitAbilityLevel(GetTriggerUnit(),'A0KP')>=1 then
call TriggerRegisterUnitEvent(ltt,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
call TriggerAddAction(ltt,function Backtrack_Main)
else
call DestroyTrigger(ltt)
endif
set ltt=null
endfunction
By the looks of this, when a unit is attacked, it has a chance to negate the damage received.
Only a few flaws:

If the negated damage is greater than your max HP, you'll die (Even if it was "blocked").
If you negate damage but your HP is full, you will take the damage.
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: >> JASS/GUI requests/questions in here <<

Post by initialD »

is that possible I edit the spells/items' tooltips without deprotecting a map?
I searched a few files but failed to get any tooltips text.
I guess I should at least have WE or WEU to do it?
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: >> JASS/GUI requests/questions in here <<

Post by Aero »

I assume you mean a non-widgetized map (This is even easier to edit, just change the tooltip in the .txt file).

To do this, extract the following files into a dummy map:

war3map.w3u
war3map.w3a
war3map.w3t
war3map.wts

Then edit away, save, and re-import those files.
User avatar
Bl00D R3av3r
Senior Member
Posts: 165
Joined: January 25th, 2008, 5:20 pm
Title: Lazy

Re: >> JASS/GUI requests/questions in here <<

Post by Bl00D R3av3r »

I need help with a trigger
I recovered gui from a map and stole the trigger but it doesn't work and i have no idea how to get it working.
Spoiler:
Unbenannt.jpg
The tooltip is: Deals a small ammount of damage and magically holds enemies in their place, unable to move or attack.
Please answer in my topic: http://forum.wc3edit.net/gui-triggers-f ... t6692.html
Image
Sig by TheWand
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: >> JASS/GUI requests/questions in here <<

Post by initialD »

Question for Aero:
What does SetMapName actually do?
I changed the map title which is above the initial small preview icon with a hex editor, I edit the maps' filename, yet let the map name on the function config unchanged. Yet the map still running well.
So my question is, what does SetMapName really do? Since it works too even though name set by SetMapName didn't match the map's actuall name on the w3x. file.
What happens iif we didn't have SetMapName in the function config?
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: >> JASS/GUI requests/questions in here <<

Post by Aero »

It doesn't set the file name (....w3x) it sets the actual map name.
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: >> JASS/GUI requests/questions in here <<

Post by initialD »

Code: Select all

local unit u=GetEnumUnit()
how to avoid memory leaks by above local?
I can't just RemoveUnit(u), becasue it will remove all units and they will be disappear.
I just wanna remove the memory leakings.
anyway doing it?
wait, does native that extends widget leaks?
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: >> JASS/GUI requests/questions in here <<

Post by Aero »

Just set u=null at the bottom of the function or after you have used it
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: >> JASS/GUI requests/questions in here <<

Post by initialD »

thanks. I didn't think it was that simple.

all right here is code taken from SgGuy's cheat menu:

Code: Select all

function hec7 takes integer bj_forLoopAIndex returns nothing
local force Fo7=GetForceOfPlayer(Player(GetForLoopIndexA()-1))
call DisplayTimedTextToForce(Fo7,10.00,(((udg_cstring[GetPlayerId(GetTriggerPlayer())+1]+(GetPlayerName(GetTriggerPlayer())+"|R"))+(" : "+GetEventPlayerChatString()))))
call DestroyForce(Fo7)
set Fo7=null
endfunction
I optimize it a bit to the following. Could you just take a look and check if there are errors or leaks?

Code: Select all

function hec7 takes integer bj_forLoopAIndex returns nothing
local  integer Fo7=GetForLoopIndexA()-1
call DisplayTextToPlayer(Player(Fo7),0,0,(((udg_cstring[GetPlayerId(GetTriggerPlayer())+1]+(GetPlayerName(GetTriggerPlayer())+"|R"))+(" : "+GetEventPlayerChatString()))))
endfunction