Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home3/tedson/public_html/metalshard/header.php on line 14

Warning: Cannot modify header information - headers already sent by (output started at /home3/tedson/public_html/metalshard/header.php:14) in /home3/tedson/public_html/metalshard/header.php on line 23

Warning: Cannot modify header information - headers already sent by (output started at /home3/tedson/public_html/metalshard/header.php:14) in /home3/tedson/public_html/metalshard/header.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /home3/tedson/public_html/metalshard/header.php:14) in /home3/tedson/public_html/metalshard/header.php on line 25

Warning: Cannot modify header information - headers already sent by (output started at /home3/tedson/public_html/metalshard/header.php:14) in /home3/tedson/public_html/metalshard/header.php on line 26
Pocket PC Forum page 1 topic 554 at MetalShard
MetalShard, inc.
Pocket PC and Windows Games and Software

Pocket War (Game) Forum

This is a message in the Pocket War (Game) forum. If you would like to reply to this subject then fill in your reply in the box at the bottom of the page and click the Reply button. To get back to the main page for this forum click the Topics button.

Subject - createBlankLandType - Why can't create in user script?
Pages: [1] Messages 1 - 6 of 6
Posted By: Anonymous (2005-04-22 03:35:20)

I had a really cool algorithm written using bresenhams line drawing algorithm with "thickening" to create a bridge between two waypoints in a user script called BuildBridge.js. Only when I call createBlankLandType to create a new "grass" land type I get an error that states I cannot use that function in a user script. Is there a reason why I can create land in a user script? Do you have any suggestions on how to create the bridge otherwise. Like I said, the line drawing is done and tested using debug statements so I know if I can just change the tile properties I can create the bridge.
Posted By: Tully (2005-04-22 10:14:05)

You could create a user script that placed water under enemy marines, etc and would basically let you cheat.

However if it is part of a mod that isnt a user script (or at least it shouldnt be.) Only scripts you attach to units while playing the game or scripts where you call setUserScript from the code are user scripts.

If you are making a unit and want to assign the script at the unit creation time make sure you call setScript.

If you are still having problems upload the unit here and I will see what is going on
Posted By: Anonymous (2005-04-23 00:13:15)

Okay, I figured out how to attach the script correctly. I basically created a unit with movement of 0 and type water so the engineer would have to place it on the waters edge (wouldn't make sense otherwise). The user still has to initiate the building process, however, by selecting a user script which requires a waypoint representing the endpoint. I then set the unit state (the bridge unit) to begin building the bridge. All is fine here as well as the land tiles magically appear each turn. The problem comes when I try to move a unit across the tile. The units will go to the tile that used to border the water and stop (as if it thinks the new tiles are still water). I've made attempts to modify the original tile which result in crashing the game so I think that's pretty much out of the question. Here is some code that will build a line from quadrant 1 to quadrant 2 (left to right with x increasing more than y). I left the rest of the code out for clarity. The function that does the actuall tile placement is called addBridgeSegment.
Posted By: Tully (2005-04-23 00:24:50)

you dont want to create blank land types. That is for defining new types of land. Though I was looking and I dont see a way to easily just get an exising land type.

Try calling tile getLandAtPos( int x, int y ) at some place where there is known grass (ie where the unit is currently sitting) and see if you can then set that at the new position (no create or any of the other stuff since the land you get will already have all the right props set.) It still might not work and the reason is land information caching that helps make the game much faster. I might need to add a new method for you that will dump the cache when new land is added.
Posted By: Anonymous (2005-04-24 04:30:56)

Your suggestion worked great - at first. The first turn the tile next to the bridge changed to the correct representation. The borders were correct and it looked like it was natural on the map. The prior way of createLandType would not set the edges correctly for the tile and it would render strange. The problems begin on the second turn. It seems to place the tile okay (verified through trace statements) but the game gpf's and I recieve an error in the trace file refering to bitmaploader.cpp. I have included a portion of the trace file with the relavant information (the file was huge since I had trace turned on) as well as the bridge script illustrating the function which creates the land itself. Thanks again!
Posted By: Tully (2005-04-24 10:22:36)

what happened is you put down a combination of tiles that cant exist in the game. It was trying to figure out what border tiles to place around the tiles you put down and it couldn't come up with a combination that worked. What you need to do is create a new land type for bridge parts. That land type would be simple square types with no border and be placeable on ocean tiles. When I get the chance I will try and work up a section of code that will do that for you.
Pages: [1] Messages 1 - 6 of 6


Attach File (zip and pwg files only)

you must be logged in to post
Copyright 2003-2010 MetalShard, inc. Games for Windows and Pocket PCs pocket war forums, automation software freegames