Weapons that zoom using scope.

Topics regarding Scripting with Reality Factory
incenseman2003
Posts: 320
Joined: Sat Mar 11, 2006 11:41 pm

Weapons that zoom using scope.

Post by incenseman2003 »

Can someone please tell me in detail how to get a scoped weapon to zoom so that it looks like the player is looking through the scope?

Also I have a weapon that when it is fired it looks as though it goes sideways for the recoil instead of back. Is there someone that can give me some insight on this?
Patience and tolerance are the keys to the passage of knowledge. Even those that are the most knowledgeable started with many questions.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

From Hike1's FAQ's:

Q. I saw some cool screenshots of Pickles' demon game with the enhanced
infrared vision scope on a sniper's kinda rifle. How did ya do that,
Pickles?

A. There are basically twoways to do this.

1 - Define a zoom bitmap for the weapon.

2 - Use a Weapon Logic Gate to trigger an Overlay Entity.

They key is to make the image that will be used as the overlay roughly
the same 'dimensions' (not size) of the screen. For example 100 x 75
and then in the camera.ini file, set the overlaydistance setting to the
width of the image (in this case 100).

One thing to consider though, is that the overlay entity is really just
a flipbook that is always placed in front ofthe player. This means
that it can be clipped by level geometry. Anything within 100 texels
of the player will render before the overlay and won't be tinted green
if your overlay is green.
The zoom overlay of a weapon though, does not do this. You can
avoid this by making the overlaydistance setting to something that
is still within the players' bounding box.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

Here is the link to the online help. It shows how to use overlays and logic gates. If you get stuck, let us know.

http://dhost.info/realityfactory/onlinehelp/index.htm
incenseman2003
Posts: 320
Joined: Sat Mar 11, 2006 11:41 pm

Post by incenseman2003 »

I read that faq. It doesnt give alot of detail. For instance What files that hold the settings for the zoom, what lines have to be adjusted if any and how they should be adjusted and so on. I have look at alot of the demos and havent seen it in any of them. I havent seen all of them though.

Can you please give more detail?
Patience and tolerance are the keys to the passage of knowledge. Even those that are the most knowledgeable started with many questions.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

For each weapon you can define these settings. They all are in weapon.ini file.

The Online Help:
zoomamount - the amount of zoom this weapon can achieve (ie. 5x zoom) using the zoom key (Projectile weapon only)

zoomoverlay - name of bitmap placed over screen when weapon is in zoom mode (Projectile weapon only)

zoomoverlayalpha - name of alpha map used to define transparency of zoom overlay (Projectile weapon only)

allowzoommove - if true then keep in zoom mode when moving. If false the cancel zoom mode when moving. (Projectile weapon only)
So if you want to have a sniper with 10x zoom and the player has to stand still while sniping, you would set "zoomamount = 10" and "allowzoommove = false".
Pain is only psychological.
incenseman2003
Posts: 320
Joined: Sat Mar 11, 2006 11:41 pm

Post by incenseman2003 »

Thanks Juutis,

I will probably succeed with detail like that.

On another note though.

I can fire my weapon many times in the same game session and it works great. However the may crash on any shot that is fired from me or the bad guys. It is random, there isnt a certain bad guy that it happens with and I can fire many shots before game crashes. Then all of a sudden someone fire s shot and the crashes.

Has anyone heard of this issue before or does someone have any suggestions.

The RealityFactory.log has no errors and the error that pops up is the generic windows error.

The key word is "Random".

Im sooooo confused.
Patience and tolerance are the keys to the passage of knowledge. Even those that are the most knowledgeable started with many questions.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

I have not seen this issue before. Is it perhaps that you are shooting at the same time as a pawn? Is some variable set that when some attribute or such reaches zero things 'shut down'?

Try something. make a new square room. Don't even worry about textures or lighting. Drop in your pawn and the weapons, using your scripts, and see if this happens.
Steve Dilworth - Resisting change since 1965!
incenseman2003
Posts: 320
Joined: Sat Mar 11, 2006 11:41 pm

Post by incenseman2003 »

Steven8,

that was a great idea. I created the test level and added a pawn and a player and a generic weapon. I fired at the pawn and the game did not crash. I then fired at the pawn and moved the player and the game crashed. I then removed the pawn and fired the weapon at the wall. The game did not crash. I then fired the weaopn and moved the player. The game crashed. It seems that the game crashes if I move the player at the same time I fire the weapon, or right after that by less than a second. I tried this with several weaopns and got the same results.
Patience and tolerance are the keys to the passage of knowledge. Even those that are the most knowledgeable started with many questions.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

Does the log file show anything? Is there a missing animation, perhaps?
Steve Dilworth - Resisting change since 1965!
hike1
RF FAQ-Keeper
Posts: 607
Joined: Tue Jul 05, 2005 4:19 am
Contact:

Post by hike1 »

zoom is the keys plus and minus in my game,
hit options controls to see if you have zoom assigned to any keys.
incenseman2003
Posts: 320
Joined: Sat Mar 11, 2006 11:41 pm

Post by incenseman2003 »

steven8,

The log file doesn't have any errors in it after this happens. The player can move in any direction as long as he has not fired the weapon in the last half second or so, or is firing the weapon at the time he is moving. If it were a missing animation wouldn't it happen even if the player moved a certain way with or without firing the weapon?

It only happens under these conditions.

1) Weapon is fired and player moves in any direction while the sound and animation for the weapon is still going.

2) Player fires weapon while moving in any direction.

Thats the only conditions that the issue is happening under.


hike1,
zoom is the keys plus and minus in my game,
hit options controls to see if you have zoom assigned to any keys.
Is that a demo game that you are refering to?

I dont understand "hit options controls". I have searched for it and cannot find it. Is an option menu somewhere with an controls heading? Is it a file called options that I dont have? Is it something in the control.ini? I need more info please.

Thanks
Patience and tolerance are the keys to the passage of knowledge. Even those that are the most knowledgeable started with many questions.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

What Hike1 means is under the Options Menu, then Controls, to see if a key has been assigned to the zoom option.

His demo is the asylum demo. I do believe it is the one he is refering to. Go download it. it's an excellent demo.

The anims I was thinking of for your player were the shootup and/or shootdown anims, but I'm probably thinking wrong.

Is your player a scripted player, or just a regular player-player?
Steve Dilworth - Resisting change since 1965!
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

Ok, this is weird. I'm having the same issue with a scripted player. Every time I make him shoot a projectile and move at the same time the game crashes without leaving any notes to the log file...

Since I'm using scripted player it can't be the animations that cause this.

The good thing in this is that now there's two of us! You're not alone with your problem anymore. :D
Pain is only psychological.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

What you to need to do is compare your scripts. If incenseman is also using a script. Post 'em up so the other can see it.
Steve Dilworth - Resisting change since 1965!
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

Ok, I think I fixed it... at least it doesn't crash anymore. I made a projectile actor with an idle animation and then defined it in the weapon.ini.
[proj1]
type = projectile
actor = projectile1.act
rotation = 0 0 0
scale = 0.1
animation = idle
gravity = false
bounce = false
speed = 2000
lifetime = 0.1
boundingbox = 0.1
explosion = expl
actorexplosion = expl
showboth = false
bonelevel = true
shakeamount = 0
shakedecay = 0
damage = 10
altdamage = 10
explosionradius = 0
explosiondamage = 0
decal = 1
movesound = flames.wav
impactsound = flames.wav
bouncesound = flames.wav
Pain is only psychological.
Post Reply