ZDaemon Forum Index ZDaemon
Client/Server DOOM
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[ACS] SetWeapon strangeness with Fist, Chainsaw and Pistol.

 
Post new topic   Reply to topic    ZDaemon Forum Index -> Rejected Bugs
View previous topic :: View next topic  
Author Message
Maikl_Russia
has entered the game!


Joined: 18 Jul 2005
Location: RU

PostPosted: Sun Dec 06, 2015 9:08 am    Post subject: [ACS] SetWeapon strangeness with Fist, Chainsaw and Pistol. Reply with quote

As usually SetWeapon_test. ACS will save in array all info about Player's ammo and weapons when player dies.

The strangeness manifested at Player spawn/respawn moment.
In Zdoom SetWeapon works fine with any weapon.

In ZDaemon single mode:
    1) When player joins the game he has fist and pistol. Let's change active weapon to fist. Then kill the player (by trying opening the door or going to nukage). After respawn the active weapon of player is fist. It is ok. Now select pistol, and die again. We expect after respawn the same active weapon: pistol. BUT after respawn the active weapon of player will be fist... Hmmmmmmmmm... It is not ok. Sad
    2) Now let player picks up a chainsaw. When player will die with fist (or chainsaw) he gets the same weapon after respawn (fist or chainsaw). But if active weapon was the pistol - after respawn player gets chainsaw... Hmmmmm again.
    3) Restore all other weapons are ok (like in zdoom).

In ZDaemon client/server mode:
    1) Join the game, select fist, die and respawn. The result will be very strange: CheckWeapon will show us that we have active weapon - fist, but in real we will have active weapon - pistol. Shocked Furthermore: if we'll make shot from pistol CheckWeapon right away will show us the right active weapon - pistol. It is not ok. Now select pistol, die and respawn. The result will be the same: in real - pistol, via CheckWeapon - fist. But after a little delay (~1 sec) CheckWeapon will show us the proper active weapon - pistol.
    2) Pick up chainsaw. Change active weapon to fist, die and respawn. We will get very interesting result: CheckWeapon will show us - chainsaw, in real we will have pistol, after ~1 sec pistol will be changed to fist and CheckWeapon will show fist too. If we will die with chainsaw, after respawn the result will be: CheckWeapon will show us - chainsaw, in real we will have pistol, after shot CheckWeapon will show us pistol too. Furthermore: if we'll not shoot but change weapon to fist (by number 1) then CheckWeapon will show us - fist, in real will be chainsaw. If we continue change weapon to fist or chainsaw CheckWeapon will show us wrong active weapon: fist - when we have chainsaw and vise versa. When we change fist/chainsaw by mousewheel - no such bug. And finally let's die with pistol. The result will: in real - pistol, via CheckWeapon - fist, but after a little delay (~1 sec) CheckWeapon will show us the proper active weapon - pistol.
    3) Let's pick up next weapon - Shotgun/RocketLauncher/BFG900/etc. The restore of such weapons will be like fist restore in previous paragraph (2): after respawn, CheckWeapon will show us - chainsaw, in real we have pistol, after ~1 sec pistol will be changed to saved weapon and CheckWeapon will show it too. The same behavior is when player dies with fist. Now let's die with chainsaw. The result is: CheckWeapon - chainsaw, in real - pistol, after delay (~1 sec) pistol will be changed to weapon from last use GiveInventory(weapon), but CheckWeapon still return - chainsaw until shot or weapon change. And finally let's die with pistol. We get such result after respawn: CheckWeapon - chainsaw, in real - pistol, after delay (~1 sec) pistol will be changed to weapon from last use GiveInventory(weapon), but CheckWeapon will return now - pistol until shot or weapon change. When we have not a chainsaw, CheckWeapon will show us fist instead of chainsaw.
Back to top
View user's profile Send private message
Chimila
On a Rampage!


Joined: 05 Dec 2013

PostPosted: Fri Dec 11, 2015 5:19 am    Post subject: Re: [ACS] SetWeapon strangeness with Fist, Chainsaw and Pist Reply with quote

me trying to understand this

Back to top
View user's profile Send private message
Maikl_Russia
has entered the game!


Joined: 18 Jul 2005
Location: RU

PostPosted: Sat Dec 12, 2015 8:48 pm    Post subject: Reply with quote

Better to try once than read a hundred times.
Back to top
View user's profile Send private message
Maikl_Russia
has entered the game!


Joined: 18 Jul 2005
Location: RU

PostPosted: Wed Dec 30, 2015 9:03 am    Post subject: Reply with quote

Btw, By-zero found, if in Respawn script we will use ClearInventory() before any SetWeapon/GiveInventory/etc then weapon change via SetWeapon works properly. Exclamation
Back to top
View user's profile Send private message
Krawa
There is a limit


Joined: 23 Nov 2008
Location: #SDA

PostPosted: Fri Oct 05, 2018 9:33 pm    Post subject: Reply with quote

Demo wad mirror links:
http://rgho.st/8d5sCNrpX
http://85.214.149.120/demowads/SetWeapon_test.wad
Back to top
View user's profile Send private message Visit poster's website
Krawa
There is a limit


Joined: 23 Nov 2008
Location: #SDA

PostPosted: Wed Oct 10, 2018 8:30 pm    Post subject: Reply with quote

Yeah, ClearInventory() helps and fixes all problems.

I think the problem with the pistol was that the engine spawned the player with pistol and there is no reason to change to pistol again.

Online it seemed the engine restored all weapon and ammo and ended with the last added weapon.
SetWeapon while all this happened seems to be ignored.

Also changed checking if the player is alive. GetPlayerInfo with PLAYERINFO_HEALTH is ZD only and needs "#include "zdaemon.acs" (and correct settings) to get compiled.
Code:

from: While GetPlayerInfo(PlayerNumber(), PLAYERINFO_HEALTH) > 0)
to:   While (GetActorProperty(0, APROP_Health) > 0)


Demo wad:
http://85.214.149.120/demowads/SetWeapon_test1.wad
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    ZDaemon Forum Index -> Rejected Bugs All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group