|
|
#16 |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
Offtopic:
__________________There is no such thing as common knowledge in JASS USE NAMED CONSTANTS FFS. constant real WIDGET_MIN_LIFE = 0.405 and than you put a comment by that constant. Besides why would this be wrong? JASS:if GetWidgetLife(W.dummy) < 0 then |
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#17 |
|
Nonchalant
Respected User
|
Moyack, your version will come up with the same problem. It's essentially the same as his original method. The way Anitarf suggested is exactly the way I was thinking, and the way I would do it.
__________________Your current method isn't as good an implementation of that method as I think it could be. I would have a separate node struct to form the linked list and have a linked list attached to the caster. I would then have a single timer and keep an array of units with webs out and run through it on timer expire. Then you have your level integer and iterate through the linked list of webs, if a web is dead you remove the node from the list and relink, otherwise you set the level to max(current,web) if the unit is in range of the web. Then you carry on with adding invisibility if level > 0 etc. |
|
|
|
|
|
#18 |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
Well that was the idea I got in the first place but it has one small flaw.
__________________Using linked list that can be accessed by every caster on the map is not thread safe. |
|
|
|
|
|
#19 | |
|
Evil Emoticon
Respected User
Project Leader: PoC |
Quote:
Then I'm afraid I didn't understood the bug, The bug, as far as I know, is that the caster put several webs, then if the caster leaves one web and enter to other and then comes back to the previous web, the invisibility effect didn't take effect. If it's not that, then explain me what is the bug. Blu: I did my test, and this bug is not happening with my version. Download here: http://www.wc3campaigns.net/attachme...1&d=1186520259 Last edited by moyack : 08-09-2007 at 10:14 PM. |
|
|
|
|
|
|
#20 | |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
Quote:
Not true. his version will work fine. |
|
|
|
|
|
|
#21 |
|
Evil Emoticon
Respected User
Project Leader: PoC |
Ok, I've changed the range of effect in this ability, and now I can see what Blu means. That flickering effect made me understand why are you setting one timer for all the system and all that stuff.
I propose to solve this in the easiest way possible, and is only allow to have one web at a time. Probably you're calling me lazy, but I think this solution is better and safer than having a complicated code to only prevent that bug. Last edited by moyack : 08-10-2007 at 01:13 AM. |
|
|
|
|
|
#22 |
|
Roar!
|
Im glad you guys are having a nice conversation about this.
__________________Grr Im gettin confused about the linked lists part though. Any idea how should I do this? Right now Im thinking about a struct that holds a caster and his webs, to add it more web's I'll loop through and see in the beginning of the trigger if the caster is the same person etc. . I currently know now the way Im doing it is a bit... messy and complicated. -Av3n Last edited by Av3n : 08-10-2007 at 06:01 AM. |
|
|
|
|
|
#23 |
|
I blink, therefore I am.
Join Date: Sep 2006
Posts: 1,812
![]() ![]() ![]()
|
For using 1 timer, this is how I would do it:
__________________Create a global struct variable that holds the first struct in the series. (the code would check to see if its empty and if it is, set it to the new one, and if not, get the back one (either go through the structs or use another global variable) and then add it to the back. Each struct would then have 2 more values, a previous struct, and then a next struct. When you need to remove a struct, you change the "Next" value of the previous stuct the the "Next" value of the current struct, and then the "Previous" value of the next struct is set to the "Previous" value of the current struct; then destroy it. When your global timer expires, go through the stack of structs and do all your code, like in a loop. |
|
|
|
|
|
#24 | |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
Quote:
Awww man don't give up so easily. Ok I did this spell using ABC, it was petty easy. And for you people that think linked lists are a good idea in JASS, well you have a lot lot to learn about programming. Here it is: JASS://============================================================================== // JESP Web spell v3.0 //============================================================================== // // AUTHORS: // * Av3n - original map, idea and spell // * Moyack - ward, spellbook and summon trigger improvements // * Cohadar - converting to ABC, global group loop, removing flicker bug // // Contact us at [url]www.wc3campaigns.net[/url] // // REQUIREMENTS: // * JASSHelper preprocessor // * ABC system // //============================================================================== scope ABCWeb globals private constant real AOE = 500. private constant integer AID_SpellBook = 'A000' // Ability ID private constant integer SID_Web = 'A001' // Spell ID private constant integer UID_Web = 'e000' // Unit ID private constant real DEATH_BORDER = 0.405 // no I don't know why. private integer web_count = 0 // number of webs on the map private group websGroup = CreateGroup() // this group holds all the webs on the map private timer websTimer = CreateTimer() //We use this as a global timer for checking web private constant integer GENERIC_TIMER = 'BTLF' private constant real checkPeriod = .1 //Loop rate for checking if the caster within the web endglobals // This struct will be attached to every Web that is summoned // All summoned webs will ge kept in global group websGroup private struct WebData unit caster = null player owner = null integer level = 0 endstruct // This method is called for every web on the map // so it is here where real action happens function ForWebs takes nothing returns nothing local unit web = GetEnumUnit() local WebData data = GetStructA(web) if IsUnitInRange(data.caster, web, AOE) and GetUnitAbilityLevel(data.caster, AID_SpellBook) < 1 then call UnitAddAbility(data.caster, AID_SpellBook) endif if not IsUnitInRange(data.caster, web, AOE) and GetUnitAbilityLevel(data.caster, AID_SpellBook) > 0 then call UnitRemoveAbility(data.caster, AID_SpellBook) endif if GetWidgetLife(web) < DEATH_BORDER then if GetUnitAbilityLevel(data.caster, AID_SpellBook) > 0 then call UnitRemoveAbility(data.caster, AID_SpellBook) endif call GroupRemoveUnit(websGroup, web) // first we remove web from global group call ClearStructA(web) // than we remove web->struct attachment call data.destroy() // than we destroy the struct endif set web_count = web_count + 1 set web = null endfunction // Global timer is periodically startig this // It basically does a loop through all webs on the map // ADVICE: Always start your periodic functions with Periodic prefix private function PeriodicWebCheck takes nothing returns nothing set web_count = 0 call ForGroup(websGroup , function ForWebs ) // this will also increase web_count if web_count == 0 then call PauseTimer(websTimer) //Pausing the timer if there is no webs endif endfunction private constant function webDuration takes real level returns real return 30.*level //Web's life time. The value is real endfunction public function Actions takes nothing returns nothing local unit web = GetSummonedUnit() local WebData data = WebData.create() set data.caster = GetSummoningUnit() set data.owner = GetOwningPlayer(data.caster) set data.level = GetUnitAbilityLevel(data.caster, SID_Web) call SetStructA(web, data) // first attach the data to web call GroupAddUnit(websGroup, web) // and then add web to the global web group call UnitApplyTimedLife(web,GENERIC_TIMER,webDuration(I2R(data.level))) // If there were no webs timer was stopped, so we must start it again if web_count == 0 then call TimerStart(websTimer,checkPeriod,true,function PeriodicWebCheck) //Starting the Timer if it isn't started endif set web = null endfunction public function Conditions takes nothing returns boolean return GetUnitTypeId(GetSummonedUnit()) == UID_Web endfunction //=========================================================================== function InitTrig_Web takes nothing returns nothing //Creating an local trigger creating it then nulling it. //No global trigger varibles are needed local trigger t = CreateTrigger() local integer i = 0 loop // Disables to all players the spell container ability // so it can't display in the command card. exitwhen i > 15 call SetPlayerAbilityAvailable(Player(i), AID_SpellBook, false) set i = i + 1 endloop call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON ) call TriggerAddCondition(t, Condition( function Conditions ) ) call TriggerAddAction(t, function Actions ) set t = null endfunction endscope |
|
|
|
|
|
|
#25 |
|
Roar!
|
Wow... Everyone is being nice to me all of a sudden? I want to see everyone else's comments first and suggestions then piling it up for the end result. And I have to make a damn long credit/help list as well. Thanks cohadar 4 yr suggestion, my brain is being filled up with loads of info etc. i'll have to link to these diff versions after when v3.00 of the 'real' web comes out.
__________________-Av3n Last edited by Av3n : 08-10-2007 at 10:10 AM. |
|
|
|
|
|
#26 |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
Oh come on give me a break.
__________________What are you going to do now? Waste more time on this. Find an alternative method that does just the same? why? So you can call it 100% yours? And we are not "being nice to you" nor we are trying to take over your spell. Moyack made some really good modifications on your map because he tried to help you and I made modifications of his map because there was an interesting problem of attaching variable number of structs to a periodic event (and because I wanted to show off with my ABC system :P ) So there is nothing 'unreal' about this last version of Web, you simply need a better understanding of what "open source" is all about. I suggest you relax, stop wasting your time, and use experience from this thread in your future spells. nuff said. |
|
|
|
|
|
#27 |
|
Roar!
|
I think that it would be stupid looking for another solution for my spell(Since this is my first time experimenting with vJass) I'll go with cohadar/moyack version. Since why Im using their version... I know moyack and cohadar been really helpful. Im gonna do some changes to the code.(But trying to keep it the same way.) Reppies for you guys. The new version will be released tomorrow
-Av3n EDIT: Here's a quick reference of the updated web spell. I still got that multiple web probelm on this version so I want to see your say of this version or the current official Web v2.02a. If you want to keep the official find a better way than the way im doing it. If you want this version fix the multiple web problem or agree to only have 1 web at a time. Last edited by Av3n : 08-12-2007 at 03:46 AM. |
|
|
|
|
|
#28 |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
Made it to work finally.
But there are some tradeoffs. Invisibility is no longer added in a spellbook, it is now casted by a web. Hero regen is no longer added to a hero, web has regen aura now. I also made the web locust, but that is optional. Spell is working fine but: Hero cannot attack from the web, this is because casted invisibility is stopping attacks. Witch is fine by me, I cannot attack them from the web, they cannot attach me in the web, pretty balanced. But I have extra regen in the web, we fight I get dmgd, run into the web like a scared girl, and after couple of sec when I regen I come out and pwnzor you, mwahahahhahaha. There is also a nice little buff that tells you that you are in the web. Anyways Av3n, web is far from complete, you should add spell level checking and possibly ability for all friendly units to hide in the web, or maybe all friendly units that are spiders :D JASS:scope Web //============================================================================== // JESP Web spell v3.01 //============================================================================== // // AUTHORS: // * Av3n - original map, idea and spell // * Moyack - ward, spellbook and summon trigger improvements // * Cohadar - converting to ABC, global group loop, removing flicker bug // // Contact us at [url]www.wc3campaigns.net[/url] and visit [url]www.clancbs.com[/url] // // REQUIREMENTS: // * JASSHelper preprocessor // * ABC system // //============================================================================== //Configuration globals // Make sure that web insibility has this casting range // and Web regen aura has this AOE private constant real AOE = 300. //private constant integer AID_SpellBook = 'A003' // Ability ID of "Web Book" private constant integer SID_Web = 'A000' // Spell ID of "Web" private constant integer UID_Web = 'e000' // Unit ID of "Web" // Should not be less than one second, this is basically a fade-out time now private constant real checkPeriod = 1.0 //Loop rate for checking if the caster within the web endglobals //All other configuration is edited at the spell object //Support globals private integer web_count = 0 // number of webs on the map private group websGroup = CreateGroup() // this group holds all the webs on the map private timer websTimer = CreateTimer() //We use this as a global timer for checking web endglobals private struct WebData unit caster = null integer level = 0 endstruct //Check all Webs function CheckRanges takes nothing returns nothing local unit web = GetEnumUnit() local WebData data = GetStructA(web) if GetWidgetLife(web) < 0.405 then call GroupRemoveUnit(websGroup, web) call ClearStructA(web) call data.destroy() else set web_count = web_count + 1 if IsUnitInRange(data.caster, web, AOE) then call IssueTargetOrder( web, "invisibility", data.caster ) endif endif set web = null endfunction private function PeriodicWebCheck takes nothing returns nothing set web_count = 0 call ForGroup(websGroup , function CheckRanges ) if web_count == 0 then call PauseTimer(websTimer) endif endfunction //Primary Functions private function Actions takes nothing returns nothing local unit web = GetSummonedUnit() local WebData data = WebData.create() set data.caster = GetSummoningUnit() set data.level = GetUnitAbilityLevel(data.caster, SID_Web) call SetStructA(web, data) call GroupAddUnit(websGroup, web) if web_count == 0 then call TimerStart(websTimer,checkPeriod,true,function PeriodicWebCheck) endif set web = null endfunction private function Conditions takes nothing returns boolean return GetUnitTypeId(GetSummonedUnit()) == UID_Web endfunction //Init function function InitTrig_Web takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON ) call TriggerAddCondition(t, Condition( function Conditions ) ) call TriggerAddAction(t, function Actions ) set t = null endfunction endscope |
|
|
|
|
|
#29 |
|
Evil Emoticon
Respected User
Project Leader: PoC |
I'm sure that this spell has become a good exercise to fix and stupid but complex problem in jass. Stupid in the sense that the effect is "simple" and complex because it requires a lot of work to get it working properly.
I have one idea to fix this but I'll discuss privately with av3n, of course if he and me are online on messenger. |
|
|
|
|
|
#30 | |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
Quote:
Witch of the problems exactly? And why private talk? The whole purpose of this forum is for peoples to find solutions together. EDIT: Btw one of the solutions is in my signature :P Last edited by cohadar : 08-13-2007 at 04:06 PM. |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |