The higher the airship goes, the quicker it will rise.
You will need to tweak this for your needs of course to create the result you're after.
If you'd like to change the value of the ship going upward, change the
vPos1.z += values.
Here is a quick tutorial of the script.
When you're ready to have the airship begin to rise upwards, you'll want to change the
airshipstart variable to something other than 0.
A counter will begin and increment every 6 seconds, changing the height of the airship placeable.
So the first 6 second count, the airship will be destroyed and recreated at a height of 0.20 off the ground.
At 12 seconds, the airship will be destroyed and recreated at a height of 0.40.
These are the values you will want to play around with, depending on the size of the placeable, these increments of 0.20 may not be enough to give a visual representation of the airship actually moving upward.
So instead of creating the airship the first time at 0.20, you might want to set it to 0.80, etc.
Each value after will need to be higher than the last.
After 11 heartbeat cycles, the airship is destroyed and the variable is reset to 0 to stop the script from going off again.
Change all lines that have
"TAG_OF_AIRSHIP" to the real TAG of your airship.
Change all lines that have
"RESREF_OF_AIRSHIP" to the real RESREF of your airship.
void main()
{
// Place this script on the Airship's OnHeartbeat
//
// AIRSHIP FIRE VARIABLE - airshipstart
//
// At some point, when the airship is ready to begin moving upward,
// change the airshipstart variable from 0 to something else.
//
// example - SetLocalInt(GetModule(), "airshipstart", 100);
//
// Once it's anything but 0, the script below will begin to fire.
//
object oMod = GetModule();
int nNth = GetLocalInt(GetModule(), "airshipup");
// Checks to see if script should begin to fire & airship to rise upward
if (GetLocalInt(GetModule(), "airshipstart") == 0) return;
// HB counter to destroy & create airship
nNth++;
if (GetLocalInt(GetModule(), "airshipup") == 0)
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 0.20;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") == 1)
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 0.40;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") == 2)
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 0.60;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") == 3)
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 0.80;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") == 4)
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 1.00;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") == 5)
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 1.40;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") == 6)
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 1.80;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") == 7)
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 2.20;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") ==
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 2.80;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") == 9)
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 4.00;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") == 10)
{
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
location lLoc1 = GetLocation(OBJECT_SELF);
float fFacing = GetFacing(OBJECT_SELF);
vector vPos1 = GetPositionFromLocation(lLoc1);
vPos1.z += 5.00;
lLoc1 = Location(GetArea(OBJECT_SELF), vPos1, fFacing);
CreateObject(OBJECT_TYPE_PLACEABLE, "RESREF_OF_AIRSHIP", lLoc1);
}
if (GetLocalInt(GetModule(), "airshipup") == 11)
{
// END AIRSHIP JOURNEY
DestroyObject(GetObjectByTag("TAG_OF_AIRSHIP"));
SetLocalInt(GetModule(), "airshipstart", 0);
}
}
EDIT: Thanks SunJammer
'>
FP!
Modifié par Fester Pot, 10 septembre 2010 - 11:20 .