wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 04-20-2009, 08:04 PM   #1
Drain Pipe
User
 
Join Date: May 2006
Posts: 129

Drain Pipe has little to show at this moment (3)

Default A bunch of random questions and problems

So I've started to do some coding again, sort of, and I have a few questions and problems: these are in no particular order:

1) Has anyone been able to trigger proper bouncing off of cliffsides (ie they bounce off in roughly the right direction) and other protrusions with any sort of given knockback system?

2) What's a good way to detect cliffs and distinguish between them and hills? Also in the same respect, how can you trigger that a unit can slide up and down hills, but bounce or fly off of cliffs?

3) What is a good way to detect damage coming from ranged unit orb attacks and regular abilities?

4) How do you make floating texts only appear for a particular player? (I just don't know the syntax )

5) What would cause a trigger to skip actions without you telling it to? I seem to have this problem because all of my spells were working properly before and I tried adding in a new system to display damage dealt and now some spells don't seem to work, even though I thought they were completely isolated from the workings of the damage system.

6) Attached to this is my testmap, which contains the buggy system (using .GUI, sorry ) for making self-updating floating texts which update whenever a unit takes additional damage from the same source, and eventually dissipate and display the correct damage after a short period of time. How would you do this using JASS?


[edit] removed map, link below

Last edited by Drain Pipe : 04-26-2009 at 06:30 PM.
Drain Pipe is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-20-2009, 10:32 PM   #2
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,025

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Cliffs are typically not pathable, hills are.
__________________
Anitarf is offline   Reply With Quote
Old 04-20-2009, 10:53 PM   #3
Drain Pipe
User
 
Join Date: May 2006
Posts: 129

Drain Pipe has little to show at this moment (3)

Default

but at the same time, the upper and lower levels of walkable terrain is. Considering I'm currently measuring on a point basis, if I miss the point where it's unpathable, my units are just gonna keep going. Unless there's a specific way to check this already?
Drain Pipe is offline   Reply With Quote
Old 04-20-2009, 11:22 PM   #4
TheKid
User
 
TheKid's Avatar
 
Join Date: Mar 2009
Posts: 195

TheKid will become famous soon enough (37)TheKid will become famous soon enough (37)

Default

Quote:
Originally Posted by Drain Pipe
1) Has anyone been able to trigger proper bouncing off of cliffsides (ie they bounce off in roughly the right direction) and other protrusions with any sort of given knockback system?

Yes, I have. It is not in the resources section though. I use a vector library to easily calculate an object's "velocity" and "position" vectors while applying the "acceleration" vector to the velocity vector properly. This achieves the effect of real physics. It really isn't that difficult once you know the vector math behind it.

Quote:
Originally Posted by Drain Pipe
2) What's a good way to detect cliffs and distinguish between them and hills? Also in the same respect, how can you trigger that a unit can slide up and down hills, but bounce or fly off of cliffs?

If you're triggering a slide, then you can find the current cliff-level before you update the unit's position and then again after. If the two values are not the same, then the unit has officially moved down/up a cliff level. You could use different comparison operators to achieve different results. The function is: GetTerrainCliffLevel;

Quote:
Originally Posted by Drain Pipe
3) What is a good way to detect damage coming from ranged unit orb attacks and regular abilities?

Most orb effects yield buffs on an affected unit, which you could detect using the EVENT_UNIT_DAMAGED unit event. Orb effects can also be applied to melee attacks, so if you can imagine every unit is given an "invisible" orb ability then you would be able to detect when an instance of damage has come from a trigger (or a regular ability) or a physical attack.

