TShapeShifter
Junior Member
Posts: 17
Threads: 5
Joined: Jul 2014
Reputation:
0
|
Help please
Hey guys, Im new here, recently I have started creating a custom story and I was wondering if it was possible to use "GivePlayerDamage" function upon the use of an item
For example could I merge a stone hammer with a stone chipper to give me a hammer and chipper and then upon the use of the hammer and chipper receive damage? I wanted it to actually kill the player when he uses the hammer and chipper...
I would be very much apreciated if someone could help me out here (:
(This post was last modified: 07-06-2014, 05:52 PM by TShapeShifter.)
|
|
07-06-2014, 05:51 PM |
|
Neelke
Senior Member
Posts: 668
Threads: 82
Joined: Apr 2013
Reputation:
26
|
RE: Help please
void UseItemOnDeath(string &in asEntity, string &in asItem)
{
GivePlayerDamage(100.0f, "BloodSplat", true, true);
}
void OnStart()
{
AddUseItemCallback("useitemdeath", "THEITEM", "THEENTITY", "UseItemOnDeath", false);
}
Mean something like this?
Derp.
|
|
07-06-2014, 06:04 PM |
|
TShapeShifter
Junior Member
Posts: 17
Threads: 5
Joined: Jul 2014
Reputation:
0
|
RE: Help please
(07-06-2014, 06:04 PM)Neelke Wrote: void UseItemOnDeath(string &in asEntity, string &in asItem)
{
GivePlayerDamage(100.0f, "BloodSplat", true, true);
}
void OnStart()
{
AddUseItemCallback("useitemdeath", "THEITEM", "THEENTITY", "UseItemOnDeath", false);
}
Mean something like this?
I tried something like that, only problem is I dont want the player to die when he uses the item on something I wanted the player to die when he selects the item (like a reversed health potion, instead of giving life, it takes it away)
Any ideas?
|
|
07-06-2014, 06:13 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Help please
Perhaps if you make your own custom health potion item with the icon of the hammer/chipper, you can possibly run a script either from the inventory.hps or the level/global one. I'm unsure if specifying the health potion as giving -100 health will kill the player, but it's worth a try.
|
|
07-06-2014, 06:16 PM |
|
TShapeShifter
Junior Member
Posts: 17
Threads: 5
Joined: Jul 2014
Reputation:
0
|
RE: Help please
(07-06-2014, 06:16 PM)Mudbill Wrote: Perhaps if you make your own custom health potion item with the icon of the hammer/chipper, you can possibly run a script either from the inventory.hps or the level/global one. I'm unsure if specifying the health potion as giving -100 health will kill the player, but it's worth a try.
Thats actually a good thought, tried that one too, it does kill the player but since its a health potion it can only be used if the player health is below 100, it cannot be used at full health... :/ Perhaps there is a file somewhere specifiyng that a health potion can only be used below full health and maybe I could change that? o:
|
|
07-06-2014, 06:24 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Help please
Maybe you can set a check that just automatically sets the player's health to 99?
SetPlayerHealth(99.0f);
|
|
07-06-2014, 07:02 PM |
|
TShapeShifter
Junior Member
Posts: 17
Threads: 5
Joined: Jul 2014
Reputation:
0
|
RE: Help please
(07-06-2014, 07:02 PM)Mudbill Wrote: Maybe you can set a check that just automatically sets the player's health to 99?
SetPlayerHealth(99.0f);
Hmmmm, that might do it... Use like a script area right? But that still leaves a problem... How do I transform a stone hammer and a chipper into a health potion? It automatically creates a Hammer and Chipper no matter what script I write...
(This post was last modified: 07-06-2014, 08:05 PM by TShapeShifter.)
|
|
07-06-2014, 07:56 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Help please
In your inventory.hps file, you should be able to create any item in the combine callback. Try to post your script if you can't figure it out.
|
|
07-06-2014, 08:56 PM |
|
TShapeShifter
Junior Member
Posts: 17
Threads: 5
Joined: Jul 2014
Reputation:
0
|
RE: Help please
(07-06-2014, 08:56 PM)Mudbill Wrote: In your inventory.hps file, you should be able to create any item in the combine callback. Try to post your script if you can't figure it out.
I have actually just finished viewing one of your videos (: But it still turns into a hammer and chipper, here is my inventory.hps:
void OnGameStart()
{
AddCombineCallback("", "stone_hammer_1", "stone_chipper_1", "PotionHealth", true);
}
void PotionHealth(string &in asitemA, string &in asitemB)
{
RemoveItem(asitemA);
RemoveItem(asitemB);
GiveSanityBoost();
PlayGuiSound("pick_potion", 1.0f);
GiveItem("potion_health", "potion_health", "HammerAndChipper", "potion_health.tga", 1);
}
|
|
07-06-2014, 09:27 PM |
|
|