HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A simple question

02-08-2005, 02:03 AM#1
Bone-Doggey
I want to make it so that when a unit runs out of mana, it will have its ownership transfered to neutral passive. When I use the event: "Unit - mana", it requires me to choose a specific unit from the map that is already there... I want to make it so that it affects every unit. There are no other options besides choosing a unit, or selecting the selecting the preset: "no unit"

Sorry about not having a very good discription, but could someone help me?
02-08-2005, 03:30 AM#2
Guest
Perhaps a periodic event checking every unit in map every n secs? I am not sure how lagging that is. Perhaps you can build a inverse heap with lowest value at top ( I built a heap here with handles )? So you can check only the top, avoiding heavy lag. It's only a suggestion. Speaking frankly, I have never undergone massive lag test issues, no idea how would this behave.
02-08-2005, 04:03 AM#3
Bone-Doggey
Waaaaaaay too laggy... I couldn't even test whether it had worked or not...
Well I did it on a longer periodical time, and it doesn't work.
Any more ideas?
02-08-2005, 05:45 AM#4
Guest
**Disclaimer: THIS WILL NOT CAUSE LAG!!!**


Event: Every 1 second of game time
Action: Group units: pick every units in (units in whole map)
If unit property (mana) of (picked unit) strictly inferior to 1, then remove (picked unit) from the game, else do nothing (do not use equal to 0, because 0,99 mana will also display a 0, etc.)
02-08-2005, 01:03 PM#5
Guest
what you want should be under "generic unit events".
(it was an event you wanted. wasnt it?)
02-08-2005, 07:08 PM#6
ElvinArcher123
you cant do a generic comparison... integers from units cant use generic units. Generic units are for things like casting a spell issuing an order etc.
02-08-2005, 07:15 PM#7
Guest
jsut i thought but u could do a dummy spell (immolation) and do Unit finish casting then do change owner ship but u would have to change the mana reduce to 1 and set it so that when it gets to 0 it cancels it instead of in other spells were it goes to 15.
02-08-2005, 07:17 PM#8
Guest
just i thought but u could do a dummy spell (immolation) and do Unit finish casting then do change owner ship but u would have to change the mana reduce to 1 and set it so that when it gets to 0 it cancels it instead of in other spells were it goes to 15.
02-08-2005, 09:49 PM#9
Guest
Just an idea, depending on what the mana is being used for exactly. But I was wondering whether you could use an event such as unit cast spell, and then after the spell is casted use an 'if' action to see if the mana is less than 1. I'm pretty sure that you can check this with a 'real' comparison. But that assumes that in your map, the only thing consuming mana is spellcasting.
02-08-2005, 09:56 PM#10
ThyFlame
For the perioidic event to work, the unit has to have a mana regeneration time less than time it takes for a unit to regain 1 mana, so if a unit gained 1 mana every .9 seconds, a 1 second periodic event wouldn't work. There is also the case of overlap, so the time could actually be higher than the periodic event, but that's another thing to worry about.

Suffice to say if the unit regains mana quickly, the periodic event wont work. If it does, that may likely be your only solution.
02-08-2005, 10:05 PM#11
Bone-Doggey
Well I am trying to make it so that when a unit mana = to 0 (event/condition)
then tranfer ownership to neutral passive (action)

I want to find a way to have an event to make this trigger work
02-08-2005, 11:11 PM#12
Guest
Quote:
Originally Posted by Bone-Doggey
Well I am trying to make it so that when a unit mana = to 0 (event/condition)
then tranfer ownership to neutral passive (action)

I want to find a way to have an event to make this trigger work

Well, as I suggested above, if mana is only lost when spells are cast by that unit, then you can have something like:

Event: A unit casts a spell
Action: If mana of casting unit is less than 1 then unit-change ownership of casting unit to neutral passive.

Or something along these lines.
02-08-2005, 11:14 PM#13
Vexorian
Quote:
Originally Posted by BadFurDay
**Disclaimer: THIS WILL NOT CAUSE LAG!!!**


Event: Every 1 second of game time
Action: Group units: pick every units in (units in whole map)
If unit property (mana) of (picked unit) strictly inferior to 1, then remove (picked unit) from the game, else do nothing (do not use equal to 0, because 0,99 mana will also display a 0, etc.)
That leaks, so it will cause lag after a few minutes.

You can just make something like

A unit enters playable map area
-
trigger - To (mana is 0 (gen)) add the event (triggering unit) mana is equal than or less than 0


Map initialization
Custom Script: set bj_wantDestroyGroup=true
Unit Group pick eery unit in units in playable map area and do
- trigger - To (mana is 0 (gen)) add the event (picket unit) mana is equal than or less than 0
02-08-2005, 11:39 PM#14
Bone-Doggey
Well I finally got it to work, though I had to figured it out myself!
Thanks to everyone that tried to help me!
I will try to rep each person that tried to help

If you want to see my map, go to map development, it's far from finished, at the moment it only shows some of the abilities that a unit has. I will update it when I make breakthroughs hehe
02-09-2005, 08:09 AM#15
Guest
That's funny how Lord Vexorian everytimes solves everything with some triggers that are not so hard but complicated to think about

Bone-Doggey BTW I'd be glad to know what your trigger is ^_^