MantisBT - Zandronum
View Issue Details
0002849Zandronum[All Projects] Bugpublic2016-10-02 20:362017-02-07 18:06
fr-blood 
 
normalminoralways
closedno change required 
MicrosoftWindowsXP/Vista/7
3.0-beta 
3.0 
0002849: Something wrong with SetWeapon() online.
Hellow, so in my project I've added a custom hotkey and when the player press it, a script will select a "handgrenade" weapon, launch the grenade then get try to get the old weapon that the player had before using the grenade.

I managed to make it works, but here the problem is that the grenade is not spawned online, all the weapon animation will be here the ammo will be used but the grenade won't be launched.
Here is a video link when you can see the result online and then offline.

'https://www.youtube.com/watch?v=6_xzkfzrq4c&feature=youtu.be [^]'

And some informations about the hotkey and the script.

In MENUDEF: 'Control "Launch Grenade", "Puke -150 1"'
In ACS:
'{// Hot Keys Actions
str OldWeapon0 = GetWeapon();
else if(Typ == 1 && CheckInventory("Busy") == 0 && ACS_NamedExecuteWithResult("Mech Check",0,0,0,0) == 0)
{// Launch Grenade
    if(CheckInventory("FragGrenadeAmmo") > 0 && CheckInventory("SelectedFragGrenade") == 1 && SpecialWeapon() == FALSE)
    {
        GiveInventory("HandFragGrenade",1);SetWeapon("HandFragGrenade");GiveInventory("Busy",1);
        while(CheckInventory("Busy") == 1)delay(1);SetWeapon(OldWeapon0);
    }
    else if(CheckInventory("FlashBangAmmo") > 0 && CheckInventory("SelectedFlashBang") == 1 && SpecialWeapon() == FALSE)
    {
        GiveInventory("HandFlashBang",1);SetWeapon("HandFlashBang");GiveInventory("Busy",1);
        while(CheckInventory("Busy") == 1)delay(1);SetWeapon(OldWeapon0);
    }
    else if(CheckInventory("PlasmaGrenadeAmmo") > 0 && CheckInventory("SelectedPlasmaGrenade") == 1 && SpecialWeapon() == FALSE)
    {
        GiveInventory("HandPlasmaGrenade",1);SetWeapon("HandPlasmaGrenade");GiveInventory("Busy",1);
        while(CheckInventory("Busy") == 1)delay(1);SetWeapon(OldWeapon0);
    }
    else if(CheckInventory("FlyingGrenadeAmmo") > 0 && CheckInventory("SelectedFlyingGrenade") == 1 && SpecialWeapon() == FALSE)
    {
        GiveInventory("HandFlyingGrenade",1);SetWeapon("HandFlyingGrenade");GiveInventory("Busy",1);
        while(CheckInventory("Busy") == 1)delay(1);SetWeapon(OldWeapon0);
    }
    else if(CheckInventory("BouncingBettyAmmo") > 0 && CheckInventory("SelectedBettyMine") == 1 && SpecialWeapon() == FALSE)
    {
        GiveInventory("HandBouncingBetty",1);SetWeapon("HandBouncingBetty");GiveInventory("Busy",1);
        while(CheckInventory("Busy") == 1)delay(1);SetWeapon(OldWeapon0);
    }
    else if(CheckInventory("IncendiaryGrenadeAmmo") > 0 && CheckInventory("SelectedIncendiaryGrenade") == 1 && SpecialWeapon() == FALSE)
    {
        GiveInventory("HandIncendiaryGrenade",1);SetWeapon("HandIncendiaryGrenade");GiveInventory("Busy",1);
        while(CheckInventory("Busy") == 1)delay(1);SetWeapon(OldWeapon0);
    }
    else if(CheckInventory("TimedGrenadeAmmo") > 0 && CheckInventory("SelectedTimedGrenade") == 1 && SpecialWeapon() == FALSE)
    {
        GiveInventory("HandTimedGrenade",1);SetWeapon("HandTimedGrenade");GiveInventory("Busy",1);
        while(CheckInventory("Busy") == 1)delay(1);SetWeapon(OldWeapon0);
    }
}
}'
No tags attached.
? setweapontest.wad (272,593) 2016-10-04 09:44
/tracker/file_download.php?file_id=1900&type=bug
? hotkeyinventorytest.pk3 (4,015) 2017-02-06 17:59
/tracker/file_download.php?file_id=2022&type=bug
Issue History
2016-10-02 20:36fr-bloodNew Issue
2016-10-02 20:40Edward-sanNote Added: 0015737
2016-10-02 20:40Edward-sanStatusnew => feedback
2016-10-03 04:10fr-bloodNote Added: 0015739
2016-10-03 04:10fr-bloodStatusfeedback => new
2016-10-03 14:06Torr SamahoNote Added: 0015744
2016-10-04 09:44fr-bloodFile Added: setweapontest.wad
2016-10-04 09:48fr-bloodNote Added: 0015752
2016-10-04 18:22Torr SamahoNote Added: 0015757
2016-11-29 20:39Torr SamahoStatusnew => feedback
2016-12-24 22:41DuskTarget Version => 3.0
2017-02-01 22:17fr-bloodNote Added: 0016747
2017-02-01 22:17fr-bloodStatusfeedback => new
2017-02-05 14:15Torr SamahoNote Added: 0016753
2017-02-05 14:16Torr SamahoStatusnew => feedback
2017-02-06 17:58fr-bloodNote Added: 0016782
2017-02-06 17:58fr-bloodStatusfeedback => new
2017-02-06 17:59fr-bloodFile Added: hotkeyinventorytest.pk3
2017-02-07 12:57fr-bloodNote Added: 0016812
2017-02-07 18:06DuskStatusnew => closed
2017-02-07 18:06DuskResolutionopen => no change required

