A few scripting questions:all who answer get a cookie!

Topics regarding Scripting with Reality Factory
Post Reply
matthiasdeo
Posts: 3
Joined: Thu Dec 18, 2008 3:30 pm

A few scripting questions:all who answer get a cookie!

Post by matthiasdeo »

Let's get the introductions out of the way shall we?

I'm Matthias and this is my first post on the forums.Ive been using rf for a while(a month or so) and have found it to be a very versatile engine,especialy once you get into the source code.

I have a fair experience of c++ but find it a bit of a pain in the ass which is my main reason for choosing rf.I have alot of experience scripting in GML and a bit scripting in LUA.I've never used simkin but hope to become fairly adept at it.

Lately I've been playing a lot of Bioshock (great game) and have decided to make a game with similiar gameplay,obviously a couple of questions popped up.

The reason for me posting all my questions here is because im sure you dont wan't a noob filling up all your forum space.

Question one: Bio shock style plasmid/weapon switching
for those of you who havent played the game it involves four buttons,I will tell you how I would like it to work(slightly different from the game) im using scripted weapons by the way(pawns)

If you press the key "1" and you are wielding a gun it switches your gun to your currently equiped plasmid(super power).If you press the key "1" while you are wielding a plasmid it cycles through your available plasmids.

If you press the key "2" and you are wielding a plasmid it switches your plasmid to your currently equiped gun.If you press the key "2" while you are wielding a gun it cycles through your available guns.

If you press the left mouse button while wielding a gun it switches your gun to your currently equiped plasmid.If you press the left mouse button while wielding a plasmid it fires.

If you press the right mouse button while wielding a plasmid it switches your plasmid to your currently equiped gun.If you press the right mouse button while wielding a gun it fires.

Simple eh?

Question two
Can you use an image instead of a 3d model for a weapon in fps view?

Question 3
How would you go about making a weapon which "fires" a bolt of lightning,and has a set ammo and reload time?

Question 4
Can the pause menu be completely different from the intro menu,ive already done this through source code programming but want to know if there is an easier way

I apologize in advance for having not RTFM but im kind of just reffering to it when i need as simkin seems fairly similiar to other scripting languages.

Regards Matthias De Oliveira

P.S. for what its worth any one who answers usefully will be in the credits of my game,that is if it ever gets done.... :roll:

COOKIES FOR ALLLLLL!!!!
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: A few scripting questions:all who answer get a cookie!

Post by Juutis »

Sweet, cookies! I love cookies. Especially those with chocolate chips in them. Can I have one (or even more!) of those if I answer your question really really really well?

1.) Depends a little on how your scripted weapons work. I assume you have two main orders: One for running the gun stuff and one for the plasmid stuff. So basically you're just going to check if the keys are pressed and then switch to run the other order or shoot the weapon. Something like:

Code: Select all

run_gun [ ()
{
     if(IsKeyDown(1) or lbutton_pressed)
     {
          think = "run_plasmid";
     }
     if(IsKeyDown(2))
     {
          //change the gun, for example
          gun = gun + 1;
     }
     if(rbutton_pressed)
     {
          think = "fire_gun";
     }

     //rest of the order...

} ]

run_plasmid [ ()
{
     if(IsKeyDown(1))
     {
          plasmid = plasmid + 1;
     }
     if(IsKeyDown(2) or rbutton_pressed)
     {
          think = "run_gun";
     }
     if(lbutton_pressed)
     {
          think = "fire_plasmid";
     }

     //rest of the order...

} ]
That's an extremely simplified example but I think you can get the idea.

2.) Yeah, I suppose so. Check the FlipBook entity and the DrawFlipBookImage command in the manual.

3.) I suppose the hardest part would be making the effect. You can shoot a high speed projectile that damages whatever it hits with a special damage type. Then script the enemy pawns to react to that damage type in certain way. For the visual effect I'd suggest reading the Effect.ini section in the manual, and especially the definition for the Bolt effect.

4.) Without touching the source, no, I don't think so.



I hope I shed some light into things instead of creating a motherload of new questions.

Welcome to the forums. :)
Pain is only psychological.
matthiasdeo
Posts: 3
Joined: Thu Dec 18, 2008 3:30 pm

Re: A few scripting questions:all who answer get a cookie!

Post by matthiasdeo »

Thanks juutis,that helped alot :D Your answer to question was really really indepth! I didn't expect anyone to answer with an example of code! awsome that was really usefull.

So the hard part in making a lightning bolt projectile would be the effect...that should be fun! I was thinking of rotating the lightning bolt entity in the demo and having that apear infront of the screen in the bullets trajectory to make it look like i was "shooting" lightning.

On a completely different note,I'm a big fan of your game Nirhis,the ai is really good and I must say you kept me hooked till the end of the game! :)


I am proud to present you with the nobel cookie prize
*Hands over giant cyber cookie*
RECIEVE YOUR PRIZE
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: A few scripting questions:all who answer get a cookie!

Post by Juutis »

Boy, oh boy! Now that's what I call a cookie! :lol:

Glad I could help.
On a completely different note,I'm a big fan of your game Nirhis,the ai is really good and I must say you kept me hooked till the end of the game!
Thanks, I'm always pleased to meet new people that like my game. :)
Sadly, I might stop working on it and wait for RF2. At this pace, I'm not gonna finish the full game before RF2 is released so I might as well take my time and prepare the game while RF2 is in development. Dunno yet what I'm gonna do, exactly. Hopefully I have made up my mind after the Christmas.
Pain is only psychological.
Post Reply