December 30, 2024, 19:06:08

Author Topic: Prototype weapons  (Read 5434 times)

Offline Lord_Valarian

  • Specialist
  • *
  • Posts: 64
  • Karma: 0
    • View Profile
Prototype weapons
« on: May 21, 2011, 21:47:36 »
I want to an element of realism to my phaser mod. In the ship's database, you find large numbers of new technologies and the ship itself. The first created new weapon prototypes are flawed. The weapon is damaged every time it fires. Also, I'll do a more complete story later.

Can someone show an example of a repeating weapon fired event?




Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
Re: Prototype weapons
« Reply #1 on: May 22, 2011, 00:54:32 »
First, request a fired event:

Code: [Select]
SelectEx(s.weapon & s.devtype = #yourWeapon'sDevtype ,
requestFiredEvent(s.this,1);
);

That'll make it so that when the weapon fires, a "fired" event will be triggered.

Code: [Select]
Rule event Fired
condition IsValid(e.location)&e.location:devtype=#yourWeapon'sDevtype
:action
///Now, how do you want to inflict the damage? Percentage? fixed value? (recommend percentage)
e.location:damage := e.location:damage + 10; //This means that the weapon's will be damaged by 10% of it's hp. if the damage was, let's say, 50%, after that it'll be 60% and so on.
requestFiredEvent(e.location,1); //We re-request the fired event for when the weapon fires again.
:end
END

And that should do it.