# Schtauffen

Member Since 22 Dec 2008
Offline Last Active Jan 19 2010 02:19 AM

### Blackjack: Red7 Procount

07 January 2009 - 02:31 PM

Blackjack: Red7 ProCount by Schtauffen
Currently v0.1
Screenshot:
Coming Later: other blackjack commodities, as well as a timer for your counting, and the ability to change the amount of decks your counting.

What is it?
A simple utility created to simulate a deck of cards. When you initially press the left mouse button it will reveal two cards, and each subsequent click will reveal 2 more cards and you must attempt to count* all the cards until the end of the deck.

What is card counting?
Contrary to what some believe, card counting is legal. It also is not remembering every card which has been played, (which is impossible, unless your a savant) no no... its much simpler than that. Most counting methods have you only remembering one number, or your count. Some more advanced ones take into focus a Running Count and a True Count for more accuracy. However, if you're not very skilled or just looking to count as a hobby True counting methods are probably not for you (they require calculating a True Count value by dividing your running count by the amounts of decks you guess are left in the shoe).

So... what's the Red7 count?
First off, Red7 is a running count, so you don't have to worry about dividing quickly in your brain
Like most counting methods, Red7 counts cards with the values of 2,3,4,5 and 6 as +1.
Also like most counting methods, Red7 counts cards with the values of X (10,J,Q,K,A) as -1;
However, Red7 also (as the name implies) counts Red 7s (7 of hearts, 7 of diamonds) as +1;
This is to take into account that this method is not a true count. It is important to remember that since you
have 2 more cards per deck that add +1 to your running count, you should always start your count at -2*n where n
is the number of decks. This allows 0 to be your main swing point. You should also always end counting of the deck/shoe at 0 (if you did not, you counted wrong!)

What does counting accomplish?
Card counting does a couple of things. For example, it lets you know how much to bet based on your current chance of winning each hand. As you may have guessed, higher counts are better. (This is why you subtract 1 every time a X card is played... X cards are the players (and not the houses ) best friend!)
Counts can also be used by more skilled players to change strategy on the fly. If the count is high, you'd want to hit less and less on anything above 11.

Sorry if I rambled or made little sense, I decided to spend a couple hours creating this instead of going to bed xD

### Sprite_index When Object Isn't In The Room...

06 January 2009 - 01:35 AM

Another one of my RTS questions...

I have each wirefram/button picture of each unit as the 2nd and 3rd images of that resp. units sprite.
However, how do I call the objects sprite_index if no instances of that object exist in the room at the time?

For drawing buttons I've been doing
`draw_sprite(obj_unit.sprite_index,2,xx,yy);`

which works fine, until I remove all instances of obj_unit from the room... then it says the "unknown variable: sprite_index" error.
Is there a way GM can check for the objects default sprite_index without said object having to exist in the room?

### Instance_create(x,y,string); //parent Issue

05 January 2009 - 11:30 PM

Okay, for my rts engine I have the following problem, it is set up like so:

1) the name of each unit is stored in a list, with places corresponding to buttons you can click.
```uList = ds_list_create();
etc...```

2) I have a second list which contains the current building queue... so if I clicked the btn corresponding to "obj_unit1" 5 times... it would store "obj_unit1" in ds_list queue's 0-4 slots...
```ds_list_find_value(queue,0) returns obj_unit1...
ds_list_find_value(queue,1) returns obj_unit1... etc```

3) So I'm trying to do this:
`instance_create(xx,yy,ds_list_find_value(queue,0));`
However, instead of creating an instance of "obj_unit1" it creates an instance of "obj_unit1"'s PARENT UNIT.

Anyone know the solution?

### Schtauffen's Rts Engine

31 December 2008 - 10:29 AM