Quote:
Originally Posted by Drain Pipe
4) How do you make floating texts only appear for a particular player? (I just don't know the syntax )

Collapse JASS:
if GetLocalPlayer() == specificPlayer then
    // create and setup the floating text within this block
endif

In the previous code specificPlayer refers to a variable reference to the player that you would like to display the text-tag (floating text) for. For example, if it were the case that specificPlayer was set to reference the player Player(0) then the text-tag would only be displayed to player one.

This is what I could answer off the top of my head, I'll look into your other queries. **I just saw the name of your map now, and its kind of funny - I have a map I'm working on named "Heroes" as well.

This is something that I saw when looking through your "Damage setup" triggers.

Trigger:
Global unit damage detection setup
Collapse Events
Map initialization
Conditions
Collapse Actions
Set TempStartGroup = (Units in (Playable map area))
Collapse Unit Group - Pick every unit in TempStartGroup and do (Actions)
Collapse Loop - Actions
Trigger - Add to Damage setup <gen> the event (Unit - (Picked unit) Takes damage)

You should add a "Custom Script: DestroyGroup( udg_TempStartGroup )" to remove the group handle. It doesn't make much of a difference because the group is only referenced once, but its always nice to try and be 100% clean.

Trigger:
Do Multiple ActionsFor each (Integer A) from 1 to 1600, do (Actions)
Loop - Actions

The idea of updating these text-tags every 0.05 seconds, in which you loop through 1600 indexes doesn't seem very efficient to me. I think there might be a better (and quicker) way to go about this. If anybody pops out at me while I'm reading this I'll try and explain it.

Last edited by TheKid : 04-20-2009 at 11:37 PM.
TheKid is offline   Reply With Quote
Old 04-20-2009, 11:46 PM   #5
Drain Pipe
User
 
Join Date: May 2006
Posts: 129

Drain Pipe has little to show at this moment (3)

Default

1) I got as far as units, but cliffsides don't work the same way because it doesn't collide with another object. I had an idea to create 3+ expanding points which stopped when they hit a cliff jump, then use those points to create a best fit line and use that as my bouncing reference (ie my virtual wall) I'm worried this might lag a lot so i wanted to know if there was a better method for bouncing off of cliffsides.

2) Ok that's what I did, well sort of. Each cliff is actually 128 higher than the previous one so i just did a multiplier to check for that difference and it worked ok...

3) The problem is that I don't need an orb effect for regular melee units because of how i setup my detection (ie all damage not coming from attack comes directly from the hero) The problem with orb effects is i tried using cold arrows and when I tried to get the damage, it returned 0. And it's useless if you want to have damage dealt based on attack damage dealt, so that doesn't work for me either if there is an ability that works and doesn't return 0 damage then I'll use that. Or I'll cheat.....

4) Thanks I'll try and work that in right away.

BTW that damage detection is pretty much a copy of the really leaky one I saw on here but it's the only non-jass way I could setup my preliminary system.

