stonecutter
Member
Posts: 140
Threads: 17
Joined: Feb 2011
Reputation:
4
|
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]
(This post was last modified: 04-03-2012, 07:26 PM by stonecutter.)
|
|
04-02-2012, 07:06 PM |
|
Statyk
Schrödinger's Mod
Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation:
241
|
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 |
|
stonecutter
Member
Posts: 140
Threads: 17
Joined: Feb 2011
Reputation:
4
|
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 !?
|
|
04-02-2012, 08:16 PM |
|
Statyk
Schrödinger's Mod
Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation:
241
|
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 |
|
stonecutter
Member
Posts: 140
Threads: 17
Joined: Feb 2011
Reputation:
4
|
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 ...
(This post was last modified: 04-02-2012, 08:38 PM by stonecutter.)
|
|
04-02-2012, 08:37 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Combat System !?
The closest thing to button detection is a lantern callback. I could make a quick script that could do the job.
(This post was last modified: 04-02-2012, 09:23 PM by Your Computer.)
|
|
04-02-2012, 09:18 PM |
|
stonecutter
Member
Posts: 140
Threads: 17
Joined: Feb 2011
Reputation:
4
|
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 !?
|
|
04-02-2012, 09:53 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Combat System !?
Here's my current working code:
string gun_target = "";
void OnStart() { GiveItemFromFile("lantern", "lantern.ent");
for (int i = 1; GetEntityExists("gun_target_"+i); ++i) SetEntityPlayerLookAtCallback("gun_target_"+i, "SetGunTarget", false);
SetLanternLitCallback("FireGun"); }
void SetGunTarget(string &in entity, int state) { gun_target = (state == 1) ? entity : ""; }
void FireGun(bool lit) { if (gun_target != "") { SetPropActiveAndFade(gun_target, false, 1); gun_target = ""; SetMessage("Gun", "Hit", 1); }
else SetMessage("Gun", "Miss", 1);
if (!GetLanternActive()) { SetLanternLitCallback(""); SetLanternActive(true, true); 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.
|
|
04-02-2012, 09:59 PM |
|
stonecutter
Member
Posts: 140
Threads: 17
Joined: Feb 2011
Reputation:
4
|
RE: Combat System !?
yeah nice work fine !!! but hard to hit something ...
but thats something we can work with
What about an hitcounter ? you can put it into the "for" function : AddLocalVarInt("HitCounter_"+i+"", 0);
(This post was last modified: 04-02-2012, 10:24 PM by stonecutter.)
|
|
04-02-2012, 10:16 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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.
|
|
04-02-2012, 10:34 PM |
|
|