Saturday, April 21, 2012

Need help extremely badly! (mathy point trigger)

Hey all. So i got a map where each player controls 1 lightning effect using the arrow keys. and there is a problem, well, two actually. First, I have 6 points in a group variable called "Point[1-6]. These Points are set in a hexagon (like this - : : - , the "-" resembling 1 point and ":" resembling 2 points)

The lightning effects are supposed to work like fences to stop units from exit the hexagon. As mentioned youre supposed to move a lightning using Up, DOwn, Right and Left arrow keys but my first problem comes when im gonna trigger the movement of said lightnings. I just cant think of a good way to trigger it without using a LOT of if/then/elses. Ive tried assisgning 2 point variable to each lightning and an Integer but it's all just a mess. My second Problem is "Point[1]" and "Point[6]". This problem basically just adds to the first problem, cause if i am to move a lightning which goes from Point[1] and [2] to Point [6] and [1], i cant just use an "Integer - 1", which I imagine would be the smoothest way to move Points around, i just cant think of a smart way to utilize it.

Picture to explain my problems:

http://data.fuskbugg.se/skalman01/dshsdh.bmp

So i need a clever code to move these lightnings and im simply just too unexperianced to do it. Anyways Good luck, I need it :D

edit; another problem is that you cant compare points or lightning effects, so that also adds to difficulty.|||When does this effect begin, and how is it activated?

Does it only happen after an ability has been cast?

Is it activated and deactivated in such a manner that it will be occurring in different places around the map, such as wherever unit happens to be?|||Quote:






View Post

When does this effect begin, and how is it activated?

Does it only happen after an ability has been cast?

Is it activated and deactivated in such a manner that it will be occurring in different places around the map, such as wherever unit happens to be?




im planning on referencing the lightning in one way or another at Map Initialzation. It's activated when a player presses Up/Down/Right/Left, each player (6 total) have control over 1 lightning each, and they lightnings can't move to any other places than "Point[1-6]", which are static. (see picture). The trigger is always running (detecting arrow key events (its never deactivated)). I think that should cover all your questions.|||What if the lightning is currently at 5,6 and the player presses up? Does it jump to 2,3, or is it supposed to work its way around step by step?

What if the lightning is at 1,2 and the player presses left? Does it stay at 1,2?|||Quote:




What if the lightning is currently at 5,6 and the player presses up? Does it jump to 2,3, or is it supposed to work its way around step by step?




hmm, havnt thought of that. I guess it could go to either 5,4 or 6,1. Or not move at all. But if anything, to 5,4, for convenience ;p


Quote:




What if the lightning is at 1,2 and the player presses left? Does it stay at 1,2?




yes|||dont leave me hangin'!

;p|||Since the lightning can only move in two directions - either clockwise or counter-clockwise (or at least that's what it seems like from what you've said), the logical thing to do would be to just make it controlled only by the right and left arrow keys, with right arrow meaning clockwise and left arrow meaning counterclockwise. It's simpler for the player and a lot easier to code.

For example, if the lightning is spanning from 1-2, you can just have 1 and 2 replaced by variables high and low. Point[high] is 2, initially in this case. Then if the players pushes right arrow you set high = high +1 and low = low +1, if they press left arrow you set high = high -1 and low = low -1. Then you only need to worry about when high/low = 0, then set it to 6 and when high/low = 7, set it to 1.|||Quote:






View Post

Since the lightning can only move in two directions - either clockwise or counter-clockwise (or at least that's what it seems like from what you've said), the logical thing to do would be to just make it controlled only by the right and left arrow keys, with right arrow meaning clockwise and left arrow meaning counterclockwise. It's simpler for the player and a lot easier to code.

For example, if the lightning is spanning from 1-2, you can just have 1 and 2 replaced by variables high and low. Point[high] is 2, initially in this case. Then if the players pushes right arrow you set high = high +1 and low = low +1, if they press left arrow you set high = high -1 and low = low -1. Then you only need to worry about when high/low = 0, then set it to 6 and when high/low = 7, set it to 1.




thanks alot! it's so nice with an outside perspective!|||just updating to let you know that the map is nearing completion and it will be my first map to be released to the public :) you guys are of course on the credists list!

Thanks.

edit: done! it's a very small map, so as soon as i got those movement triggers done, it was basically finished :P

http://war3.incgamers.com/?p=mymods <-- download|||Quote:






View Post

dont leave me hangin'!




That's odd. I *did* post a reply. I guess I closed the preview post before I actually posted it.

Anyway, CHUNK said exactly what I tried to say. The mechanics of your perimeter would basically function like that old arcade game Tempest.

Edit: Actually, the link you posted only works for *you*.|||It will work for everyone in a second here. :P|||Quote:




Edit: Actually, the link you posted only works for *you*.




oh, well now it says "Approved" in nice green letters :p|||Wow, version 0.1 had quite a few faulty codes, im gonna fix them right now

fixed it!

I'm hosting it on the european battle.net once in a while and on there my nickname is "MEWTWO_o". Really satisfied atm. Upcoming changes will be adding a point system, a rematch system, a system for changing Runner speed based on the number of runners on the map, and a little more eyecandy to make the overall experiance more pleasant, and ofc, an option to set the number of lives!

wc3firetruck@hotmail.com for feedback!|||Update your map by going through "my maps" and editing them - don't just submit your update as a new map.|||Quote:






View Post

Update your map by going through "my maps" and editing them - don't just submit your update as a new map.




ah, k. sry. Any good advices for map protecting?|||I sometimes use ext.protect but I think I've found Vex's Optimizer actually does slightly better on compression for most things - so I use that now (since I am mainly worried about reducing map size).|||yea, im using this one http://www.wc3c.net/showthread.php?t=79326 atm, i guess that vex's. Im having difficulties understanding what to do though. Any tutorials anywhere?

No comments:

Post a Comment