Author Topic: How to create a catapult to launch fireballs to a waypoint?  (Read 328 times)

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0


               

Hello everybody!


 


I am creating a simple battle ship system that uses a catapult to fire the enemys. However, I just need three things:


 


- To the catapult launch a fireball randomly to 1 of 4 WAYPOINTS in the enemy ship.


- To reload the catapult with a bomb.


- To use the catapult by a lever.


 


newcatapult.png


 


About the damage of the fireball, need be something like a fire damage and a bludgeoning 4d10 || 5d10. the value of the damage must be shown (because I've seen ballistas systems that drain the enemy's HP, but the amount drained was not shown).


 


About the reloading, I thought about to reload the catapult with any item like "empty capsule bomb" and "filled capsule bomb". if you use the catapult, the filled capsule bomb is transformed into empty capsule bomb. Then you need to drop the empty capsule bomb into a crate in the ship armazen. In the event OnClosed of the crate, the empty capsule is transformed into a filled capsule bomb.


 


//I already have the crate system to transform empty bombs to filled bombs


 


About the lever, is only to start all functions of the catapult. Before the lever starts, I thought to check: 


 


- If the waypoints in the area is object valid. (we have 4 waypoints total)


- If the player have a filled capsule bomb.


- If the player have +20 STR


 


//for anyone who can help set up the system, we use these waypoints:


 


1. "WP_Enemy_Ship_A"


2. "WP_Enemy_Ship_B" 


3. "WP_Enemy_Ship_C" 


4. "WP_Enemy_Ship_D"


 


//And these informations...


 


Catapult tag: "PLAC_Ship_Catapult"


 


Empty capsule BluePrintResRef: "empty_capsule001"


Empty capsule tag: "empty_capsule001" (the same)


 


Filled capsule BluePrintResRef: "filled_capsule001"


Filled capsule tag: "filled_capsule001"



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
How to create a catapult to launch fireballs to a waypoint?
« Reply #1 on: June 26, 2014, 11:05:22 pm »


               TriggerProjectileTrap is a quick solution, but to achieve the exact results you need, try ActionCastFakeSpellAtObject with a custom damage effect.


If the projectile origin looks wrong, fire the spell from an invisible object in the exact position you need.


I find that firing at a random location near the target looks more realistic, rather than a set of waypoints.


This just needs to be wrapped in a standard lever script.


Not sure about the ammo aspect.
               
               

               
            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
How to create a catapult to launch fireballs to a waypoint?
« Reply #2 on: June 29, 2014, 02:10:04 am »


               

White Tiger,


As a noob, I don't know if this will help, but In my current build I have an area at sea where 2 pirate ships attack a merchant with the PC and crew. The first pirate ship,up close, is loaded with archers firing flame arrows. The second, at a distance is firing a cat with fireballs.


I placed 4  waypoints on the deck of the merchant. I also placed 4 water barrels on deck with about 30 waypoints.


 


Heartbeat Script on the Cat


void main()

{

 object oPC = GetFirstPC();

 object oCat = OBJECT_SELF;

 object oCap = GetObjectByTag("OrcCatCapt");

 object oOp = GetObjectByTag("OrcCatOp");

 object oLoad = GetObjectByTag("OrcCatLoad");

 object oTargeta = GetWaypointByTag("WpCatTarget01");

 object oTargetb = GetWaypointByTag("WpCatTarget02");

 object oTargetc = GetWaypointByTag("WpCatTarget03");

 object oTargetd = GetWaypointByTag("WpCatTarget04");

 int nSpell = SPELL_FIREBALL;

 int nMeta = METAMAGIC_ANY;

 int bCheat = TRUE;

 int nDom = 20;

 int nPath = PROJECTILE_PATH_TYPE_HIGH_BALLISTIC;

 int bNow = TRUE;

 int nShot = d4();


 if(GetIsObjectValid(oCap))

 {

  if(GetLocalInt(oPC,"UnderSiege") > 0)

  {

   switch(nShot)

   {

    case 1:

    AssignCommand(oCat,

    ActionCastSpellAtObject(nSpell,oTargeta,nMeta,bCheat,nDom,nPath,bNow));

    break;

    case 2:

    AssignCommand(oCat,

    ActionCastSpellAtObject(nSpell,oTargetd,nMeta,bCheat,nDom,nPath,bNow));

    break;

    case 3:

    AssignCommand(oCat,

    ActionCastSpellAtObject(nSpell,oTargetb,nMeta,bCheat,nDom,nPath,bNow));

    break;

    case 4:

    AssignCommand(oCat,

    ActionCastSpellAtObject(nSpell,oTargetc,nMeta,bCheat,nDom,nPath,bNow));

    break;

   }

  }

 }

 else

 {

  DestroyObject(oOp);

  DestroyObject(oLoad);

 }

}


 


The HB script on the barrels spawns fires that can only be destroyed by bashing the barrels. It also initiates a countdown that gives the PC only so much time to bash all the barrels and destroy the Cat. Sucess = Save the ship, Failure = deserted island.


As said, I don't know if this is any help, but I am trying to give back some of the help that you have all given me.


Ed