Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working combat system !
Author Message
stonecutter Offline
Member

Posts: 140
Joined: Feb 2011
Reputation: 4
Post: #19
RE: Combat System !?

New Update

Able to pick up bullets to increase the amount of ammo you have and they will be removed after you shoot 15 bullets !





PHP Code: (Select All)
string gun_target "";

void OnStart()
{
//Player & Items
SetSanityDrainDisabled(true);
GiveItemFromFile("lantern""lantern.ent");
//SetLanternActive(true, true);

//Variables
AddLocalVarInt("AmmoCounter"0); // Amount of munition
AddLocalVarInt("BulletCounter"0); // Counts the shooted bullets
AddLocalVarInt("MonsterSelection"0); // With this variable you select the monster you want to give damage
AddLocalVarInt("MonsterHitCounter_1"0);//Hitcounter for monster A. One for each monster

//LookAtCallbacks ..... One Callback for each enemy !
SetEntityPlayerLookAtCallback("gun_target_1""SetGunTarget_1"false); 
SetEntityPlayerLookAtCallback("gun_target_2""SetGunTarget_2"false);
SetLanternLitCallback("FireGun");
}

void SetGunTarget_1(string &in entityint state)
{
    
gun_target = (state == 1) ? entity "";
    
SetLocalVarInt("MonsterSelection"1);
}
void SetGunTarget_2(string &in entityint state)
{
    
gun_target = (state == 1) ? entity "";
    
SetLocalVarInt("MonsterSelection"2);
}
//Shooting Script
void FireGun(bool lit)
{
     if(
GetLocalVarInt("AmmoCounter")>0){ 
     if (
gun_target != "")
    {
        
//SetPropActiveAndFade(gun_target, false, 1);
        
PlaySoundAtEntity("","gun_fire.snt""Player"0false);
        
gun_target "";
        
SetMessage("Messages""Hit"1);
        
SetLocalVarInt("AmmoCounter"GetLocalVarInt("AmmoCounter")-1);
        
SetLocalVarInt("BulletCounter"GetLocalVarInt("BulletCounter")+1);
        switch( 
GetLocalVarInt("MonsterSelection") )
        {
        case 
1:
             
SetLocalVarInt("MonsterHitCounter_1"GetLocalVarInt("MonsterHitCounter_1")+1);
        break;
        case 
2:
             
SetLocalVarInt("MonsterHitCounter_2"GetLocalVarInt("MonsterHitCounter_2")+1);
        break;
        }
        for (
int i 1i<=2; ++i){
        if(
GetLocalVarInt("MonsterHitCounter_"+i)==4){
        
FadeEnemyToSmoke("gun_target_"+ifalse);
        }
        }
        if(
GetLocalVarInt("BulletCounter")==15// Remove bullets
        
{
         
SetLocalVarInt("BulletCounter",0);
         
RemoveItem("ammo_box");
        }
    }
    else
        
SetMessage("Messages""Miss"1);
        
PlaySoundAtEntity("","gun_fire.snt""Player"0false);
        
SetLocalVarInt("AmmoCounter"GetLocalVarInt("AmmoCounter")-1);
        
SetLocalVarInt("BulletCounter"GetLocalVarInt("BulletCounter")+1);
        if(
GetLocalVarInt("BulletCounter")==15// Remove bullets
        
{
         
SetLocalVarInt("BulletCounter",0);
         
RemoveItem("ammo_box");
        }
     }
     else
     
SetMessage("Messages""Empty"1);
     
PlaySoundAtEntity("","empty.snt""Player"0false);

    if (!
GetLanternActive())
    {
        
SetLanternLitCallback("");
        
SetLanternActive(truetrue);
        
SetLanternLitCallback("FireGun");
    }



//PickUpAmmo

void AmmoPickUp(string &in asEntity)
{
     
SetLocalVarInt("AmmoCounter"GetLocalVarInt("AmmoCounter")+15);
     
GiveItem("ammo_box","","ammo_box","ammo_box_cover.jpg",1);


We Shall Arise - Death / Grind from Bavaria
Musicvideo : http://goo.gl/HzxvLK
Facebook : http://goo.gl/9YfYCV
Free Album : http://goo.gl/sEBW2X
(This post was last modified: 04-03-2012 07:20 PM by stonecutter.)
04-03-2012 07:18 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Working combat system ! - stonecutter - 04-02-2012, 07:06 PM
RE: Combat System !? - Statyk - 04-02-2012, 07:47 PM
RE: Combat System !? - stonecutter - 04-02-2012, 08:16 PM
RE: Combat System !? - Statyk - 04-02-2012, 08:24 PM
RE: Combat System !? - stonecutter - 04-02-2012, 08:37 PM
RE: Combat System !? - Your Computer - 04-02-2012, 09:18 PM
RE: Combat System !? - stonecutter - 04-02-2012, 09:53 PM
RE: Combat System !? - Your Computer - 04-02-2012, 09:59 PM
RE: Combat System !? - stonecutter - 04-02-2012, 10:16 PM
RE: Combat System !? - Your Computer - 04-02-2012, 10:34 PM
RE: Combat System !? - stonecutter - 04-02-2012, 10:45 PM
RE: Combat System !? - Your Computer - 04-02-2012, 11:19 PM
RE: Combat System !? - Cranky Old Man - 04-02-2012, 11:31 PM
RE: Combat System !? - Statyk - 04-02-2012, 11:33 PM
RE: Combat System !? - Adny - 04-03-2012, 12:27 AM
RE: Combat System !? - stonecutter - 04-03-2012, 11:14 AM
RE: Combat System !? - stonecutter - 04-03-2012, 12:18 PM
RE: Combat System !? - stonecutter - 04-03-2012, 02:31 PM
RE: Combat System !? - stonecutter - 04-03-2012 07:18 PM
RE: Working combat system ! - Datguy5 - 04-03-2012, 07:42 PM
RE: Working combat system ! - stonecutter - 04-03-2012, 07:43 PM
RE: Working combat system ! - Shadowfied - 04-04-2012, 11:01 AM
RE: Working combat system ! - Kman - 04-04-2012, 11:06 AM
RE: Working combat system ! - Shadowfied - 04-04-2012, 11:08 AM
RE: Working combat system ! - stonecutter - 04-04-2012, 11:26 AM
RE: Working combat system ! - Shadowfied - 04-04-2012, 11:29 AM
RE: Working combat system ! - Kman - 04-04-2012, 11:36 AM
RE: Working combat system ! - Shadowfied - 04-04-2012, 11:40 AM
RE: Working combat system ! - stonecutter - 04-04-2012, 11:51 AM
RE: Working combat system ! - stonecutter - 04-04-2012, 09:26 PM
RE: Working combat system ! - stonecutter - 04-05-2012, 12:49 PM
RE: Working combat system ! - Datguy5 - 04-05-2012, 05:05 PM
RE: Working combat system ! - Statyk - 04-05-2012, 03:36 PM
RE: Working combat system ! - JetlinerX - 04-05-2012, 08:16 PM
RE: Working combat system ! - stonecutter - 04-05-2012, 08:36 PM
RE: Working combat system ! - stonecutter - 04-13-2012, 06:27 PM
RE: Working combat system ! - trollox - 04-13-2012, 04:52 PM
RE: Working combat system ! - DRedshot - 04-15-2012, 01:37 PM
RE: Working combat system ! - plutomaniac - 04-15-2012, 02:09 PM



User(s) browsing this thread: 1 Guest(s)