currently i am working on my own WAD, and im having trouble with getting a bottle to act properly
for instance
basically when you press "E", it gives you a stimpack. but when you shoot it, it breaks..... BUT you can still pick it up and receive the health. <LAME
i have set the bottles special to redirect to a script that gives the player a stimpack. then removes the bottle.
i will attach a test wad containing the scripts and bottle.
-doomUACS
Bottle(Use Function+Destructable Item)
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Bottle(Use Function+Destructable Item)
- Attachments
-
bottle.wad
- Test bottle.
- (66.05 KiB) Downloaded 26 times
Last edited by doomUACS on Sat Jul 28, 2012 2:21 pm, edited 1 time in total.
-
- Posts: 57
- Joined: Sun Apr 09, 2006 12:54 pm
- Contact:
Re: Scripting Help
this works for me:
Code: Select all
#include "zcommon.acs"
script 1 (void)
if (GetActorProperty(1,APROP_health)>0)
{
GiveInventory("Stimpack", 1);
Thing_Remove(1);
}
script 2 Enter
{
SetThingSpecial(1, ACS_ExecuteAlways, 1);
}
Re: Scripting Help
Thanks so much dude, this will also help me with some other problems ive been having.
Re: Scripting Help
hmmm im wondering if i could just instead of using a script, somehow push all of this in to a decorate. using the script seems to still act very clunky, i just dont know how to incorporate the "E" pickup function in to it. does anybody know if this is possible? i will fool around with it a bit and see but any help would be much obliged.
Re: Scripting Help
If by 'E', you mean specifically key 'E', then no, you cannot do that at all. Zdoom's gamestate does not keep track raw keyboard input. You can only keep track of commands (like "use").
Re: Scripting Help
oh yeah sorry i meant USE/OPEN. the use function is possible in a decorate, just look at the switchable tech lamp.
he uses the "Activation THINGSPEC_Switch" and is doing it threw the actors special similar to what im trying to do, because using a script for every single bottle is far too tedious.
http://www.realm667.com/index.php?optio ... Itemid=199
i want something similar maybe if i incorporate what he has done with his tech lamp maybe i can get the desired effect.
he uses the "Activation THINGSPEC_Switch" and is doing it threw the actors special similar to what im trying to do, because using a script for every single bottle is far too tedious.
http://www.realm667.com/index.php?optio ... Itemid=199
i want something similar maybe if i incorporate what he has done with his tech lamp maybe i can get the desired effect.
Last edited by doomUACS on Thu Jul 26, 2012 4:28 pm, edited 1 time in total.
Re: Scripting Help
by the way i have made progress i got the bottle to act properly except for the use function.
you still have to walk over it to pick it up, but now when you shoot the bottle it spawns its death animation rather than having a death where you can still pick up the broken bottle.
heres what i did, code is very sloppy, but it works.
i will give the test wad in case anyone wants it.
you still have to walk over it to pick it up, but now when you shoot the bottle it spawns its death animation rather than having a death where you can still pick up the broken bottle.
heres what i did, code is very sloppy, but it works.
i will give the test wad in case anyone wants it.
Code: Select all
Actor Bottle : CustomInventory 20001
{
Game Doom
SpawnID 24
Health 1
Inventory.DefMaxAmount
+DONTGIB
+SOLID
+SHOOTABLE
+NOBLOOD
Obituary "$OB_BARREL"
States
{
Spawn:
BOTI A -1
Loop
Pickup:
TNT1 A 0 A_GiveInventory("Stimpack", 1)
Stop
Death:
TNT1 A 0 A_PlaySound("DSBOTBRK")
TNT1 A 0 A_SpawnItem("BottleBroken", 1)
STOP
}
}
Actor BottleBroken
{
Radius 6
Height 6
+DOOMBOUNCE //Not sure if this is needed
+DROPOFF
States
{
Spawn:
BOTI B 2
BOTI C -1
Stop
}
}
- Attachments
-
bottle.wad
- (66.02 KiB) Downloaded 14 times
Re: Scripting Help
well i nailed it. i figured out how get the use function on a pickup item, it works quite well. i did end up learning from the switchable tech lamps and i now know a lot more about actor specials.
interesting thing the "A_GiveInventory" seems to not work when a things special is activated, so i made a little work around.
i, instead used the "A_SpawnItem" which seems to work, and i just made it spawn an invisible pickup item with a large radius so that the player will always pick it up once the bottle has been activated.
so if anyone wants items that you have to press "use" to pick up and are also destructible. then this is the scripting for you, this would come in handy if someone is working on an RPG wad and wants a little more realism with their items.
interesting thing the "A_GiveInventory" seems to not work when a things special is activated, so i made a little work around.
i, instead used the "A_SpawnItem" which seems to work, and i just made it spawn an invisible pickup item with a large radius so that the player will always pick it up once the bottle has been activated.
so if anyone wants items that you have to press "use" to pick up and are also destructible. then this is the scripting for you, this would come in handy if someone is working on an RPG wad and wants a little more realism with their items.
Code: Select all
Actor Bottle : SwitchingDecoration 20001 //<-----this is the actor you need to spawn
{
Health 1
Radius 5
Height 6
+USESPECIAL
+DONTGIB
+SOLID
+SHOOTABLE
+NOBLOOD
Activation THINGSPEC_Activate
Obituary "$OB_BARREL"
States
{
Active:
BOTI A 1 A_SpawnItem("BottlePickup", 1)
Stop
Spawn:
BOTI A -1
Loop
Death:
TNT1 A 0 A_PlaySound("DSBOTBRK")
TNT1 A 0 A_SpawnItem("BottleBroken", 1)
STOP
}
}
Actor BottlePickup : Health
{
Game Doom
SpawnID 23
Radius 50
Height 20
Inventory.Amount 5
Inventory.PickupMessage "You Drank A Beer"
States
{
Spawn:
TNT1 A -1
Stop
}
}
Actor BottleBroken
{
Radius 6
Height 6
+DOOMBOUNCE //Not sure if this is needed
+DROPOFF
States
{
Spawn:
BOTI B 2
BOTI C -1
Stop
}
}
- Attachments
-
bottle.wad
- remeber test wad only works in "Doom in HEXEN".
- (66.34 KiB) Downloaded 21 times