Discuss all aspects related to modding Zandronum here.
-
Hece
- Forum Regular
- Posts: 114
- Joined: Wed Jun 06, 2012 6:26 am
- Location: Phobos
#1
Post
by Hece » Sun Jun 17, 2012 6:05 am
So my point was to make a text("You can carry only one hadgun") to appear if player has a Luger already, and goes over P38 pickup. Can someone show me an example?
Code: Select all
actor SpawnerP38 : CustomInventory 21005
{
+COUNTITEM
Inventory.PickupSound "GUNPICK"
Inventory.RespawnTics 35
States
{
Spawn:
WP39 X -1
Stop
Pickup:
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("Luger", 1, "Spawn")
TNT1 A 0 A_GiveInventory("P38",1)
Stop
}
}
Thanks!
-
Konda
- Forum Regular
- Posts: 487
- Joined: Thu Jun 07, 2012 5:22 pm
#2
Post
by Konda » Sun Jun 17, 2012 7:16 am
Code: Select all
actor SpawnerP38 : CustomInventory 21005
{
+COUNTITEM
Inventory.PickupSound "GUNPICK"
Inventory.RespawnTics 35
States
{
Spawn:
WP39 X -1
Stop
Pickup:
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("Luger", 1, 2)
TNT1 A 0 A_GiveInventory("P38",1)
Stop
TNT1 A 0 A_Print("You can only carry the Luger")
Fail
}
}
Basically, it checks if a player has a Luger, and if he has, it jumps to the second next state (stop doesn't count), which is the Print state. Below that is the "Fail" which will make the pickup not disappear once a player tried to pick it up while having a Luger.
EDIT: You may have noticed that I added some spaces before each statement. I suggest you do that too for readability's sake.
Last edited by
Konda on Sun Jun 17, 2012 7:21 am, edited 1 time in total.
Code: Select all
<Synert> fuck
<Synert> plugged in my memory stick and got a bsod
-
Hece
- Forum Regular
- Posts: 114
- Joined: Wed Jun 06, 2012 6:26 am
- Location: Phobos
#3
Post
by Hece » Sun Jun 17, 2012 8:02 am
I didn't got it work :(
Last edited by
Hece on Sun Jun 17, 2012 8:15 am, edited 1 time in total.
-
Konda
- Forum Regular
- Posts: 487
- Joined: Thu Jun 07, 2012 5:22 pm
#4
Post
by Konda » Sun Jun 17, 2012 8:17 am
How does it behave? Do you just manage to pick up the weapon regardless of whether you have the Luger or not? Did you copy my code or try to write it by yourself?
Last edited by
Konda on Sun Jun 17, 2012 8:18 am, edited 1 time in total.
Code: Select all
<Synert> fuck
<Synert> plugged in my memory stick and got a bsod
-
Hece
- Forum Regular
- Posts: 114
- Joined: Wed Jun 06, 2012 6:26 am
- Location: Phobos
#5
Post
by Hece » Sun Jun 17, 2012 8:23 am
Oh, works now. Thanks a lot!
Btw what is the item(weapon) property what defines what does it drop when weapon is dropped?
If I drop luger, it would drop SpawnerLuger?
-
Konda
- Forum Regular
- Posts: 487
- Joined: Thu Jun 07, 2012 5:22 pm
#6
Post
by Konda » Sun Jun 17, 2012 8:27 am
Well, when the weapons are dropped or spawned, they enter their Spawn state.
So if you want Luger to drop SpawnLuger, do this in its spawn state:
Code: Select all
Spawn:
TNT1 A 0 //The first frame of the spawn state must not do anything
TNT1 A 0 A_SpawnItem("SpawnLuger")
stop
Last edited by
Konda on Sun Jun 17, 2012 8:32 am, edited 1 time in total.
Code: Select all
<Synert> fuck
<Synert> plugged in my memory stick and got a bsod
-
Hece
- Forum Regular
- Posts: 114
- Joined: Wed Jun 06, 2012 6:26 am
- Location: Phobos
#7
Post
by Hece » Sun Jun 17, 2012 8:47 am
Whoops, I did like you said in post #6, but now when I drop a weapon it disappears.
I tried to change A_SpawnItemEx but no effect.
Weapon Script
[spoiler]
Code: Select all
actor MP40 : Weapon 20001
{
Weapon.AmmoUse 1
Weapon.AmmoGive 50
Weapon.AmmoType "Para9mm"
AttackSound "MP40"
Scale 0.5
Obituary "%o was tickled by %k's bullets."
Inventory.Pickupmessage "MP-40!"
States
{
Ready:
MP40 A 1 A_WeaponReady
Loop
Deselect:
MP40 A 1 A_Lower
Loop
Select:
MP40 A 1 A_Raise
Loop
Fire:
MP40 A 0 A_PlaySound("MP40")
MP40 A 0 A_GunFlash
MP40 B 2 A_FireBullets(4,4,1,10)
MP40 C 2
MP40 c 0 A_ReFire
Goto Ready
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("SpawnerMP40")
stop
}
}
[/spoiler]
Spawner Script
[spoiler]
Code: Select all
actor SpawnerMP40 : CustomInventory 21003
{
+COUNTITEM
Inventory.PickupSound "GUNPICK"
Inventory.RespawnTics 35
Obituary "MP-40!"
Scale 0.5
States
{
Spawn:
MP40 X -1
Stop
Pickup:
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("Kar98", 1, 2)
TNT1 A 0 A_JumpIfInventory("FG42", 1, 2)
TNT1 A 0 A_JumpIfInventory("Panzerfaust", 1, 2)
TNT1 A 0 A_GiveInventory("MP40",1)
Stop
TNT1 A 0 A_Print("You can't carry any more weapons")
Fail
}
}
[/spoiler]
And randomspawner Script
[spoiler]
Code: Select all
actor WeaponReplacer : RandomSpawner replaces Pistol
{
DropItem "SpawnerMP40" 255 1
DropItem "SpawnerFG42" 255 1
DropItem "SpawnerKAR98" 255 1
DropItem "SpawnerPanzerfaust" 255 1
}
[/spoiler]
Last edited by
Hece on Sun Jun 17, 2012 9:35 am, edited 1 time in total.
-
ZzZombo
- Forum Regular
- Posts: 323
- Joined: Mon Jun 11, 2012 12:11 pm
- Location: Ravenholm
#8
Post
by ZzZombo » Sun Jun 17, 2012 2:49 pm
Order of lumps parsing might be problem if the items you defined are in different lumps. If your lump with MP-40 is loaded before your lump with weapon giver then engine might didn't know about latter when it is parsing the first and disregard it. It's need to be checked though.
-
Hece
- Forum Regular
- Posts: 114
- Joined: Wed Jun 06, 2012 6:26 am
- Location: Phobos
#9
Post
by Hece » Sun Jun 17, 2012 3:30 pm
So in what order should I put them into the DECORATE?
Weapon
SpwanerWeapon
Spawnrandomweapon
-
Dusk
- Developer
- Posts: 581
- Joined: Thu May 24, 2012 9:59 pm
- Location: Turku
#10
Post
by Dusk » Sun Jun 17, 2012 3:32 pm
Konda wrote:
Well, when the weapons are dropped or spawned, they enter their Spawn state.
So if you want Luger to drop SpawnLuger, do this in its spawn state:
Code: Select all
Spawn:
TNT1 A 0 //The first frame of the spawn state must not do anything
TNT1 A 0 A_SpawnItem("SpawnLuger")
stop
There's a cleaner way to do this too, leave the A_SpawnItem frame out and put "SpawnLuger" as a dropitem entry.
-
Konda
- Forum Regular
- Posts: 487
- Joined: Thu Jun 07, 2012 5:22 pm
#11
Post
by Konda » Sun Jun 17, 2012 3:52 pm
I think it's not the order of lumps. I think it's because the weapon is trying to spawn an item right when the player presses the drop weapon button. So basically, while dropping the weapon, in the zero-th tic, the weapon's and player's hitbox collide. That's fine, but since the weapon tries spawning something while it's colliding with the player's hitbox, that might mean that the item failed to spawn because it didn't have enough space to do so, due to the player's hitbox.
Dusk's solution might come handy because the way dropitem works is different than the way things are spawned. Try it.
Code: Select all
<Synert> fuck
<Synert> plugged in my memory stick and got a bsod
-
Hece
- Forum Regular
- Posts: 114
- Joined: Wed Jun 06, 2012 6:26 am
- Location: Phobos
#12
Post
by Hece » Sun Jun 17, 2012 4:15 pm
I think that this dropitem thing was the one I tried out berfor even posting here, but didn't got it work.
Shouldn't thi be OK?
Code: Select all
actor KAR98 : Weapon 20004
{
Weapon.AmmoUse 1
Weapon.AmmoGive 50
Weapon.AmmoType "7.92mm"
Obituary "%o was tickled by %k's bullets."
Inventory.Pickupmessage "Kar98!"
DropItem "SpawnerKar98"
+NOAUTOFIRE
States
{
Ready:
RIFA A 1 A_WeaponReady
Loop
Deselect:
RIFA A 1 A_Lower
Loop
Select:
RIFA A 1 A_Raise
Loop
Fire:
RIFA A 0 A_PlaySound("RIFLA")
RIFA A 0 A_GunFlash
RIFA B 3 A_FireBullets(1,1,1,50)
RIFA C 4
RIFA A 10
RIFA D 5 A_PlaySound("MAGOU", 0, 10)
RIFA E 7
RIFA F 7 A_PlaySound("MAGOU", 0, 10)
RIFA F 0 A_SpawnItemEx("Bcase2",20,1,33,0,5,5)
RIFA E 7
RIFA D 5 A_PlaySound("MAGIN", 0, 10)
Goto Ready
Spawn:
RIFA X -1
Stop
}
}
Download link. No other comments about Mod, yet
http://www.2shared.com/file/zFRUax9V/SS-Elite.html
Last edited by
Hece on Sun Jun 17, 2012 4:16 pm, edited 1 time in total.
-
Konda
- Forum Regular
- Posts: 487
- Joined: Thu Jun 07, 2012 5:22 pm
#13
Post
by Konda » Sun Jun 17, 2012 4:42 pm
Wait a sec. How did you drop the weapon? And were you standing still while doing so? Chances are, the weapon spawned right where you were, and since you didn't move, you didn't pick it up. Revert the code to my solution and try it.
Code: Select all
<Synert> fuck
<Synert> plugged in my memory stick and got a bsod
-
Hece
- Forum Regular
- Posts: 114
- Joined: Wed Jun 06, 2012 6:26 am
- Location: Phobos
#14
Post
by Hece » Sun Jun 17, 2012 6:01 pm
It also pics up additional weapons that monsters have dropped, and I have replaced original weapons with this random spawner, that spawns 4 example "SpawnerKar98", wont always work.