Also, I know that 1600 cycles is very inefficient, that's why I was wondeirng how I'd set this up differently in JASS (i'm slowly making the transition)

that 1600 is basically 16 groups of 100 possible units running at 1 time. If a unit exists in a slot, then it updates the FT for that unit and cycles through for all units. This is the only way I could think of to make it MUI for 12 players (since i'm not sure which 12 are users and which 4 are neutral...)

Last edited by Drain Pipe : 04-20-2009 at 11:50 PM.
Drain Pipe is offline   Reply With Quote
Old 04-21-2009, 12:11 AM   #6
Dark.Revenant
User
 
Dark.Revenant's Avatar
 
Join Date: Feb 2007
Posts: 348

Submissions (1)

Dark.Revenant will become famous soon enough (44)Dark.Revenant will become famous soon enough (44)

Default

For the 1,600 cycles thing, construct a simple algorithm by using a loop that figures out the highest number to cycle through, updating each time a projectile is created.
__________________
Dark.Revenant is offline   Reply With Quote
Old 04-21-2009, 01:13 AM   #7
Drain Pipe
User
 
Join Date: May 2006
Posts: 129

Drain Pipe has little to show at this moment (3)

Default

Yeah that might cut it down to about 1/4-1/10th of it's used space since the FT instances last about 2-3 seconds before the slot is voided. Hmmm, I could also use the more efficient way of replacing the values from the last slot to the current slot. That way the system would only be running at about 5% capacity for most of the time, and for large unit groups, maybe 20-25%. Could be interesting to see how much faster it goes. In all actuality, unless there's a full house and every type of player is used, this system uses a very small portion of its capacity. Each player is about 6% of the systems capacity. So if no creeps are used then it's already using 24% less space each time it runs through, if i set it up right.

Last edited by Drain Pipe : 04-21-2009 at 01:16 AM.
Drain Pipe is offline   Reply With Quote
Old 04-24-2009, 02:38 AM   #8
Drain Pipe
User
 
Join Date: May 2006
Posts: 129

Drain Pipe has little to show at this moment (3)

Default

BUMP:

Ok I have a new question, well moreso a problem:

For my floating text system, I've tried updating it so that it uses less space as to run faster, here's what I have thus far (Note the system right now is restricted to only display damage done by player 2 (blue), which is the player slot you take if you run the testmap from WE):

The main damage detection part(3 triggers):

Trigger:
Global unit damage detection setup
Collapse Events
Map initialization
Conditions
Collapse Actions
Set TempStartGroup = (Units in (Playable map area))
Collapse Unit Group - Pick every unit in TempStartGroup and do (Actions)
Collapse Loop - Actions
Trigger - Add to Damage setup <gen> the event (Unit - (Picked unit) Takes damage)

Trigger:
Global unit damage detection update
Collapse Events
Unit - A unit enters (Entire map)
Conditions
Collapse Actions
Trigger - Add to Damage setup <gen> the event (Unit - (Entering unit) Takes damage)



Trigger:
Damage setup
Events
Collapse Conditions
(Damage taken) Greater than 0.00
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Triggering unit) is in DamagedUnitGroup_Player[(Player number of (Owner of (Damage source)))]) Equal to False
Collapse Then - Actions
Unit Group - Add (Triggering unit) to DamagedUnitGroup_Player[(Player number of (Owner of (Damage source)))]
Set DamagedUnitGroupUnit[((100 x ((Player number of (Owner of (Damage source))) - 1)) + DamagedUnitGroup_int_Player[(Player number of (Owner of (Damage source)))])] = (Triggering unit)
Set DamagedUnitGroup_DMG[((100 x ((Player number of (Owner of (Damage source))) - 1)) + DamagedUnitGroup_int_Player[(Player number of (Owner of (Damage source)))])] = (Damage taken)
Floating Text - Create floating text that reads <Empty String> above (Triggering unit) with Z offset -50.00, using font size (8.00 + (4.00 x (DamagedUnitGroup_DMG[((100 x ((Player number of (Owner of (Damage source))) - 1)) + DamagedUnitGroup_int_Player[(Player number of (Owner of (Damage source)))])] / 300.00))), color (40.00%, 40.00%, 40.00%), and 90.00% transparency
Set DamagedUnitGroup_FT[((100 x ((Player number of (Owner of (Damage source))) - 1)) + DamagedUnitGroup_int_Player[(Player number of (Owner of (Damage source)))])] = (Last created floating text)
Countdown Timer - Start DamagedUnitGroup_Timer[((100 x ((Player number of (Owner of (Damage source))) - 1)) + DamagedUnitGroup_int_Player[(Player number of (Owner of (Damage source)))])] as a One-shot timer that will expire in 0.35 seconds
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
DamagedUnitGroup_int_Player[(Player number of (Owner of (Damage source)))] Less than or equal to 100
Collapse Then - Actions
Set DamagedUnitGroup_int_Player[(Player number of (Owner of (Damage source)))] = (DamagedUnitGroup_int_Player[(Player number of (Owner of (Damage source)))] + 1)
Collapse Else - Actions
Set DamagedUnitGroup_int_Player[(Player number of (Owner of (Damage source)))] = 1
Collapse Else - Actions
Collapse For each (Integer A) from (100 x ((Player number of (Owner of (Damage source))) - 1)) to ((100 x ((Player number of (Owner of (Damage source))) - 1)) + DamagedUnitGroup_int_Player[(Player number of (Owner of (Damage source)))]), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Triggering unit) Equal to DamagedUnitGroupUnit[(Integer A)]
Collapse Then - Actions
Set DamagedUnitGroup_DMG[(Integer A)] = (DamagedUnitGroup_DMG[(Integer A)] + (Damage taken))
Countdown Timer - Start DamagedUnitGroup_Timer[(Integer A)] as a One-shot timer that will expire in 0.35 seconds
Else - Actions

And this trigger updates the damage FTs and gets them to give a finishing display if the unit is not damaged again before the short timer expires:

