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 438 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 - making a unit
Pages: [1] Messages 1 - 8 of 8
Posted By: SeaEagle (2004-07-17 18:00:44)

the following is the javea code....but i cant get it to get past a 0x8660060 error trying to load png file...but i have used the file from the unit sub-directory and still has same erorr....please helpif you can

===== mod-Heuy_104-unit.js =====

//# "Units" "units.js"

// the above line is magic and you have to have it. What is says is
// run this script in the same context as the "Units" (logical name)
// script. you also have to include the file name ("units.js" in this case)
// for the script you want to chain off of

// notice that you dont have all the other script stuff like script name
// waypoints, etc. That is because this script will run in the
// other scripts space. You cant override the base script
// properties like name, description, etc but that should
// not matter

// first store off the methods you are going to override
// you have to do this so you can call the existing functions
// in the script you are overriding
var oldGetTypesFunc = getTypes;
var oldCreateUnitFunc = createUnit;

// now get the path to our modDirectory
var modDir = getFilePath( "submoddirectory" ) + "Heuy_104/";

// now create new versions of the functions you want to override
// make sure they are NOT named the same as the callback method
// we will attach them to the callback in a second
// you do have to make sure that the signature of the method is
// correct for the callback
function newGetTypes()
// First we need to get a list of all the existing types
var existingTypes = "";

// If there is an old getTypes method then we need to call
// it and get the list of types it knows how to build.
// Here we are using the function we stored off earlier
if( oldGetTypesFunc != null ) existingTypes = oldGetTypesFunc();

// now we just tack on our new unit
existingTypes += "-Heuy 104";

// and return the combined string
return existingTypes;

function newCreateUnit( typeString )
// we will need to create on of the type of units that was passed in
var unit = null;

// first see if the old createUnit call can create this type of unit
// if the old createUnit call exists that is
if( oldCreateUnitFunc != null ) unit = oldCreateUnitFunc( typeString );

// if the old function couldn't build this unit the we need to try
if( unit == null )
// now see if this is something we know how to build
if( typeString == "Heuy 104" )
// if it is the create a blank unit
unit = createBlankUnit( player, typeString );

// set its stats
setStats( unit, 2, 4, 3, 2, 0, 0 );
setMovement( unit, 2, -1, 1, 0, 0, 0, 0 );
setSounds( unit, modDir + "planeattack.WAV", "", modDir + "PLANEHIT.WAV" );
setImages( unit, modDir + "CHOPPER.PNG", modDir + "CHOPPERMASK.PNG", 0 );
setMultiAttack( unit, true );
setDefaultMove( unit, "stop" );
setDefaultAction( unit, "attackunit" );

// update the unit count
var unitCountStr = getGlobalString( null, "unitCount" );
var unitCount = parseInt( unitCountStr ) + 1;
setGlobalString( null, "unitCount", "" + unitCount );
// set the name of this unit
setName( unit, "Heuy 104#" + unitCount );

// return the unit. If no one could make it then unit will be null
return unit;

// now attach the new functions to the callbacks and you are done
getTypes = newGetTypes;
createUnit = newCreateUnit;

// if you drop this script into the mod directory of pocketwar
// it will automatically get picked up the next time you start the program

// you should also note that this file is not enough. Now pocket war
// knows it can build this unit and how to build this unit but it
// does not know who can build this unit. In our case we want to
// add this unit to every city, so we need to chain off of the city
// script as well.

===== mod-Heuy_104-city.js =====

//# "Cities" "cities.js"

var oldCreateCityFunc = createCity;

function newCreateCity( typeString, waterAccess, landAccess, hoverAccess )
var city = oldCreateCityFunc( typeString, waterAccess, landAccess, hoverAccess );

var buildList = getBuild( city );
buildList += "-Heuy 104";
setBuild( city, buildList );

return city;

createCity = newCreateCity;

Posted By: Tully (2004-07-17 18:06:22)

are you trying to do this on 1.5 or 1.08
Posted By: SeaEagle (2004-07-17 18:32:50)

how would i know....i downloads the 1.08 and used that one....
the other thing i did was to use the chopper images and just rename them and still
it does not work
any help is greatly appriciated

Posted By: SeaEagle (2004-07-17 18:35:49)

and how would i get a copy of 1.5????
Posted By: Tully (2004-07-17 20:46:32)

The version number is on the bottom right corner of the title screen. If you haven't used 1.5 then you would have 1.08. 1.5 is only an alpha version (not released) right now, there is a post back in the forums that says where to download it. The reason I had to ask is the mods were totally reworked for 1.5.

(and yes I know it has been an alpha for a long time. sorry I just havent had time to finish it)
Posted By: SeaEagle (2004-07-18 13:19:49)

thanks for your help
Posted By: SeaEagle (2004-07-18 13:41:58)

i have been looking threw the forums but i still have not run acorss the
1.5 version ...could you put a link here for me
Posted By: SeaEagle (2004-07-19 10:10:27)

while making unit to experiment with how do i get naother unit to build another unit. That is in the area where it says build type what is the specific wording to get it to make the unit and what specific name do i use so a unit can transport another unit
Pages: [1] Messages 1 - 8 of 8


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