| 08-14-2014, 04:39 PM | #1 |
in one of my maps i am planning to have a hospital that heals units inside it. i created 1 trigger to do it but it is way too random. how can i trigger it perfectly. |
| 08-14-2014, 10:13 PM | #2 |
You could start by showing us what you already have. |
| 08-15-2014, 10:44 PM | #3 |
every 2 seconds of game time is the event. the action is pick every unit in units owned by owner of unit matching unit is being transported equal to true and do unit set life of unit to life of unit + 1. the trigger that adds it to the unit variable have unit a unit is loaded into a transport set unit = triggering unit. i am doing all of my warcraft 3 work on a disconnected pc so i cant copy the triggers directly. |
| 08-15-2014, 11:54 PM | #4 |
AutoEvents has OnUnitLoad and OnUnitUnload events which would do exactly what you wanted but I know you wont use that because you somehow think you will get banned for using vJass. So instead I'll write you a simpler version with just the load/unload stuff. My one condition is that anything I do for you, I'm writting in vJass. It's pretty simple so you should have no trouble converting it to normal jass yourself. The only problem I had was that if the Item Life Regeneration Ability wasn't changed from an item ability to unit, then it wouldn't heal. JASS:library GarrisonHealing initializer Init globals private constant integer HEAL_ABILITY_ID = 'A000' //Ability ID of the Item Life Regeneration ability private group Group = CreateGroup() //Group used to store which units are inside transport private real MaxX private real MaxY endglobals function Enter takes nothing returns boolean local unit u = GetLoadedUnit() if not IsUnitInGroup(u, Group) then call GroupAddUnit(Group, GetLoadedUnit()) call UnitAddAbility(u, HEAL_ABILITY_ID) //Move the unit outside of the map so when they leave the transport they re-enter the map //and trigger the EnterRegion Event call SetUnitX(u, MaxX) call SetUnitY(u, MaxY) endif set u = null return false endfunction function Leave takes nothing returns boolean local unit u = GetFilterUnit() if IsUnitInGroup(u, Group) then call GroupRemoveUnit(Group, u) call UnitRemoveAbility(u, HEAL_ABILITY_ID) endif set u = null return false endfunction function Death takes nothing returns boolean local unit u = GetDyingUnit() if IsUnitInGroup(u, Group) then call GroupRemoveUnit(Group, u) call UnitRemoveAbility(u, HEAL_ABILITY_ID) endif set u = null return false endfunction //=========================================================================== private function Init takes nothing returns nothing local trigger trig = CreateTrigger() local rect b = GetWorldBounds() local region r = CreateRegion() call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_LOADED) call TriggerAddCondition(trig, Condition(function Enter)) call RegionAddRect(r, b) set MaxX = GetRectMaxX(b) //Record the coordinates of a corner of the map so that loaded units can be set MaxY = GetRectMaxY(b) //moved to that location so when they are unloaded, they reenter the map set trig = CreateTrigger() call TriggerRegisterEnterRegion(trig, r, function Leave) set trig = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_DEATH) call TriggerAddCondition(trig, Condition(function Death)) call RemoveRect(b) set trig = null set b = null set r = null endfunction endlibrary Credit's should go to grim as I've essentially just rewritten his code into a smaller version. |
| 08-16-2014, 12:21 PM | #5 |
i havent learned jass so i dont know how to rewrite vjass to regular jass. all of my scripts are created without the use of jass. please recreate the system with triggers. |
| 08-17-2014, 12:24 AM | #6 |
Sorry, this is all you're getting from me. |
| 08-17-2014, 09:22 PM | #7 |
then you wont be able to help me as i dont understand jass at all. |
| 08-20-2014, 10:17 PM | #8 | |
i mean im not gonna touch this one in gui either but Quote:
andreas, if you want to do this you should try and use the code Fled posted -- if you want a good system, this is the way to go in order to convert it to GUI (and not give you a heart attack) you'll need to do a few simple steps. basically all your doing is manually replacing the vJASS with JASS. on a side note, that's what happens with vJASS -- just instead of asking us to do it, the computer does it Declare one variable in that variable manager window. the one you access via the trigger editor with the X symbol group Hospital_Group (with initial value = CreateGroup()) Make a trigger named ThanksFledForTheCode and paste this inside JASS:function Enter takes nothing returns boolean local unit u = GetLoadedUnit() if not IsUnitInGroup(u, udg_Hospital_Group) then call GroupAddUnit(udg_Hospital_Group, GetLoadedUnit()) call UnitAddAbility(u, 'A000') //Move the unit outside of the map so when they leave the transport they re-enter the map //and trigger the EnterRegion Event call SetUnitX(u, GetRectMaxX(GetWorldBounds())) call SetUnitY(u, GetRectMaxY(GetWorldBounds())) endif set u = null return false endfunction function Leave takes nothing returns boolean local unit u = GetFilterUnit() if IsUnitInGroup(u, udg_Hospital_Group) then call GroupRemoveUnit(udg_Hospital_Group, u) call UnitRemoveAbility(u, 'A000') endif set u = null return false endfunction function Death takes nothing returns boolean local unit u = GetDyingUnit() if IsUnitInGroup(u, udg_Hospital_Group) then call GroupRemoveUnit(udg_Hospital_Group, u) call UnitRemoveAbility(u, 'A000') endif set u = null return false endfunction //=========================================================================== function InitTrig_ThanksFledForTheCode takes nothing returns nothing local trigger trig = CreateTrigger() local rect b = GetWorldBounds() local region r = CreateRegion() call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_LOADED) call TriggerAddCondition(trig, Condition(function Enter)) call RegionAddRect(r, b) set trig = CreateTrigger() call TriggerRegisterEnterRegion(trig, r, function Leave) set trig = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_DEATH) call TriggerAddCondition(trig, Condition(function Death)) call RemoveRect(b) set trig = null set b = null set r = null endfunction boom done. you'll have a shittier, JASS version of the code fled posted i hardcoded the values in. let's face it |
| 08-21-2014, 01:19 AM | #9 |
If he acts like an idiot, I'll treat him like one. He can't use vjass because blizzard will ban him, he can't use that version either because he thinks if you get anything wrong in jass, you have to reinstall wc3. It would actually be really simple for him to convert it to GUI himself. It's 3 events; unit loaded, unit enters playable map and unit dies. The 3 actions are super simple as well, all their function names are pretty easy to figure out their GUI counterparts |
| 08-21-2014, 11:15 AM | #10 |
nngh andreas, i tested the code before i posted it. as long as you name the function correctly, declare the group variable, and c&p my ver, it will at the least compile why are your worried about it corrupting wc3, thats crazy. youd have to do some really dirty things to your editor |
| 08-21-2014, 05:31 PM | #11 | |
Quote:
However, if he is still using the vanilla editor then some Jass errors can cause it to crash (or did Blizzard fix this at some point? I don't know, I've been using the NewGen editor for so long that I can't even remember what were the errors that caused the crash), in which case you still won't have to reinstall the game but you might loose some progress on your map depending on how often you save. But if Yrth tested his code, then even this problem won't happen. |
| 08-21-2014, 11:04 PM | #12 |
Yeah, it's silly as shit but he wont use the jass code because that's what he believes. |
| 08-22-2014, 10:05 AM | #13 |
i am always using the editor that comes with the game. to cite blizzard`s email to me: blizzard will not condone the use of a third party program. that is why i dont use third part programs.(i respect blizzard.) one thing i notice however is that units retain their regeneration while inside the test building so maybe increasing regeneration rate of the garrisoned unit would be possible. i did however try to give abilities to garrisoned units and that did nothing. that likely means that garrisoned units cant use abilities though i dont know why. |
| 08-23-2014, 12:27 AM | #14 | |||
Quote:
Quote:
Quote:
|
| 08-25-2014, 10:18 PM | #15 |
i create my own test maps to test functions and there i added a healing ability to units that was garrisoned and that did nothing. while being garrisoned however the unit retained its regeneration. increasing regeneration therefore could do what i want. |
