Need some help in scripting a turn based estrategy game

Started by Fedx, Mon 13/04/2009 02:17:45

Previous topic - Next topic

Fedx

Hi! I need some scripting and help here. I'm making this "Capture the flag" estrategy game, but I'm really stuck. This is a sketch of how a map would look (It's not the actual map, just a sketch just to know where are the flags and else):

The yellow squares are the walkable ones (Sand), the blue are the non-walkable (Water), the red circles are the flags position, the brown dots are wood and the gey ones are stone. The first thing I need is this: When you press a direction key, to move the character you are using just one square when they tap it, and then change to the other player. 2: The "troops" (There are four, the captain and the soldiers) can pick up guns, and they have a deterimned reach (Eg, the gun 4 surounding squares, the shotgun 12, etc.) how can I do that?. I think that's all.

BTW, sorry for the long post  :-[
- The gamer doesn't dies... he respawns -

Trent R

Easy stuff, just go through it a step at a time.

1) You need a way to pick the player piece. Write some on_mouse_click code (or if you want to do it completely by keypress)

2) You need to know which pieces are on which team. Add a custom property if it doesn't need to change at runtime, if it does, use variables or an extender/property workaround.

3) You need to determine who's turn it is. Create a global bool.

4) Need to implement weapons. Create properties for the InventoryItems for their, and properties for Characters for their rank and if they can use weapons. Manage equipping through Add/LoseInventory and check with HasInventory.

5).... So on and so forth. Don't think, "I'm making a non-adventure game! On-noes, I'm lost!" Just take it one step at a time, and it won't be to hard to script. There's nothing wrong with asking and getting ideas either, certainly once you get to the point of computer AI (if it all).



~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Fedx

Thanks Trent, I was a bit lost of what I should do, but now I'm gonna try it. And BTW, I will do it for two players, and then I will try to do the AI. One final question, for example, how does AGS knows that the player "Captain" has a custom property? For example, I create a property if he can use weapons called "CanUseWeapon", how do I make him have this property?
- The gamer doesn't dies... he respawns -

Trent R

First off, read the manual entry on Custom Properties.

When it comes to properties, remember that the same properties exist for rooms, objects, hotspots, items, and characters. So when you create a new one in the Schema Editor, make sure you always set the default value to false, or -1, or whatever works for the property's purpose.

To check the property of cCaptain, just use this line:
Code: ags
cCaptain.GetProperty("CanUseWeapon")
Check out the manual entries that are related (all 11) to properties, and you understand it easily enough.


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Fedx

- The gamer doesn't dies... he respawns -

SMF spam blocked by CleanTalk