Author Topic: "Spell" system  (Read 2969 times)

0 Members and 1 Guest are viewing this topic.

Offline shuttleatlantis

  • 24
  • Biophysicist
    • Biophysics: The Shattered Universe
I'm trying to code a "spell" system into a (multiplayer) mission, where each player has access to a few special abilities based on their ship class. I know how to make the actual abilities work, but need help finding a way to let the player activate them. I've considered several methods, and dropped them all because they wouldn't work. The closest thing I can think of is using a support ship (preplace invincible support ship, detect when player calls for support, then trigger spell), but that limits me to one "spell" per ship class, which I don't like. (I'm looking to get at least four "spells" per ship class.) I'm a new FREDder, so if there are any advanced concepts, they will need to be explained to me. Anyone who helps will be <3'd.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Detecting input in multiplayer missions is actually one of the major flaws with the system. I assume you've already noticed that key-pressed only works on the server.

Using scripting might be the answer here as it can do all the client side work for you and then simply report back to the host by altering a variable.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
You can do it with the reinforcements menu.

 

Offline Solatar

  • 211
If you were doing a single player MOD, you might even be able to change something in strings.tbl to make "Reinforcements" say like "Abilities" or something.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
That's an awesome idea.

To elaborate a bit, tie the SEXP that governs the 'spell' to the arrival of a reinforcement ship. Give that ship the name of the ability, and have the player call it in via the reinforcement menu. You can even use variables to give it a point cost, if you want to have some kind of recharging mana pool.

 

Offline Scotty

  • 1.21 gigawatts!
  • 211
  • Guns, guns, guns.
Then set the effect you want as:

When
 ---> Has-ship-arrived-delay
       ---> <name>
       ---> <delay>
 ---> And
      ---> Effect
      ---> Self-Destruct
            ---> <name>
            ---> <delay> (probably a few seconds or less)

Wow, that's an awesome idea, shuttle.

 

Offline shuttleatlantis

  • 24
  • Biophysicist
    • Biophysics: The Shattered Universe
I was considering using re-enforcements, but can see two problems that I don't know how to solve. First, how would I detect who called the re-enforcements? Second, how would you let the re-enforcements be called more than once? (I think I know how to solve the second problem - namely, by using a wing - but have no idea about the first.)

 

Offline Scotty

  • 1.21 gigawatts!
  • 211
  • Guns, guns, guns.
Well, for multi, this seems impractical, to say the least.

For single player, a "key-pressed" SEXP might work to determine what happened as well.  Reinforcements could be used, maybe by increasing the number of waves (I don't know exactly how that works) or by just creating more than one reinforcement for each effect, i.e. "<effect one> 1", "<effect one> 2," "<effect two> 2," etc., etch.

  

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Reinforcements in multi are a bit buggy.  Work fine if they are available at the start of the game but if enabled later on the client can't call them only the host. 
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline shuttleatlantis

  • 24
  • Biophysicist
    • Biophysics: The Shattered Universe
Quote
Well, for multi, this seems impractical, to say the least.
inorite? But I'm confident that I can get it working. If worst comes to worst, I can always have something like "Fires a beam cannon at each tagged enemy" or something.

@above: Thanks, good to know.

EDIT: Here's another idea. I might somehow be able to use the "is-secondary-selected" condition in combination with "get-secondary-ammo". Like, fire TAG-A to trigger spell 1, fire TAG-B to trigger spell 2, and fire TAG-C to trigger spell 3. The problem with this is that I have to give all the players ships with three secondary slots, which effectively means that everyone has to be flying Myrmidons. This is bad because I wanted to have two teams, one of which is flying Shivan ships. Any suggestions?
« Last Edit: December 07, 2009, 09:20:42 pm by shuttleatlantis »

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Modify the ships to have more than two banks.
It's simple if you know how to use PCS2 and edit tables.

 

Offline shuttleatlantis

  • 24
  • Biophysicist
    • Biophysics: The Shattered Universe
I don't want to use modding. I know how but it would be annoying to have to install a mod just to play this one mission. I'm just taking out the Shivan team and replacing them with the NTF.