Trigger:
Monitor Floating Texts2
Collapse Events
Time - Every 0.05 seconds of game time
Conditions
Collapse Actions
Collapse For each (Integer B) from 2 to 2, do (Actions)
Collapse Loop - Actions
Set DamagedUnitGroupMaxSize_Int = DamagedUnitGroup_int_Player[b]
Collapse For each (Integer A) from ((100 x (B - 1)) + 1) to ((100 x (B - 1)) + DamagedUnitGroupMaxSize_Int), do (Actions)
Collapse Loop - Actions
Set DamagedUnitGroup_Slot_CUR = (((100 x (B - 1)) + DamagedUnitGroupMaxSize_Int) - ((A - 1) - (100 x (B - 1))))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
DamagedUnitGroupUnit[DamagedUnitGroup_Slot_CUR] Equal to No unit
Then - Actions
Collapse Else - Actions
Game - Display to (All players) the text: (Slot Number = + (String(DamagedUnitGroup_Slot_CUR)))
Game - Display to (All players) the text: (Current MaxCount For Player + ((String(B)) + ( = + (String(DamagedUnitGroup_int_Player[b])))))
Floating Text - Change the position of DamagedUnitGroup_FT[DamagedUnitGroup_Slot_CUR] to DamagedUnitGroupUnit[DamagedUnitGroup_Slot_CUR] with Z offset -50.00
Floating Text - Change text of DamagedUnitGroup_FT[DamagedUnitGroup_Slot_CUR] to ((String((Integer(DamagedUnitGroup_DMG[DamagedUnitGroup_Slot_CUR])))) + !) using font size (9.00 + (3.00 x (DamagedUnitGroup_DMG[DamagedUnitGroup_Slot_CUR] / 400.00)))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Remaining time for DamagedUnitGroup_Timer[DamagedUnitGroup_Slot_CUR]) Less than or equal to 0.00
Collapse Then - Actions
Floating Text - Destroy DamagedUnitGroup_FT[DamagedUnitGroup_Slot_CUR]
Floating Text - Create floating text that reads <Empty String> above DamagedUnitGroupUnit[DamagedUnitGroup_Slot_CUR] with Z offset -50.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Floating Text - Change text of (Last created floating text) to ((String((Integer(DamagedUnitGroup_DMG[DamagedUnitGroup_Slot_CUR])))) + !) using font size (9.00 + (3.00 x (DamagedUnitGroup_DMG[DamagedUnitGroup_Slot_CUR] / 400.00)))
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to (3.00 x (DamagedUnitGroup_DMG[DamagedUnitGroup_Slot_CUR] / 300.00)) seconds
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 1 (Red))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (100.00%, 0.00%, 0.00%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 2 (Blue))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (0.00%, 0.00%, 100.00%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 3 (Teal))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (10.98%, 90.20%, 72.55%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 4 (Purple))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (32.95%, 0.00%, 50.59%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 5 (Yellow))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (100.00%, 100.00%, 0.00%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 6 (Orange))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (100.00%, 54.12%, 5.49%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 7 (Green))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (12.55%, 75.29%, 0.00%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 8 (Pink))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (89.80%, 35.69%, 69.02%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 9 (Gray))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (58.82%, 58.82%, 58.82%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 10 (Light Blue))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (49.41%, 74.90%, 94.51%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 11 (Dark Green))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (6.27%, 38.43%, 27.45%) with 0.00% transparency
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
B Equal to (Player number of Player 12 (Brown))
Collapse Then - Actions
Floating Text - Change the color of (Last created floating text) to (30.59%, 16.47%, 0.00%) with 0.00% transparency
Else - Actions
Floating Text - Change the fading age of (Last created floating text) to ((3.00 x (DamagedUnitGroup_DMG[DamagedUnitGroup_Slot_CUR] / 300.00)) x 0.80) seconds
Floating Text - Set the velocity of (Last created floating text) to 50.00 towards (Random real number between 55.00 and 125.00) degrees
Unit Group - Remove DamagedUnitGroupUnit[DamagedUnitGroup_Slot_CUR] from DamagedUnitGroup_Player[b]
-------- Replacing last slot into empty slot --------
Set DamagedUnitGroupUnit[DamagedUnitGroup_Slot_CUR] = DamagedUnitGroupUnit[((100 x (B - 1)) + DamagedUnitGroup_int_Player[b])]
Set DamagedUnitGroup_DMG[DamagedUnitGroup_Slot_CUR] = DamagedUnitGroup_DMG[((100 x (B - 1)) + DamagedUnitGroup_int_Player[b])]
Set DamagedUnitGroup_FT[DamagedUnitGroup_Slot_CUR] = DamagedUnitGroup_FT[((100 x (B - 1)) + DamagedUnitGroup_int_Player[b])]
Game - Display to (All players) the text: (Slot Number = + (String(DamagedUnitGroup_Slot_CUR)))
Countdown Timer - Start DamagedUnitGroup_Timer[DamagedUnitGroup_Slot_CUR] as a One-shot timer that will expire in (Remaining time for DamagedUnitGroup_Timer[((100 x (B - 1)) + DamagedUnitGroup_int_Player[b])]) seconds
-------- Getting Rid of the last slot stats --------
Set DamagedUnitGroupUnit[((100 x (B - 1)) + DamagedUnitGroup_int_Player[b])] = No unit
Floating Text - Destroy DamagedUnitGroup_FT[((100 x (B - 1)) + DamagedUnitGroup_int_Player[b])]
Game - Display to (All players) the text: (Slot Number = + (String(DamagedUnitGroup_Slot_CUR)))
Set DamagedUnitGroup_int_Player[b] = (DamagedUnitGroup_int_Player[b] - 1)
Game - Display to (All players) the text: (Current MaxCount For Player + ((String(B)) + ( = + (String(DamagedUnitGroup_int_Player[b])))))
Else - Actions

