Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


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

Posts: 140
Threads: 17
Joined: Feb 2011
Reputation: 4
#1
Working combat system !

Would it be possible to create a combatsystem and integrate (For example : Guns ) it in the game !?
Would be fucking great for Remaking some classic Horror Survival games !

Update !!!
Working script . Check out the Youtube Video ! Big thanks to Your Computer !

[video=youtube]http://youtu.be/oaZOkMXX-XU[/video]

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:26 PM by stonecutter.)
04-02-2012, 07:06 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#2
RE: Combat System !?

None that I know of... Perhaps possible in a VERY VERY restricted fashion. I would advise using another engine if you intend to use weapons.
04-02-2012, 07:47 PM
Find
stonecutter Offline
Member

Posts: 140
Threads: 17
Joined: Feb 2011
Reputation: 4
#3
RE: Combat System !?

what about a "LookAt" callback !?
For example ... everytime the player looks at an enemy the callback function will come up and asks if the player presses a button ( for example mouse1 ) ... if thats true ... we can add damage to a monster( if there is a function ) and play sounds and animations !

I think that could work if its possible to check if a button is pressed !?



We Shall Arise - Death / Grind from Bavaria
Musicvideo : http://goo.gl/HzxvLK
Facebook : http://goo.gl/9YfYCV
Free Album : http://goo.gl/sEBW2X
04-02-2012, 08:16 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#4
RE: Combat System !?

Haha, I've discussed it with another member awhile back and there MAY be a way if you're a great scripter. Experiment with it, it'd be quite a feat.

Only thing is, the HPL2 can not check key presses if I'm not mistaken. If I am, there must be a much more intricate way of scripting it.

If you're looking for damage scripts, I'm not sure if you could lower an enemy's health, but you COULD set the entity inactive or fade to smoke in one shot. (one bullet per kill, fair enough, right?)
http://wiki.frictionalgames.com/hpl2/amn..._functions
04-02-2012, 08:24 PM
Find
stonecutter Offline
Member

Posts: 140
Threads: 17
Joined: Feb 2011
Reputation: 4
#5
RE: Combat System !?

That would be possible with a counter ...
if(buttonpressed("mouse1", true){
hitCounterMonsterA++;
PlaySoundAtEntity("","Gunshot1.snt", "Player", 0, false);
PlaySoundAtEntity("","Monsterhit1.snt", "MonsterA", 0, false);
if(GetLocalVarInt("hitCounterMonsterA")==4){

SetEnemyDisabled("MonsterA, true);

}
}

Ok but it seems senseless if there is no option to check if a button is pressed. And if it were possible you have to create a function for every monster in the map ...

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-02-2012, 08:38 PM by stonecutter.)
04-02-2012, 08:37 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: Combat System !?

The closest thing to button detection is a lantern callback. I could make a quick script that could do the job.

Tutorials: From Noob to Pro
(This post was last modified: 04-02-2012, 09:23 PM by Your Computer.)
04-02-2012, 09:18 PM
Website Find
stonecutter Offline
Member

Posts: 140
Threads: 17
Joined: Feb 2011
Reputation: 4
#7
RE: Combat System !?

(04-02-2012, 09:18 PM)Your Computer Wrote: The closest thing to button detection is a lantern callback. I could make a quick script that could do the job.
Ok thats a good idea ... set lantern to mouse2
so you think of something like that ?
SetLanternLitCallback("shooting");

void shooting(string &in asParent , string &in asChild , int alState){
PlaySoundAtEntity("","Gunshot1.snt", "Player", 0, false);
SetLanternActive(false,false);//Impoortant so everytime you click mouse2 you will deactivate the lantern/Gun ,
so that then you click again you will activate it again and activate the callback !
}

so i think one more thing we need is a check if the player looks at a enemy !?



We Shall Arise - Death / Grind from Bavaria
Musicvideo : http://goo.gl/HzxvLK
Facebook : http://goo.gl/9YfYCV
Free Album : http://goo.gl/sEBW2X
04-02-2012, 09:53 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: Combat System !?

Here's my current working code:

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

void OnStart()
{
    
GiveItemFromFile("lantern""lantern.ent");

    for (
int i 1GetEntityExists("gun_target_"+i); ++i)
        
SetEntityPlayerLookAtCallback("gun_target_"+i"SetGunTarget"false);

    
SetLanternLitCallback("FireGun");
}

void SetGunTarget(string &in entityint state)
{
    
gun_target = (state == 1) ? entity "";
}

void FireGun(bool lit)
{
    if (
gun_target != "")
    {
        
SetPropActiveAndFade(gun_targetfalse1);
        
gun_target "";
        
SetMessage("Gun""Hit"1);
    }

    else
        
SetMessage("Gun""Miss"1);

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


For killing monsters, just add in FadeEnemyToSmoke where SetPropActiveAndFade is. Give any entity you want to "die" the following syntax: "gun_target_"+i.

Tutorials: From Noob to Pro
04-02-2012, 09:59 PM
Website Find
stonecutter Offline
Member

Posts: 140
Threads: 17
Joined: Feb 2011
Reputation: 4
#9
RE: Combat System !?

yeah nice work fine Smile !!! but hard to hit something ... Tongue
but thats something we can work with Tongue

What about an hitcounter ? you can put it into the "for" function : AddLocalVarInt("HitCounter_"+i+"", 0);

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-02-2012, 10:24 PM by stonecutter.)
04-02-2012, 10:16 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: Combat System !?

(04-02-2012, 10:16 PM)stonecutter Wrote: What about an hitcounter ? you can put it into the "for" function : AddLocalVarInt("HitCounter_"+i+"", 0);

A hit counter is possible. I don't think using a for loop is the right way of doing it, but i'll leave you to implement that yourself.

Tutorials: From Noob to Pro
04-02-2012, 10:34 PM
Website Find




Users browsing this thread: 3 Guest(s)