I need help on Board Game Scripting.
|
|
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
|
01-14-2007 20:56
I'm making a board game where you take turns moving and attacking. Each piece has multiple attacks and skills. Sence i'm making every thing based on my own ideas I dont have to warry about copyright crap.
Sence im still a noob at scripting and building and well, every thing in secondlife. Im going to need some help on stuff
My current problem is I cant get my test piece to move forward!
I want to post my script so some one can tell me where im going wrong, but I dont know how to open then mini-window things I see every one posting there scripts in.
I currently have a dialog menu pop up displaying 3 options, moveup, moveleft, and moveright. I have it set to listen for the moveup. To make sure its activating I have it tell me its Moving forward. Problem is the llMovetoTarget wont move it! I also need to either set up a check to make sure the piece does not moves off the board.
Safe to say all this is well over my head.
Edit:Update, I figured out I can use the llsetpos to move it. So I use a vector varaible named pos set it equal to its current pos and added 0.5,0,0 to it to make it move the direction I wanted it to. I cant think of any way to limit its movment from exiting the board. Maybe some way of keeping track of where it is on the board?
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
01-14-2007 23:46
llMoveToTarget only works for physical objects, as you've probably figured out by now. And yes, you'll need to keep track of where you are on the board. Instead of using <0.5, 0, 0>, maybe do something like keep track of the board size in "board units", i.e., how many squares you have. So 2 variables, x and y, which keep track of where you are. Let's say it's a chess board, so 8 possible positions, which would be 0 through 7. Then you'll have something like:
integer currentX; // Range is 0 .. 7 for both integer currentY;
setNewPos(integer x, integer y) { llSetPos(<x, y, 0> * someBoardSpecificMultiplier); // 0.5 in your case, or some other number depending on board size }
...
moveUp( { if (currentX < 7) { currentX++; setNewPos(currentX, currentY); } else { // Complain } }
Hope that made some sense  Oh, and use PHP tags to post code. There's a "Beginning scripters start here" sticky thread at the top of this forum, I'd recommend reading that.
|
|
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
|
01-15-2007 01:06
I came up with using intengers to mark the location also. Tho your set up is much neater then mine. But it works all the same.
That sticky would take weeks to read! I'll wait till tomarrow to post my script sence I just logged off secondlife to head for bed.
So now I got it able to move up, down , left and right till it hits the boarder of the board.
Next I'll work on collision with other pieces, Attacking other pieces and ill probobly need to beable to open a dialog after picking a buttion from a dialog. Currently the dialog opens on touch, I'm farly sure its the "agent = llDetectedkey(0)" that tells it who the dialog is shown to. Hmm that gets me thinking... Ill need to find a way... to allow only players to move the pieces... maybe a chair? make the agent = llDetected avatar in chair (0)?...
oh well, ill play with it tomarrow and edit all this part. =þ
Edit: Whats that CurrentX++; mean? Sence you dont have CurrentX = (CurrentX + 1); im guessing it means that some how?
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-15-2007 01:30
From: XelNaga Gamba That sticky would take weeks to read! Although it may take a while to read its worth the effort. It explains a lot of things and gives pointers to other places to look. Reading through the wikki is also worth while, not all of it may be, but the basic structure of the language. From: XelNaga Gamba Next I'll work on collision with other pieces, Attacking other pieces and ill probobly need to beable to open a dialog after picking a buttion from a dialog.
Currently the dialog opens on touch, I'm farly sure its the "agent = llDetectedkey(0)" that tells it who the dialog is shown to. Hmm that gets me thinking... Ill need to find a way... to allow only players to move the pieces... maybe a chair? make the agent = llDetected avatar in chair (0)?... The llDialog Command takes a key/id as its first parameter. This is who the dialog will be displayed to. Your code is probably doing this agent = llDetectedkey(0); llDialog(agent,"Dialog Title",Buttons,channel);
You could use chairs, or just have the players touch the board, both would work. From: XelNaga Gamba Edit: Whats that CurrentX++; mean? Sence you dont have CurrentX = (CurrentX + 1); im guessing it means that some how? ++ and -- are short hand for X = X + 1 or X = X - 1 you can use then pre or post fix i.e. ++X or X++
|
|
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
|
01-16-2007 02:03
update! Sence I know you all are dieing to help me! I worked all night getting the pieces to detect each other. well to get the white test piece to detect the red test piece.
wiki helped alot!! lots of helpful bits of info there.
So now my pieces can move to the limits of the board, and not able to enter a squar that another piece is currently in. I used the Sensor to detect if there was a "SCRIPTED | PASSIVE" object in frount of it (wiki helped here) and sence the sensor only shoots out forward i had to rotate the piece. This is not a bad thing because now it looks better. tho I dont see why there is 2 rotation styles, one that uses vector and one that uses rotation? Lucky wiki was there to help me get around this little problem with llEuler2Rot.
(Side note: you only need .x .y and .z, you can get every posable angle that way, what do you need a .s for!? i sware people just try to make things more comlpicated! /endrant)
So tomarrow ill start on the hp, attack, skills and the multiple dialogmenus. Why is it called dialog any way? I noticed warcract3 also called them dialog menus and both work the same way... The only dialog i know in the real world is dialog in a play, which are the lines the characters say... Least i think it is...
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-16-2007 05:30
From: XelNaga Gamba update! Sence I know you all are dieing to help me! I worked all night getting the pieces to detect each other. well to get the white test piece to detect the red test piece.
wiki helped alot!! lots of helpful bits of info there.
So now my pieces can move to the limits of the board, and not able to enter a squar that another piece is currently in. I used the Sensor to detect if there was a "SCRIPTED | PASSIVE" object in frount of it (wiki helped here) and sence the sensor only shoots out forward i had to rotate the piece. This is not a bad thing because now it looks better. tho I dont see why there is 2 rotation styles, one that uses vector and one that uses rotation? Lucky wiki was there to help me get around this little problem with llEuler2Rot.
(Side note: you only need .x .y and .z, you can get every posable angle that way, what do you need a .s for!? i sware people just try to make things more comlpicated! /endrant)
So tomarrow ill start on the hp, attack, skills and the multiple dialogmenus. Why is it called dialog any way? I noticed warcract3 also called them dialog menus and both work the same way... The only dialog i know in the real world is dialog in a play, which are the lines the characters say... Least i think it is... Just a small thought here XelNaga, You can make a sensor omnidirectional by using +/- PI as the arc parameter, i.e. llSensor("", "", ACTIVE, 25, PI);BUT I'm not 100% sure you need to do it that way. From your earlier posts I think your board is of a predefined fixed size. I'm assuming something like a chessboard or even a good old hex grid. It may be better for the board to remember where everything is and make the pieces as dumb as possible. Only a thought mind you. [English] The orginal meaning of the word dialogue was 'a conversation between 2 or more parties.' The term dialog is derived from the fact that you interact with and thus have a 'conversation' with the control. English from Newgy..... ROFL[/English]
|
|
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
|
01-16-2007 14:38
Iv been thinking on how to get one unit to attack another. Sence I want them to have there own HP and Damage. I'm going to have to send a variable over to other units. So it would be best if the board it self had all that info, as you said.
The reason I did not have the board it self hold the info was because I dont know how to exchange variables between objects. I tryed to learn how before but its was a head ache.
Looks like i have no choice now but to figure out how and change my whole set-up.
just so i know im reading the right area in wiki. Is XML-RPC what i should be reading to learn how to send variables over to other object's scripts? Because iv read it, and it does not seem to be that im looking for. in fact, i cant tell what it does at all...
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
01-16-2007 15:30
Your objects can also talk to each other. llWhisper, lListen, and the listen() handler. As long as they're not talking on channel 0, the avs there won't hear their 'conversation'. XML-RPC is good for long range communications, IMO overkill for your application.
I think the Wiki has a whole page / section on communications.
|
|
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
|
01-16-2007 22:48
Interesting, that makes things much simpler.
So currently I have 2 test object set up. One opens a dialog in channel 39 when i touch it. Giving me 4 move options, When I click MoveUp button dialog closes. I have the second object to listen for any thing on channel 39. then it runs a 'if' to check if the message is Moveup or MoveDown. Then the object moves either up 1.00 from its position or -1.0 from its position. In other words it works. One thing i tested was if I said /39 Move Up, it moved it up just as if the dialogmenu said it. So to prevent players from giving direct commands Ill either have hide the channel, and prevent people from viewing the script.
Sence that was all i was able to test before I had to go (and this comp does not have access to Secondlife) I was unable to see if I can pass on more than just the Dialog Buttons name.
Also, will I need to have each game piece's dialog on a different channel so the board does not get confused?
Ill probobly figure most of this out once i can get back on my computer. And run more tests.
What if i had the remote script listen for the MoveUp command from the dialog then have it say, in channel 39, more info such as piece number and junk, would the second object beable to pick them both up and beable to extract the info?
Another thought, What would happen if I made the Button name "Move Up A1". Would the words Move Up only appear? Sence all the piece really has to tell the board is which button was clicked and which piece is sending the info. The "A" tells what side the piece belongs to (A and B), and the number tells which piece it is. Would that work in telling the board which piece is sending the message?
I think when im done ill pick a 4 or 5 digit number to use for the channel. Just to lower the chance some one else is using the same channel.
I seemed to have raddled on there for a while...
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
01-16-2007 23:28
> One thing i tested was if I said /39 Move Up, it moved it up just as if the dialogmenu said it. So to prevent players from giving direct commands Ill either have hide the channel, and prevent people from viewing the script. Use a negative channel. Avs can't talk on negative channels. Read the Wiki page for listeners. It'll tell you all this  > Also, will I need to have each game piece's dialog on a different channel so the board does not get confused? You could, though that wil probably be a management headache. > What if i had the remote script listen for the MoveUp command from the dialog then have it say, in channel 39, more info such as piece number and junk, would the second object beable to pick them both up and beable to extract the info? A much better idea. Look up the wiki for the string functions. You could have the command be something like "piece name ## movement ## other info", and then in the listening piece, you can break up the string into a list using the ## delimiter, and access the list elements to find the various pieces of information that were sent to you. > Another thought, What would happen if I made the Button name "Move Up A1". Would the words Move Up only appear? Hard to say, the buttons tend to cut off text pretty quickly. Try it and see. You're also limited to 12 buttons on a dialog menu, so if you have more than 12 pieces... And to me, the game would be more intuitive if I could click on the piece I wanted to move, instead of having to click somewhere else and remember that I wanted to move piece A1. Just a thought  > I think when im done ill pick a 4 or 5 digit number to use for the channel. Just to lower the chance some one else is using the same channel. Good idea. Your range of possible channel numbers is in the billions. Again, read the wiki page for listeners. One more suggestion... while you're tinkering with the functions and learning how they work (which is a great way to learn), I'd suggest sitting down with pencil and paper and doing some design/flowcharts. Write down each step, starting with the user input, all the way through to the actions that need to take place. You're trying a fairly complex project, and sometimes stepping back and looking at the whole design can help you pick some ways of doing things that will streamline the overall process. Otherwise you could pick one way to do one piece, and find that your choice makes another piece a lot harder.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-17-2007 00:54
I think your best bet is to have the pieces rezzed by the board on game start. That way the board can select a random channel for each game and pass it to each piece as its on rez parameter. I'd suggest you only have one channel for simplicity (as Ziggy said) and use piece ID's to seperate out who the commands are for (Ziggy again  ). You can still click on the pieces to select them and have them then display their menu directly OR send a message back to the board telling it that they have been clicked and who by and get the board to display the correct menu. Both methods have advantages and disadvantages. At their simplist the pieces could just respond to move and animation commands before dieing suitiable destructive deaths with all the real intelligence in the board. Again as Ziggy said, its a VERY good idea to 'sketch' out you ideas before you start. It doesnt matter how you do it, simple notes, flow charts, data diagrams, flip charts, cartoons (really I know a guy who designs code that way!), they are all just aids to help visualise how the code will work and what data you will require. Personally I tend to design top down, start by working out the functional aspects I require (i.e. UserDialog, Move, Attack, Defend etc.) and noting them down as empty functions along with their data requirements. Then I slowly flesh them out as I work out the details of the actual code.
|
|
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
|
01-17-2007 02:55
I like that thing about having the board pick a random channel at game start then passing it on to the pieces.
Right now i have the board spawn 2 pieces, 1 for each side, when i click the board. and it deletes the old pieces before that.(disabled atm sence I normaly dont want them deleted)
Seems like some of you are getting confused with my set up so.. My vishion is that when its finished two players will set down, one will click the start button near the board or somthing. The game pieces will spawn from the board. from there the players will take turns moveing and attacking. When its your turn you can click on your piece, bringing up a dialogmenu offering commands uniqe to that piece. The Dialog will also display its current hp and damage amount. If you select an enemy piece a dialog will appear displaying its hp and damage but with only the ignore buttion. Some pieces will have more movability then others and some will have more attack range then others. and from there its combat as usual.
Right now im having some trouble thinking of a way to check if the area a piece is wanting to enter is ocupied. I have if(B1_posx != A1_posx + 1 && B1_posy != A1_posy) Where A1 Is trying to check if B1 is either in the locaton or not. I dont think the && (i think means AND) is working. And when I get more than just 1 piece this will not do at all. I need some way of making a grid that places a check in the boxes!
That pencil and paper thing sounds like I good idea, if I knew more about what I was doing. Right now I dont know if my code will work or not, so I have to put it in and test it. Tho it cant hurt to take notes. =þ
Edit: I know how I can make a grid. But is it posable to have integer arrays on here? My plan is to have an integer X1 array 3, X2 array 3, X3 array 3, Y1 array 3, Y2 array 3, Y3 array 3. now i have an integer for each row and collum. Put them to gether and what do you get? X3[] [] [] X2[] [] [] X1[] [] [] ¯|Y1Y2Y3 A grid!
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-17-2007 03:48
From: XelNaga Gamba I like that thing about having the board pick a random channel at game start then passing it on to the pieces.
Right now i have the board spawn 2 pieces, 1 for each side, when i click the board. and it deletes the old pieces before that.(disabled atm sence I normaly dont want them deleted)
Seems like some of you are getting confused with my set up so.. My vishion is that when its finished two players will set down, one will click the start button near the board or somthing. The game pieces will spawn from the board. from there the players will take turns moveing and attacking. When its your turn you can click on your piece, bringing up a dialogmenu offering commands uniqe to that piece. The Dialog will also display its current hp and damage amount. If you select an enemy piece a dialog will appear displaying its hp and damage but with only the ignore buttion. Some pieces will have more movability then others and some will have more attack range then others. and from there its combat as usual.
Right now im having some trouble thinking of a way to check if the area a piece is wanting to enter is ocupied. I have if(B1_posx != A1_posx + 1 && B1_posy != A1_posy) Where A1 Is trying to check if B1 is either in the locaton or not. I dont think the && (i think means AND) is working. And when I get more than just 1 piece this will not do at all. I need some way of making a grid that places a check in the boxes!
That pencil and paper thing sounds like I good idea, if I knew more about what I was doing. Right now I dont know if my code will work or not, so I have to put it in and test it. Tho it cant hurt to take notes. =þ
Edit: I know how I can make a grid. But is it posable to have integer arrays on here? My plan is to have an integer X1 array 3, X2 array 3, X3 array 3, Y1 array 3, Y2 array 3, Y3 array 3. now i have an integer for each row and collum. Put them to gether and what do you get? X3[] [] [] X2[] [] [] X1[] [] [] ¯|Y1Y2Y3 A grid! Try if( (B1_posx != (A1_posx + 1) ) && (B1_posy != A1_posy) ) LSL doesnt support arrays, the nearest you get are lists. Multidimensional Arrays are fakeable using multiple lists or strides. But you could do the same thing using a string and using llGetSubString to index. So for a 3 x 3 grid each string would be 3 characters wide giving a string 9 characters long. Or you could place strings into a list. Then each of your pieces is represented by a specific character.
|
|
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
|
01-17-2007 23:57
Unlike most of my posts im not posting this one right before goign to bed. Im just so happy I got it working I have to tell some one ^.^.
I settled on a string to be my grid. I made a test prim to figure it out on so there would not be other stuff in the way. I broke down and wrote it out on paper so i could keep it stright. I created a double character grid thats 3x3. Sence I was not going to have enough letters for every pieces to have its own letter I had to double the length of the string so each piece could have 2 characters, 1 letter and 1 number, the letter shows who it belongs to and what type of piece it is, the number shows wich piece of that type it is. like A1-9 will be player1's Footmen, B1-9 will be player 2s Footmen, ect.
I figured out why the "if( (B1_posx != (A1_posx + 1) ) && (B1_posy != A1_posy) )" was not working. it was because I had the B1_posx and A1_posx = ## under the touch_start event(?) so they where staying blank sence i never touched the board to test the new saved settings. Now that I do it works perfectly!
Im about to start setting the pieces Hp and Damage integers then have one attack and try to kill another.
Heres what im thinking: Once a piece is touched the Dialog comes up with MoveLeft, Move Down, MoveRight,(then on the second row above the first) Attack, Move up, Skills. When Attack is pressed a second dialog comes up saying, pick a target and what the attack range is, and a button labled "Cancel". Then the player is able to touch a target to attack it. Maybe have squares in range change to a brighter color or somthing also.
Any tips on how about making it posable for the player to touch the enemy piece to attack it? Sence you guys have been right on the ball so far.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-18-2007 01:49
From: XelNaga Gamba Unlike most of my posts im not posting this one right before goign to bed. Im just so happy I got it working I have to tell some one ^.^.
I settled on a string to be my grid. I made a test prim to figure it out on so there would not be other stuff in the way. I broke down and wrote it out on paper so i could keep it stright. I created a double character grid thats 3x3. Sence I was not going to have enough letters for every pieces to have its own letter I had to double the length of the string so each piece could have 2 characters, 1 letter and 1 number, the letter shows who it belongs to and what type of piece it is, the number shows wich piece of that type it is. like A1-9 will be player1's Footmen, B1-9 will be player 2s Footmen, ect.
I figured out why the "if( (B1_posx != (A1_posx + 1) ) && (B1_posy != A1_posy) )" was not working. it was because I had the B1_posx and A1_posx = ## under the touch_start event(?) so they where staying blank sence i never touched the board to test the new saved settings. Now that I do it works perfectly!
Im about to start setting the pieces Hp and Damage integers then have one attack and try to kill another.
Heres what im thinking: Once a piece is touched the Dialog comes up with MoveLeft, Move Down, MoveRight,(then on the second row above the first) Attack, Move up, Skills. When Attack is pressed a second dialog comes up saying, pick a target and what the attack range is, and a button labled "Cancel". Then the player is able to touch a target to attack it. Maybe have squares in range change to a brighter color or somthing also.
Any tips on how about making it posable for the player to touch the enemy piece to attack it? Sence you guys have been right on the ball so far. OK First question How many pieces do you expect on the board???? There are 255 characters the character set and even if you restrict yourself to just using alphanumeric you still have 26 uppercase, 26 lowercase and 10 numbers 62 pieces. But 2 characters per piece isnt bad. Changing the colour of the board will be simply a llSetlinkColor for each in range selection. Touching the enemy pieces is already built in, when touched the piece will send back its ID and the touchers key to the board in the same manner as the 'normal' touches. The board can then work out if this is an attack selection or not by comparing the current state, the touched item and the toucher's key. Or may be you could simply populate the attack dialog box with all the valid attack targets as buttons?
|
|
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
|
01-18-2007 05:52
I never thought of lowercase... I plan on making different games using this script but each game will have different board size and unit number. For this first game I think ill have 18 on each side(36) on a 9x9 board. Tho im not sure if ill reduce the unit amount or add to it. I'v not planed all thet jst yet. Sence I already have the 2character grid made and planed out im keeping it! =þ
hmm... I understand, I think I understand any way. If you was playing a board game in SL which would you ranther have? Click Attack then select the target(like Front Missions and FFT does) -Or- Click Attack then select from another menu which targets are avalible.(Like Most Turned Base RPGs)
I thought selecting the unit your self would be more active and more enjoyable then picking it from a menu. Im not sure if Ill have aoe skill that damages multiple units at once, but that one you will have to select a square. Tho i doubt ill have such a skill.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-18-2007 06:03
From: XelNaga Gamba I never thought of lowercase... I plan on making different games using this script but each game will have different board size and unit number. For this first game I think ill have 18 on each side(36) on a 9x9 board. Tho im not sure if ill reduce the unit amount or add to it. I'v not planed all thet jst yet. Sence I already have the 2character grid made and planed out im keeping it! =þ
hmm... I understand, I think I understand any way. If you was playing a board game in SL which would you ranther have? Click Attack then select the target(like Front Missions and FFT does) -Or- Click Attack then select from another menu which targets are avalible.(Like Most Turned Base RPGs)
I thought selecting the unit your self would be more active and more enjoyable then picking it from a menu. Im not sure if Ill have aoe skill that damages multiple units at once, but that one you will have to select a square. Tho i doubt ill have such a skill. he he, alwasy best to stick to what you know and what you know that works! the beauty is that using your 2 character system allows you to cater for both larger grids, different number of players (A,B,C,D......) and still have 50+ units per side. Afraid I've never heard of Front Misisons or FFT from an ergonomics point of view click in the rh corner then clicking in the main screen is BAD as it involves large mouse movements so a second dialog would be more correct. BUT that doesnt make it right. You could have all movement and attack requests JUST by clicking the board, only using dialogs when you need to.
|
|
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
|
01-18-2007 21:31
ok... I'll change it so when you click a piece a menu comes up giveing you stats of the piece and an Attack Button, the skills and a Cancel button. also the squares that you can move to will change to a brighter color then you either click to a location to move to or select an option. Once Attack or a skill is pressed the target range glows. Unlike the move range you have to touch a piece to activate the attack/skill.
There! that better. your so picky! =þ
I want attack to have its own button because units like the archer have a large attack range and a min range, so they need there range glowing with out interfearing of the movment glowing range. (i say glow because Im not sure if I wana change the square's color or use partectles to outline the squares or maybe give the squares a light effect.) I guess they could both coeinside, bah. Ill mess with the details later!
I'm having a hard time getting the square to change color. I know to use the llSetLinkColor and Iv relinked the board so the square numbers start from 12 and end at 4 (i know which square is which number because I use a llOwnerSay( "Its :" (string)lldetectedLinkNumber(0)); in the touch_start event(?) so it tells me which square is which number) 3,2 is part of the stand and 1 is the root (also the base of the stand). Now my problem is Im unable to figure out a way to conect my string grid with the prim grid.
I dont want to use a: if (A1_pos == 0) { llSetLinkColor(9,<#,#,#>,0); llSetLinkColor(11,<#,#,#>,0); } else if(A1_pos == 2) { llSetLinkColor(12,<#,#,#>,0); llSetLinkColor(10,<#,#,#>,0); llSetLinkColor(8,<#,#,#>,0); } else if(ect.)
for each piece at each square! that would be WAY too large for somthing so simple. So, i need somthing simpler... any ideas?
Edit: Front Mission (1,2,3,4 and I think a 5th is coming out with in a year) is a stratagy game set in war time. Instead of fighting in tanks or onfoot you use large mechs, you can equip them and change out parts to build your own mech. The combat it self is on a large squared grid that is on a board. You and the enemy take turns, When its your turn you can move your mech (movment range depends on your mechs stats and the enfiroment) then your able to attack, each weapon type has differnt ranges and stuff.) Once you either end your turn or move all your units its the enemys turn to move and attack.
FFT = Final Fantasy Tactics is a farly old game for the ps1 but extramly populare and very famuse. In it your also playing on a bourd with a grid. and you take turns with the enemy moving and attacking. when you want a unit to attack you can use his/her/its weapon or a skill. The thing that made FFT such a hit was that if your character is a BlackMage and learns Black Magic spells you can change your job(your class) over to Knight or Archer( to start learning some of them skills) and set the Black Magic to your Sub Skill, allowing you to use Both your learned Knight Skills or your Learned BlackMagic skills (there is also passsive, movment and equip skills you can learn and add to your character allowing them to have specal effects, passives would be things like improveing your chance to dodge attacks, movment would be like letting you walk over water, and equip would allow you to equip weapons or armors that you would not normaly be allowed to equip unless you was the right job {like Archers can equip a bow, but knights cant unless you have the skill "Equip Bow" on that character}) So you could have a team of archers but each with very differnt skills)
================================ EDIT:I think i got it, Im not 100% sure but its looks very good. I'm doing this edit so I dont wast you time and energy. I though, sence i now have 2 grids to work with I need 2 point holders, One to check for boundys and Piece location and the other for touching.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
PICKY? Me?
01-19-2007 00:47
From: XelNaga Gamba There! that better. your so picky! =þ Nope, was jsut telling you the ergonomic repercussions.  From: XelNaga Gamba I want attack to have its own button because units like the archer have a large attack range and a min range, so they need there range glowing with out interfearing of the movment glowing range.
I'm having a hard time getting the square to change color. I know to use the llSetLinkColor and Iv relinked the board so the square numbers start from 12 and end at 4 (i know which square is which number because I use a llOwnerSay( "Its :" (string)lldetectedLinkNumber(0)); in the touch_start event(?) so it tells me which square is which number) 3,2 is part of the stand and 1 is the root (also the base of the stand). Now my problem is Im unable to figure out a way to conect my string grid with the prim grid.
I dont want to use a: if (A1_pos == 0) { llSetLinkColor(9,<#,#,#>,0); llSetLinkColor(11,<#,#,#>,0); } else if(A1_pos == 2) { llSetLinkColor(12,<#,#,#>,0); llSetLinkColor(10,<#,#,#>,0); llSetLinkColor(8,<#,#,#>,0); } else if(ect.)
for each piece at each square! that would be WAY too large for somthing so simple. So, i need somthing simpler... any ideas? You say you've solved this? you can map board squares to link numbers simply by subtracting the first link number from the link number of the square, i.e. 4, remember LSL lists start at 0 not 1. link number 4 5 6 7 8 9 10 11 12 Board Square 0 1 2 3 4 5 6 7 8 As each Unit type will have its own limits you maye need to write specific functions for each one, MoveArcher, AttackArcher, Moveknight, AttackKnight etc. You could pass in the current position and then calculate your offsets based on the rules you have defined for that unit. If they are all straight froward you may find that you only need two functions (Move and Attack) and a lookup tables for the limits.
|
|
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
|
01-19-2007 01:46
From: Newgate Ludd You say you've solved this? you can map board squares to link numbers simply by subtracting the first link number from the link number of the square, i.e. 4, remember LSL lists start at 0 not 1.
link number 4 5 6 7 8 9 10 11 12 Board Square 0 1 2 3 4 5 6 7 8
As each Unit type will have its own limits you maye need to write specific functions for each one, MoveArcher, AttackArcher, Moveknight, AttackKnight etc. You could pass in the current position and then calculate your offsets based on the rules you have defined for that unit. If they are all straight froward you may find that you only need two functions (Move and Attack) and a lookup tables for the limits.
I'm pretty sure I did not understand a thing you just said. The one part I did understand was the lookup tabes for the limits, and I like that! How exacly would I beable to do that? The um Link number and Board square thing.. I cant line them up that way because my board uses 2 numbers for 2 square so it would look like 0 2 4 6 8 ect. instead of 0 1 2 3 4 5. Its that way so I can have 2 characters when IDing the piece A1, B1, A2, B2 ect. Right now I have it when i press on the piece a menu opens with attack,movment, and a skills slot. Once i get it worked out ill have the movment be automatic when the piece is selected. Im stuck on chainging the color of the square when the move is pressed. I though a "if( A1_gPos / (A1_gPos / 2) == 2)" would beable to tell if the A1_gPos is Even or Odd, sence its an intenger and not a float. but it always comes back with true even if the number is 5. is there any other way to tell if a number is even or odd? It also raps around when i get near an edge. So ill probobly have to set each and every square it an if/then/else.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-19-2007 03:04
From: XelNaga Gamba I'm pretty sure I did not understand a thing you just said. The one part I did understand was the lookup tabes for the limits, and I like that! How exacly would I beable to do that?. LOL, Newgy strikes again. The contents look up tables would be very dependant upon the rules you have created for the pieces. From: XelNaga Gamba The um Link number and Board square thing.. I cant line them up that way because my board uses 2 numbers for 2 square so it would look like 0 2 4 6 8 ect. instead of 0 1 2 3 4 5. Its that way so I can have 2 characters when IDing the piece A1, B1, A2, B2 ect.. How exactly are you stroing information? My idea above was purely to translate between a click on a prim and which baord square it translates too. You can then 'look up' the corresponding piece in the board map. i.e. Click prim 10 -> Board square 6 -> FindPieceAt(6) -> "A2" You can then use then use "A2" as the index to look up the parameters for that piece. From: XelNaga Gamba Right now I have it when i press on the piece a menu opens with attack,movment, and a skills slot. Once i get it worked out ill have the movment be automatic when the piece is selected. Im stuck on chainging the color of the square when the move is pressed. I though a "if( A1_gPos / (A1_gPos / 2) == 2)" would beable to tell if the A1_gPos is Even or Odd, sence its an intenger and not a float. but it always comes back with true even if the number is 5. is there any other way to tell if a number is even or odd? It also raps around when i get near an edge. So ill probobly have to set each and every square it an if/then/else. A1_gPos may be an integer, but the result of teh division isnt being stored so it will be a float. integer temp = (A1_gPos / 2); temp *= 2; if(temp != A1_gPos)...... But I dont think you need to do it anyway. going back to my little example, we now know A2 is in Square 6. since we know it can (for example) only move 1 space in any direction then we can calculate its movement cells by mapping the board square positions reachable in 1 square. Since we know the size of the board is 3 x 3 then Pseudo Code MoveUp(from, by) { temp = from + (by * XSize); if(temp > MaxSquares) temp = OUTOFBOUNDS; return temp; }
MoveDown(from, by) { temp = from - (by * XSize); if(temp < 0) temp = OUTOFBOUNDS; return temp; }
MoveLeft(from, by) { RowNumber = (from / XSize) * XSize; // Will give our rownumber MinSquare = XSize * RowNumber MaxSquare = MinSquare + (XSize - 1) temp = from - by if(temp < MinSquare) temp = OUTOFBOUNDS; return temp; }
MoveRight(from, by) { RowNumber = (from / XSize) * XSize; // Will give our rownumber MaxSquare = (XSize * (RowNumber + 1)) - 1 temp = from + by if(temp > MaxSquare) temp = OUTOFBOUNDS; return temp; }
So its possible movements are 7 or 3 and 4 if you allow diagonals. Handerling wrap around and diagonals will be more problomatic but still calculatable. Each square has 8 possible movement directions so you can create a movement map : "11111111" one square in any direction, "020202020" two squares no diagonals, "101000101" one square only diagonal. etc. For more complex movement capabilities you will requires special handlers. Attacks can be worked out in a similar manner.
|