Status: Progress Paused!
• Title: Schtauffen's RTS Engine 0.4
• Description: An RTS Engine WiP
• GM Version: Pro Required
• Screen Res: 1024x768 (doesn't change res)
• Screenshots:
• v0.1-v0.36: 40 DLs
• v0.37: 61 DLs
• v0.4: 632 DLs (as of Jan 13, 2010)
• Total: 729

[1/5/09] v0.4: I've re-scripted the entire engine, and am now back where I was on the first, but with a much better (I think) system in place. Read below for how simple it is to add new units/buildings now. Things to come: combat, new "noPath" scripts, building construction, and more...

[1/1/09] v0.37: Rather small update. Fixed coding error that allowed you to queue units when the castle was not selected. Converted the latest file to .gm6, but I\'m not sure of the stability of this conversion. From my testings, however, it seems to be a complete and solid .gm6. I\'ve also added new screen shots which sport an updated bottom interface. It is still far from complete, and I am unsure at this point whether to release the graphics or keep them for myself and keep downloads light.

[12/31/08] v0.36: Big update! Added functionality to the buildings (you can select them now.) You may also build more units at the castle by clicking on the button that appears in the lower right hand corner when you have the building selected. I\'ve also moved the topic to the WiP section as I feel it is becoming more of a WiP than a simple tutorial (I will make simple more goal-oriented tutorials if anyone wants them.) The biggest "next goal" on my list is to clean up the code (redo a lot of it) so it can function more like an engine (easy to add units, etc); Enjoy!

[12/30/08] v0.34: Tweaked some scripts, namely the "crowded" and minimap ones. Also added in Pheonix101\'s FOW engine for the time being, however it is OFF. To see the current effects of the engine on the RTS example just place the \"obj_FOW\" anywhere inside the room. His engine carries a couple things that create issues with what I\'m trying to accomplish so I\'ll most likely program my own somewhere in the future. Added a couple (poorly drawn, mind you) buildings. Don\'t mind some of the placer sprites at the bottom, they will be replaced in time with actual functionality. Added some comments, more to come ;P

[12/29/08] v0.33: Added brand new movement scripts, based on a work done by Fede-lasse. Currently I\'ve decided I don\'t care if units overlap at all, as long as in the end they end up in different positions. So, when they are moving they can overlap, if they are not moving they will spread out. Obviously it isn\'t perfect yet, but I\'m working on it Next update will contain more comments so it is easier to make sense of everything.

[12/28/08] v0.3: Revamp! Room size is bigger, views used, recoded the bottom bar and minimap, as well as many other scripts. I\'ve also started renaming objects, sprites etc to make everything easier to follow.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Just got easier than ever before! To begin, you need to have a properly set up sprite (currently the engine rotates 1 main image).

THE SPRITE:
Units MUST be centered at 16,16 to proper correctly, and units bigger than 32x32 are not allowed to do the grid based movement system.
Buildings should have a center of a multiple of 16, ie) 16,32, etc...

To make a sprite that won't crash the game, you'll need 3 images as seen in this picture:

image 0 is the unit/building picture.
image 1 is the wireframe/queue picture.
image 2 is the button (should be 42x42) (*Not yet required for buildings)

THE OBJECT:

1) Create a new object
2) set its parent to "obj_unit" or "obj_building" pending on which type it is.
3) set its sprite to the correct sprite
4) copy the "Create" event script from either the parent or another unit/building
5) replace variables in that event script with the new variables

BUILD TIME (units only, currently):

ADDING A UNIT TO A PRODUCTION BUILDING:

Just fill in a blank ("") ds_list entry with the obj_name

If you did everything right you should now be able to build the new unit in game or place the new building (not yet constructible) via the room interface.
Cheers!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Things included atm:

Buildings(NEW):
• Production Buildings: Currently only the Castle, units are free atm.
• Click to Queue: When you click a unit creation button with a castle selected, it will add that unit to the queue and create those units until they are all made. Current max-queue size is 5.
• Rally Point: After creation, units will move to the buildings set rally point. When a building is selected, you can see the rally point as a flag icon on the map. To set a new rally point, just right click with that building selected.
Unit Selectability/Control:
• Buildings: Buildings may only be selected by left clicking on them. Only 1 building may be selected at a time.
• Max Group-Size: Currently 9 up to 12. (also changeable, but you'll have to mess with some scripts to get unit info/and formations correct)
• Left-Click(LC): Select single unit.
• Shift-LC: Adds unit to selection.
• Alt-LC: Removes unit from selection.
• Drag-to-select: Initiates with the press of LC and ends with the release of the LC, anything in the box will be selected (up to 9 units).
• Control Groups: Ctrl+[0...9] Add selected units to the numbered group, to reselect that group press the number.
Unit Movement:
• Formation: Currently units will always move into a square formation.
• Right Click (on tile): moves selected unit/group to the tile.
• Right Click (on Minimap): units will move to corresponding section of the map.
• Path-finding: currently I\'m using the GM grid/path system as seen in Fede-lasse's example found: here.
View Control:
• Arrow-keys: Move the view on the map in their respective directions.
• Middle-Click: and drag towards a direction to move in that direction.
• Minimap: you can LC on the minimap to center your view at that location.
Comments, criticism, and suggestions all welcome!

### Rts Formation

24 December 2008 - 07:48 AM

Hello there,

I am currently re-learning GM as I've been out of the loop for some years and decided to jump back in with an RTS (smart, I know.)
However, I've already hit my first big bump... I cannot for the life of me figure out formation scripts. So I have some questions:

How do you get a script to recognize a selected units id, and use this information later in the script? ie)
I select 3 units, id's: 1,2,3.
How do I tell the script to select one and tell it to go to a certain point in the formation... and the others to 2 different ones? Like if I wanted a line formation... how could I tell the game to line them up 1-2-3?

Thanks for any responses!