Most of the middle of last second trigger you can ignore, but I need you to pay attention to the last 6 lines, not including the ingame message display (that was used for testing) and from the begining to the display of the first in game message. Those last 6 actions are supposed to be what would allow me to swap data from the current slot to the position of the maximum slot and bring in the dtata from the last slot of that set of data to the position of the current slot. In essence replace the expired FT with the last one, delete the data in the last slot, and reduce the max slot number by 1 (since the previous last slot was just emptied, or so I think it is). I also start at the largest number and move down so that I don't replace an expired slot with another expired slot (though theoretically that would fix itself in the next run of the trigger).

Now for the most part, the system, seems to run fine, but every so often, a floating text will be left hanging there so somewhere there's a leak of information, I just cannot seem to find it.

Now I'm currently trying to do this using .GUI to see if it can be done and if the method works. Later I'll try converting it to JASS but I want this to work properly before i do that.

So this is where you guys come in. If you see something that does not look right, or that I'm doing something wrong with my algorithms, please post it, because I've looked over this code countless times and I'm not getting anywhere. Every attempt I make that I think will fix the error, does nothing.
Drain Pipe is offline   Reply With Quote
Old 04-24-2009, 02:52 PM   #9
PurplePoot
User


Official Map Reviewer
 
Join Date: Jan 2006
Posts: 363

PurplePoot will become famous soon enough (56)PurplePoot will become famous soon enough (56)

Default

About cliffs (and hills), you should be using GetLocationZ and working out the average terrain normal from a small sample area around the target point. Check out any physics systems if you're interested.
PurplePoot is offline   Reply With Quote
Old 04-26-2009, 12:17 AM   #10
Drain Pipe
User
 
Join Date: May 2006
Posts: 129

Drain Pipe has little to show at this moment (3)

Default

can you give me a link to one?

also, the most prominent issue right now is my floating text code. ANYONE have ANY idea how it can leak?
Drain Pipe is offline   Reply With Quote
Old 04-26-2009, 02:36 AM   #11
PurplePoot
User


Official Map Reviewer
 
Join Date: Jan 2006
Posts: 363

PurplePoot will become famous soon enough (56)PurplePoot will become famous soon enough (56)

Default

http://www.wc3c.net/showthread.php?t=98089

No idea about the floating text code, but I can't say I put too much effort into reading it - I can't stand GUI.

Why are you using a for loop over a single value? (For each integer b from 2 to 2)
PurplePoot is offline   Reply With Quote
Old 04-26-2009, 05:59 AM   #12
Drain Pipe
User
 
Join Date: May 2006
Posts: 129

Drain Pipe has little to show at this moment (3)

Default

Basically the whole idea is to create self-updating floating texts that will constantly update the damage they display for a unit, as long as it is within a very short time frame (currently damage instances are set to update the FT if they are within 0.35 seconds between each instance). The main reason for this is because I had some abilities that fired multiple small projectiles, or dealt small amounts of damage rapidly, so i figured this system would give the player a much better estimate of how much damage their ability was doing for a single unit. Right now it's not quite accurate for what I wish to make it out to be (once I actually finish my damage detection system) but it displays everything properly, for the most part.