Notes
(0015737)
Edward-san   
2016-10-02 20:40   
We can't help without a minimal example wad.
(0015739)
fr-blood   
2016-10-03 04:10   
I can give you my project:'https://www.dropbox.com/s/4quy7403zylvl55/afterdoom.pk3?dl=0 [^]'

The script is number 150 inside PART1.acs.

You just have set the custom controls in "After Doom Options", then launch a grenade both offline and online to see the difference.
(0015744)
Torr Samaho   
2016-10-03 14:06   
Please try to boil this down to a minimal example wad.
(0015752)
fr-blood   
2016-10-04 09:48   
I've managed to copy past the important part of the code, but here it is somehow working online, I really don't know from where is the problem then.

But you got the idea here:
Set a key for the bomb in custom controls
start a map you've got an assault rifle, then press the key and the player will launch an imp ball which will work both online and offline here.

In After Doom the scripts are the same, the player is able to make a lots of actions that way but here only the weapon animation will work the sound too, but nothing from A_CustomMissile or A_SpawnItemEx.
(0015757)
Torr Samaho   
2016-10-04 18:22   
Quote from fr-blood

I've managed to copy past the important part of the code, but here it is somehow working online, I really don't know from where is the problem then.

This indicates that the problem is something else. Without a minimal example wad it's not really feasible for us to debug this. One way to create the minimal example is to remove things from your wad till the problem disappears.
(0016747)
fr-blood   
2017-02-01 22:17   
Well it looks like that the problem is not from SetWeapon() finaly.

It's something else, any action coming from my custom hotkeys doesn't really work online(the grenade won't spawn, or a powerup won't be given when it's supposed to).
(0016753)
Torr Samaho   
2017-02-05 14:15   
Any idea what could be the problem? Unfortunately, I have not enough information to fix this yet.
(0016782)
fr-blood   
2017-02-06 17:58   
I've tried many times to make a smaller .pk3 deleting all the stuff which wasn't included in the script in my opinion but without succes, each time it's working fine both online/offline.

I've tested my project by setting the special hotkeys from KEYCONF then MENUDEF and in the both situation the bug happen online. So I guess the problem is not from the custom hotkey option.

I'm still uploading the last test wad that I created it has normaly all the script included in the special actions.
(0016812)
fr-blood   
2017-02-07 12:57   
Alright I found the problem it wasn't SetWeapon() or anything else.
It happened because of ZACompatFlags: CLient Side Scripts (NET) [1].
So we can't tell that it's a bug but a big mistake made by me.

The ticked can be closed.