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

MUI Jail Spell

Status
Not open for further replies.
Level 6
Joined
Feb 10, 2011
Messages
188
Ok so I need a spell for my game
Heres some info for my explanation
Instead of thinking of the spell as a jail spell, think of it as a guard spell.

I believe I covered everything I need to in this picture to explain it

zzzzz.jpg


to clear up the 5th - down, possible guard units count as units owned by the owner of caster, if none of those are around, a unit owned by another player can be selected
 
Last edited:
Level 6
Joined
Feb 10, 2011
Messages
188
So basically you want an ability that force the unit to stay within X (configurable) units of the caster until the ability is recast?

yes basically, but with a few exceptions and what not im trying to upload the pic now
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
There are actually a really simple and possibly lame solution to that.

Unit A = jailed unit

Every 0.03 seconds check if unit A is in guard area. If not, instantly move him there. This only works if the area is the same all the time.

There you go, fixed it it with 3 actions and one event.

If you want it to be more smooth if will take quite a bit more effort.
 
Level 6
Joined
Feb 10, 2011
Messages
188
There are actually a really simple and possibly lame solution to that.

Unit A = jailed unit

Every 0.03 seconds check if unit A is in guard area. If not, instantly move him there. This only works if the area is the same all the time.

There you go, fixed it it with 3 actions and one event.

If you want it to be more smooth if will take quite a bit more effort.

ya i have done that, it doesnt work when u have 100 jailed units getting checked .03 including the things that need to happen that i listed on pick. its a hard spell that i failed on so now i need help :)
 
Level 6
Joined
Feb 10, 2011
Messages
188
http://www.hiveworkshop.com/forums/spells-569/vjass-wander-system-269473/

You inspired me to create that, it's not what you wanted but it is somewhat close. The unit walk around a certain point. As long as the user wont order them to leave, they wont.
Might give you an idea on how you create it if you know vjass.

I do not know vjass, but ill check it out maybe i can still learn something and change it to work my needs, in the mean time if anyone can do this in gui or jass that would be awesome
 
Level 10
Joined
Apr 4, 2010
Messages
509
Ok, I made it for you, MUI & GUI.
One thing though, it does not make melee units have ranged attack. I could trigger it to detect and increase the "jail range" if it is a melee guard, but I have no way of detecting if a unit is melee or not, unless you add units into separate Melee_Group & Ranged_Group variables. For now enjoy. BTW If you mentioned that it was the "Risk Territory Control" mechanic that you wanted, I would have understood you much better :xxd:
 

Attachments

  • Risk - Guard Spell.w3x
    24.2 KB · Views: 74
Level 6
Joined
Feb 10, 2011
Messages
188
Ok, I made it for you, MUI & GUI.
One thing though, it does not make melee units have ranged attack. I could trigger it to detect and increase the "jail range" if it is a melee guard, but I have no way of detecting if a unit is melee or not, unless you add units into separate Melee_Group & Ranged_Group variables. For now enjoy. BTW If you mentioned that it was the "Risk Territory Control" mechanic that you wanted, I would have understood you much better :xxd:


hahah i tried asking that way before with no results, i cant test it out atm but i am super excited to get to it. thank you so much for this.

I have been able to test it. It seems to be working flawlessly, I only had to add in one thing. I haven't done long test to see if it generates any lag, but i have a feeling it will not. About the changing the units range by adding them into separate groups you mean to do it as there created for ex. Player 1 finishes training a unit / / Unit type equal to footman // add last trained unit to melee_group?
 
Last edited:
Level 6
Joined
Feb 10, 2011
Messages
188
No worries and yeah, that's the only way I thing you can separate them. Or you can Set melee unit's classification to Giant, Ancient or Tauren.

alright, i have thought of problems that could arise from doing this to, i may just keep melee units melee for now. I may come back to you with questions once I get it fully implemented and tested
 
Level 6
Joined
Feb 10, 2011
Messages
188
Ok so i was able to work on it a little bit and test it out and implement it into my map

Things i changed were, buildings can no longer be a guard.
If a guard dies and there a units owned by dying unit within the COP the enemy will no get the base, it will instead select a new guard till no more are available in the COP

