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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help please
TShapeShifter Offline
Junior Member

Posts: 17
Threads: 5
Joined: Jul 2014
Reputation: 0
#1
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
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#2
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
Find
TShapeShifter Offline
Junior Member

Posts: 17
Threads: 5
Joined: Jul 2014
Reputation: 0
#3
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? Confused
07-06-2014, 06:13 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
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
Find
TShapeShifter Offline
Junior Member

Posts: 17
Threads: 5
Joined: Jul 2014
Reputation: 0
#5
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
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
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
Find
TShapeShifter Offline
Junior Member

Posts: 17
Threads: 5
Joined: Jul 2014
Reputation: 0
#7
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
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#8
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
Find
TShapeShifter Offline
Junior Member

Posts: 17
Threads: 5
Joined: Jul 2014
Reputation: 0
#9
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
Find




Users browsing this thread: 1 Guest(s)