Anyways, dl the map and try it out for about 2-3 minutes and you can see how the systems display looks.... and you will also notice the weird bug which I have been unable to locate in which floating texts are left undestroyed and all displayed across the playing field.

that's not normally how it works, I just set it up to go through that one value (normally it's 1-12, so 1 cycle through for every player slot. As far as reading the code, there's only about 8 lines that you need to focus on, 6 of those are the last 6 lines of the code, not counting the game displayed messages.

what the system does is it tracks up to 100 units (as it is right now) of which it will display the damage they take, per player but it stores all units, damage, floating texts, etc in one giant array of 1200 slots. I split up that array and only cycle through slots that actually have information, ie
Drain Pipe is offline   Reply With Quote
Old 04-26-2009, 05:21 PM   #13
Dark.Revenant
User
 
Dark.Revenant's Avatar
 
Join Date: Feb 2007
Posts: 348

Submissions (1)

Dark.Revenant will become famous soon enough (44)Dark.Revenant will become famous soon enough (44)

Default

You're going to see floating text bugs, most likely, if you don't make the colors 100/100/100/100 and use regular |cAARRGGBBtext|r codes instead.

Here's a simplified version of my projectile system:
I took out the bouncing code because it's flawed.

Trigger:
Set Loop = -1
Set TempLoopA = SsbHighestIndex
Custom script: loop
Set Loop = (Loop + 1)
Custom script: exitwhen udg_Loop > udg_TempLoopA
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbObject[Loop] Not equal to No unit
(SsbObject[Loop] is alive) Equal to True
Collapse Then - Actions
Set TempUnit[1] = SsbObject[Loop]
Set TempPoint[1] = (Position of TempUnit[1])
Set TempPoint[2] = (TempPoint[1] offset by (SsbSpeed[Loop] / SsbPeriodMod) towards SsbDirection[Loop] degrees)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbReusable[Loop] Equal to False
Collapse Then - Actions
Set SsbLifespan[Loop] = (SsbLifespan[Loop] - (1.00 / SsbPeriodMod))
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbMove[Loop] Equal to True
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbSpeed[Loop] Less than SsbSpeedMax[Loop]
SsbAcceleration[Loop] Greater than 0.00
Collapse Then - Actions
Set SsbSpeed[Loop] = (SsbSpeed[Loop] + (SsbAcceleration[Loop] / SsbPeriodMod))
Set SsbZSpeed[Loop] = (SsbZSpeed[Loop] + (((SsbZSpeed[Loop] / SsbSpeed[Loop]) x SsbAcceleration[Loop]) / SsbPeriodMod))
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbAcceleration[Loop] Less than 0.00
SsbSpeed[Loop] Greater than 0.00
Collapse Then - Actions
Set SsbSpeed[Loop] = (SsbSpeed[Loop] + (SsbAcceleration[Loop] / SsbPeriodMod))
Set SsbZSpeed[Loop] = (SsbZSpeed[Loop] + (((SsbZSpeed[Loop] / SsbSpeed[Loop]) x SsbAcceleration[Loop]) / SsbPeriodMod))
Else - Actions
Set SsbZSpeed[Loop] = (SsbZSpeed[Loop] - (SsbGravity[Loop] / SsbPeriodMod))
Custom script: set udg_TempReal[1] = (GetLocationZ(udg_TempPoint[1]))
Custom script: set udg_TempReal[2] = (GetLocationZ(udg_TempPoint[2]))
Set TempReal[3] = ((TempReal[1] - TempReal[2]) + (SsbZSpeed[Loop] / SsbPeriodMod))
Set SsbHeight[Loop] = (SsbHeight[Loop] + TempReal[3])
Animation - Change TempUnit[1] flying height to SsbHeight[Loop] at 50000.00
Custom script: set udg_TempX[1] = (GetLocationX(udg_TempPoint[2]))
Custom script: set udg_TempY[1] = (GetLocationY(udg_TempPoint[2]))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbDistance[Loop] Less than SsbRange[Loop]
(Rect[1] contains TempPoint[2]) Equal to True
SsbLifespan[Loop] Greater than 0.00
Collapse Then - Actions
Custom script: call SetUnitX(udg_TempUnit[1],udg_TempX[1])
Custom script: call SetUnitY(udg_TempUnit[1],udg_TempY[1])
Set SsbDistance[Loop] = (SsbDistance[Loop] + ((Square root(((Power(SsbSpeed[Loop], 2.00)) + (Power(SsbZSpeed[Loop], 2.00))))) / SsbPeriodMod))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbHeight[Loop] Less than or equal to 0.00
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbReusable[Loop] Equal to True
Collapse Then - Actions
Unit - Turn collision for TempUnit[1] On
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Terrain type at TempPoint[2]) Equal to Outland - Abyss Cliff
Collapse Then - Actions
Set DeathRowIndex = (DeathRowIndex + 1)
Set DeathRow[DeathRowIndex] = TempUnit[1]
Set DeathRowTarget[DeathRowIndex] = No unit
Collapse Else - Actions
Set SsbObject[Loop] = No unit
Collapse Else - Actions
Set DeathRowIndex = (DeathRowIndex + 1)
Set DeathRow[DeathRowIndex] = TempUnit[1]
Set DeathRowTarget[DeathRowIndex] = No unit
Else - Actions
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbReusable[Loop] Equal to True
Collapse Then - Actions
Set SsbMove[Loop] = False
Unit - Turn collision for TempUnit[1] On
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Rect[1] contains TempPoint[2]) Equal to False
Collapse Then - Actions
Animation - Change TempUnit[1] flying height to 0.01 at 5000.00
Set DeathRowIndex = (DeathRowIndex + 1)
Set DeathRow[DeathRowIndex] = TempUnit[1]
Set DeathRowTarget[DeathRowIndex] = No unit
Else - Actions
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbLifespan[Loop] Greater than 0.00
Collapse Then - Actions
Unit - Change ownership of TempUnit[1] to Neutral Victim and Retain color
Else - Actions
Set DeathRowIndex = (DeathRowIndex + 1)
Set DeathRow[DeathRowIndex] = TempUnit[1]
Set DeathRowTarget[DeathRowIndex] = No unit
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
SsbLifespan[Loop] Greater than 0.00
Then - Actions
Collapse Else - Actions
Unit - Change ownership of TempUnit[1] to Neutral Victim and Retain color
Set DeathRowIndex = (DeathRowIndex + 1)
Set DeathRow[DeathRowIndex] = TempUnit[1]
Set DeathRowTarget[DeathRowIndex] = No unit
Custom script: call RemoveLocation(udg_TempPoint[2])
Custom script: call RemoveLocation(udg_TempPoint[1])
Custom script: set udg_TempUnit[1] = null
Else - Actions
Custom script: endloop
__________________