Things I need to get working and would like someone to tell me why its not working:

Ok, in my risk game the bases also have a COP, wich represents the area they have to stay in. the COP has a tower for each base
I need to COP to change ownership when the caster does, for some reason i cant get it to work heres the map View attachment Lotr Risk My Systemtest2.w3x


things needed to be added which i haven't gotten to yet:
guard can leave COP if other units owned by that player are in the COP, the barracks will simply select a new guard from the ones in the COP. if none are available guard moves back automatically
whenever a guard dies, the spell will be cased on the weakest killing unit. (lowest HP)
 
Level 10
Joined
Apr 4, 2010
Messages
509
Changed it so that there are:
  • Added circle of powers.
  • Easier guard position swaps (hey you, stand here while I go to lunch)
  • If the guard being replaced is a flag, remove the flag.
  • If guard dies when there are buddies in the circle, with him, one of the buddies will become the new guard, instead of the killer.

Picking the weakest unit is a formula I don't think I'd be able to figure it out. :/
 

Attachments

  • Risk - Guard Spell v0.1.w3x
    25.2 KB · Views: 44
Last edited:
Level 6
Joined
Feb 10, 2011
Messages
188
Changed it so that there are:
  • Added circle of powers.
  • Easier guard position swaps (hey you, stand here while I go to lunch)
  • If the guard being replaced is a flag, remove the flag.
  • If guard dies when there are buddies in the circle, with him, one of the buddies will become the new guard, instead of the killer.

Picking the weakest unit is a formula I don't think I'd be able to figure it out. :/

Oh you didnt have to do all that sir, i already did some in the map i posted but thankyou. I have a feeling you did it a better way anyways, can i ask you something about the CoP? So in my map i posted my CoP is a building, i tried to do something very similar what you did but i could not get it to work (it would not change ownership) did you happen to see what i was doing wrong?
 
Level 10
Joined
Apr 4, 2010
Messages
509
Oh you didnt have to do all that sir, i already did some in the map i posted but thankyou. I have a feeling you did it a better way anyways, can i ask you something about the CoP? So in my map i posted my CoP is a building, i tried to do something very similar what you did but i could not get it to work (it would not change ownership) did you happen to see what i was doing wrong?

What you did wrong was the order of the variables, G_Location wasn't set yet, but you made G_TempGroup search at the G_Location.
  • Set G_TempGroup = (Units within 350.00 of G_Location[G_Index] matching ((Unit-type of (Matching unit)) Equal to Guard Station))
  • Set G_COP[G_Index] = (Random unit from G_TempGroup)
  • Unit Group - Add G_Unit[G_Index] to G_Group
  • Set G_OffsetDistance[G_Index] = 300.00
  • Set G_Location[G_Index] = ((Position of G_Caster[G_Index]) offset by G_OffsetDistance[G_Index] towards 270.00 degrees)
But even after fixing that, It still has the same issue. I think it has something to do with the pick random unit search. Well it's fixed in the new map, just copy it over again. Also try to combine Guard Initialization and Randomize Bases.
 
Level 6
Joined
Feb 10, 2011
Messages
188
What you did wrong was the order of the variables, G_Location wasn't set yet, but you made G_TempGroup search at the G_Location.
  • Set G_TempGroup = (Units within 350.00 of G_Location[G_Index] matching ((Unit-type of (Matching unit)) Equal to Guard Station))
  • Set G_COP[G_Index] = (Random unit from G_TempGroup)
  • Unit Group - Add G_Unit[G_Index] to G_Group
  • Set G_OffsetDistance[G_Index] = 300.00
  • Set G_Location[G_Index] = ((Position of G_Caster[G_Index]) offset by G_OffsetDistance[G_Index] towards 270.00 degrees)
But even after fixing that, It still has the same issue. I think it has something to do with the pick random unit search. Well it's fixed in the new map, just copy it over again. Also try to combine Guard Initialization and Randomize Bases.

oh damn im an idiots, its been a while since ive done this. hmm ok ill do that. thanks for the help man.
 
Status
Not open for further replies.
Top