Re: Texture Problems
Posted: 22 Jan 2010, 02:46
cute tank btw
Open Source Realtime Strategy Game Engine
https://springrts.com/phpbb/
Code: Select all
piece GP,head,base,l_forearm2,left,right,l_forearm3,nano1,nano2,turret1,turret2,dustl,dustr,flare3,flare4;
static-var restore_delay, ISMOVING, bAiming, bCanAim, peeeee, shooting_numb;
#define SIG_AIM 2
#define SIG_MOVE 16
#define lildirt 1024+0
#define SMOKEPIECE1 base
#include "smokeunit.h"
#include "exptype.h"
#include "StateChg.h"
StartMoving()
{ ISMOVING = TRUE; }
StopMoving()
{ ISMOVING = FALSE; }
Flamingass()
{
while(TRUE)
{
if (ISMOVING)
{
emit-sfx lildirt from dustl;
emit-sfx lildirt from dustr;
}
sleep 130;
}
}
//------------------------------------------------------
//start ups :)
//------------------------------------------------------
Create()
{
// Initial State
ISMOVING = FALSE;
bAiming = FALSE;
bCanAim = TRUE;
peeeee = 0;
restore_delay=3000;
start-script SmokeUnit();
// start-script Flamingass();
}
SweetSpot(piecenum)
{ piecenum=GP; }
AimFromPrimary(piecenum)
{
if (shooting_numb==1)
{ piecenum=flare3; }
if (shooting_numb==2)
{ piecenum=flare4; }
}
QueryNanoPiece(piecenum)
{
if( peeeee == 1 )
{ piecenum = nano2; }
if( peeeee == 2 )
{ piecenum = nano1; }
++peeeee;
if( peeeee >= 3 )
{ peeeee = 1; }
}
//------------------------------------------------------------
//Reload delay function
//------------------------------------------------------------
SetMaxReloadTime(time)
{ restore_delay = time * 2; }
AimPrimary(heading,pitch)//
{
signal SIG_AIM;
set-signal-mask SIG_AIM;
// Announce that we would like to aim, and wait until we can
while (NOT bCanAim)
{
sleep 100;
}
turn head to y-axis heading speed <60>;
turn r_forearm to x-axis (0-pitch) speed <250>;
turn l_forearm to x-axis (0-pitch) speed <250>;
wait-for-turn head around y-axis;
wait-for-turn r_forearm around x-axis;
wait-for-turn l_forearm around x-axis;
start-script RestoreAfterDelay();
return(TRUE);
}
FirePrimary()
{
if(shooting_numb==1)
{
show flare3;
sleep 120;
hide flare3;
}
if(shooting_numb==2)
{
show flare4;
sleep 120;
hide flare4;
}
shooting_numb=shooting_numb+1;
if( shooting_numb == 3)
{
shooting_numb=1;
}
}
//---------------------------------------------------------------------
//gun functions;
//---------------------------------------------------------------------
RestoreAfterDelay()
{
sleep restore_delay;
turn head to y-axis <0> speed <35>;
turn turret1 to x-axis <0> speed <250>;
turn turret2 to x-axis <0> speed <250>;
turn l_forearm3 to x-axis <0> speed <250>;
turn l_forearm2 to x-axis <0> speed <250>;
bAiming = FALSE;
}
/*==============================================
//nano functions
==============================================*/
StartBuilding(heading,pitch)
{
// Announce that we would like to aim, and wait until we can
bAiming = TRUE;
while (NOT bCanAim)
{ sleep 100; }
// Aim
turn head to y-axis heading speed <300>;
turn turret1 to x-axis (<-40> - pitch) speed <245>;
turn turret2 to x-axis (<-40> - pitch) speed <145>;
turn l_forearm3 to x-axis <-40> speed <145>;
turn l_forearm2 to x-axis <-40> speed <245>;
wait-for-turn turret2 around x-axis;
wait-for-turn turret1 around x-axis;
wait-for-turn head around y-axis;
// Announce that we are ready
set INBUILDSTANCE to TRUE;
return TRUE;
}
TargetCleared(which)
{
signal SIG_AIM;
set-signal-mask SIG_AIM;
call-script RestoreAfterDelay();
}
StopBuilding()
{// We are no longer in a position to build
set INBUILDSTANCE to FALSE;
signal SIG_AIM;
set-signal-mask SIG_AIM;
call-script RestoreAfterDelay();
}
Killed( severity, corpsetype )
{
if (severity <= 25)
{
corpsetype = 1;
explode base type SHATTER | BITMAP2;
explode head type FALL | EXPLODE_ON_HIT | BITMAP3;
explode l_forearm2 type FALL | EXPLODE_ON_HIT | BITMAP3;
explode left type FALL | EXPLODE_ON_HIT | BITMAP3;
explode right type FALL | EXPLODE_ON_HIT | BITMAP3;
explode l_forearm3 type FALL | EXPLODE_ON_HIT | BITMAP3;
return( 0 );
}
if (severity <= 50)
{
corpsetype = 2;
explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1;
explode head type SHATTER | EXPLODE_ON_HIT | BITMAP1;
explode l_forearm2 type SHATTER | EXPLODE_ON_HIT | BITMAP3;
explode left type SHATTER | EXPLODE_ON_HIT | BITMAP3;
explode right type FALL | EXPLODE_ON_HIT | BITMAP3;
explode l_forearm3 type FALL | EXPLODE_ON_HIT | BITMAP3;
return( 0 );
}
if (severity <= 99)
{
corpsetype = 3;
explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1;
explode head type SHATTER | EXPLODE_ON_HIT | BITMAP1;
explode l_forearm2 type FALL | EXPLODE_ON_HIT | BITMAP3;
explode left type FALL | EXPLODE_ON_HIT | BITMAP3;
explode right type FALL | EXPLODE_ON_HIT | BITMAP3;
explode l_forearm3 type FALL | EXPLODE_ON_HIT | BITMAP3;
return( 0 );
}
corpsetype = 3;
explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1;
explode head type SHATTER | EXPLODE_ON_HIT | BITMAP1;
explode l_forearm2 type SHATTER | EXPLODE_ON_HIT | BITMAP3;
explode left type SHATTER | EXPLODE_ON_HIT | BITMAP3;
explode right type FALL | EXPLODE_ON_HIT | BITMAP3;
explode l_forearm3 type FALL | EXPLODE_ON_HIT | BITMAP3;
return( 0 );
}
I head little birds singing and they were saying someone somewhere has building script Luafied somewhere.SanadaUjiosan wrote:So I take it there are basically no building lua scripts for me to use as references?
Code: Select all
local base = piece "base"
local nanoturret = piece "nanoturret"
local nano = piece "nano"
local SIG_BUILD = 2
function script.Create()
end
function script.StartBuilding(heading, pitch)
Signal(SIG_BUILD)
SetSignalMask(SIG_BUILD)
Turn(nanoturret, y_axis, heading, math.rad(90))
WaitForTurn(nanoturret, y_axis)
SetUnitValue(COB.INBUILDSTANCE, 1)
return 1
end
function script.QueryNanoPiece() return nano end
function script.AimFromWeapon() return nanoturret end
function script.StopBuilding()
Signal(SIG_BUILD)
SetSignalMask(SIG_BUILD)
SetUnitValue(COB.INBUILDSTANCE, 0)
Turn(nanoturret, y_axis, 0, math.rad(90))
WaitForTurn(nanoturret, y_axis)
Sleep(1)
return 0
end
function script.Killed(recentDamage, maxHealth)
return 0
end
Code: Select all
local building = piece "building"
local nano = piece "nano"
local pad = piece "pad"
function script.Create(unitID)
end
function script.QueryBuildInfo() return pad end
function script.QueryNanoPiece() return nano end
function script.Activate()
SetUnitValue(COB.YARD_OPEN, 1)
SetUnitValue(COB.INBUILDSTANCE, 1)
SetUnitValue(COB.BUGGER_OFF, 1)
return 1
end
function script.Deactivate()
SetUnitValue(COB.YARD_OPEN, 0)
SetUnitValue(COB.INBUILDSTANCE, 0)
SetUnitValue(COB.BUGGER_OFF, 0)
return 0
end
function script.Killed(recentDamage, maxHealth)
return 0
end
Thanks that did it! I wasn't far with my attempts tho :)PTSnoop wrote:Here's a pretty basic Lua builder script.
Code: Select all
local moveDefs =
{
{
name = "TANK4",
footprintX = 2,
maxWaterDepth = 10,
maxSlope = 20,
crushStrength = 25,
},
}
return moveDefs
"Factories" build inside themselves and then order the units to move away, "Builders" build units outside themselves at a specific order-point on the map... so Factories need to have that "location that unit will be built" specified game side (the pad) while Builders have the "location that unit will be built" specified by the player when they issue the order to build.oksnoop2 wrote:Why are buildings and builders treated differently?
Why does a building need a pad and builder does not?