Last edited by Dark.Revenant : 04-26-2009 at 05:28 PM.
Dark.Revenant is offline   Reply With Quote
Old 04-26-2009, 05:50 PM   #14
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,025

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

For bouncing off cliffs, the easiest way is to use the vector library to get the terrain normal vector at the collision point, flatten it's z value and then use it to modify the projectile's velocity vector (by subtracting from it it's projection onto the normal multiplied by two).
__________________
Anitarf is offline   Reply With Quote
Old 04-26-2009, 06:29 PM   #15
Drain Pipe
User
 
Join Date: May 2006
Posts: 129

Drain Pipe has little to show at this moment (3)

Default

@Antiarf: vector library? link or is it a function or what? I might have to modify my knockback system to work that in.
@Dark: Hmmm, the problem isn't associated with the colors.

BTW I've taken my system out of the big map and just put in by itself. You can all look and see for how it works a lot quicker now... each unit actually has 2 floating texts attached to them: one follows them around and updates itself and follows the unit, and then when the timer expires, that first one is destroyed and a second short duration floating text is created (this one isn't defined or attached to any variable so it shouldn't bug out).

[edit] found the problem although I still don't understand it. Apparently if I can't transfer information between floating texts by just setting one as another...I have to manually create and update a new floating text, or something like that.

Hopefully others might find this useful. Now I know it's just .GUI but it's the most efficient way I've been told of for keeping track of the data and updating everything so I hope yall enjoy.
Attached Files
File Type: w3x Drain Pipe's custom floating texts.w3x (70.5 KB, 0 views)

Last edited by Drain Pipe : 04-28-2009 at 05:23 AM.
Drain Pipe is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 04:21 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services