Making alternate uses for Scope/Laser/Ammo-Switch functions.

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Making alternate uses for Scope/Laser/Ammo-Switch functions.

Postby Allan » Sun Sep 17, 06 12:53 am

This hopes to teach a little about how to make your own cool functions out of the Ammo Switching, Scope, and Laser Sight functions.

First off, identifying the functions that'll be needed to be changed to edit the functionality of these functions.

First off: Scope.

    ScopeOn()
    ScopeOff()
    ScopeToggle()


and their codes are:

Code: Select all
function ScopeOn()
{
   if (bHasScope && !bZoomed && (Owner != None) && Owner.IsA('DeusExPlayer'))
   {
      // Show the Scope View
      bZoomed = True;
      RefreshScopeDisplay(DeusExPlayer(Owner), False, bZoomed);
   }
}

function ScopeOff()
{
   if (bHasScope && bZoomed && (Owner != None) && Owner.IsA('DeusExPlayer'))
   {
      bZoomed = False;
      // Hide the Scope View
      RefreshScopeDisplay(DeusExPlayer(Owner), False, bZoomed);
      //DeusExRootWindow(DeusExPlayer(Owner).rootWindow).scopeView.DeactivateView();
   }
}

simulated function ScopeToggle()
{
   if (IsInState('Idle'))
   {
      if (bHasScope && (Owner != None) && Owner.IsA('DeusExPlayer'))
      {
         if (bZoomed)
            ScopeOff();
         else
            ScopeOn();
      }
   }
}


However, you don't want a boring old scope button thingy, do you? No? Well then, hang about. I'm going to show you how to get it to do something intresting... ;) First, we strip out as much crap as possible...

Code: Select all
function ScopeOn()
{
}

function ScopeOff()
{
}

simulated function ScopeToggle()
{
   if (bHasScope)
   {
      if (bZoomed)
         ScopeOff();
      else
         ScopeOn();
   }
}


Right, that's gotten rid of everything that the original scope needs. (Note, this'll mean you can no longer use a scope, so make something decent to replace it...) Now, to make it do something cool. Hmm... ideas ideas ideas...

Well, I suppose summoning a Plasma Bolt will have to do. I can't think of anything better.

Code: Select all
function ScopeOn()
{
    Spawn(class'PlasmaBolt',Pawn(Owner),,Pawn(Owner).Location,Pawn(Owner).ViewRotation);
}

function ScopeOff()
{
    Spawn(class'PlasmaBolt',Pawn(Owner),,Pawn(Owner).Location,Pawn(Owner).ViewRotation);

}

simulated function ScopeToggle()
{
   if (bHasScope)
   {
      if (bZoomed)
         ScopeOff();
      else
         ScopeOn();
   }
}


The Pawn(Owner) parts are being used to get the location and rotation to fire the projectile at. Also, this can be used to modify the owner of a weapon in several other 'interesting' ways... Now, if you have a weapon with a scope on it, and this code in it's source, the scope will, instead of zooming in, spit out plasma bolts.

I'm going to have to add to this later/tomorrow, school work beckons to be dealt with...
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Dae » Sun Sep 17, 06 5:39 am

Good work :gj:
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby Cozmo » Sun Sep 17, 06 1:21 pm

Ooh thanks! :D
I always wanted to know how this was done, because lee protected his code i couldnt see it...
:)
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby MainMan » Sun Jan 28, 07 9:42 am

It is much cooler if you alter these directly at the source in the player class, which is what I do for the skateboard in my mod. Whilst skating, it remaps the keys (reload is heelflip, scope is kickflip, etc)
<center>ty m7
</center>
User avatar
MainMan
<i>Tru' Playa' Fer Defs</i>
 
Posts: 4655
Joined: Sun Jun 05, 05 7:38 am
Location: London, UK

Postby ~ô¿ô~Nobody~ » Sun Jan 28, 07 3:18 pm

Mainman, not everyone wants to make a whole new gametype for extending a weapon. :)
Nobody is perfect...
------------------------------
Longc[A]t wrote:I still think Dae is a russian spambot.

~[A]Daedalus~ wrote:There will be a day when my patience goes away and you, along with all who rant with you, will get banned.

ô¿ô¥[GODZ]¥NOCHANC wrote:I can ban any one I want ANY time I want. You have no rights here.
User avatar
~ô¿ô~Nobody~
Alpha
 
Posts: 2520
Joined: Fri Dec 31, 04 3:20 pm
Location: Proclarush Taonas

Postby Wasted » Sun Jan 28, 07 4:10 pm

O rly?
FFS
User avatar
Wasted
Forum Hero
 
Posts: 2861
Joined: Sun Oct 30, 05 6:29 pm
Location: 1337 14ND

Postby Allan » Sun Jan 28, 07 5:36 pm

ya rly.
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 1 guest