Duke4.net Forums: [Help] Trying to cancel the "Alternative Weapon"'s effect - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Help] Trying to cancel the "Alternative Weapon"'s effect

User is offline   Seb Luca 

#1

Hello.

I'm using the Expander's weapon object to contain en new weapon on slot #9.
Sadly, it seems to exist a hardcoded rule which triggers the "next weapon" function when the 9 key is then pressed :lol:

I tried to prevent it like this, but without success:

onevent EVENT_ALTWEAPON setvar RETURN -1 endevent


In addition, this unwanted effect also disrupts the "Next" and "Previous" Weapon functions :lol: The scrolling bypasses weapon 9, or sends a weapon upstream.

Do you have a solution for the "Expander" weapon to be used as a normal weapon, and not an alternative one ?

Thank you :)


0

User is online   Danukem 

  • Duke Plus Developer

#2

I'm not sure what's going on.

The ALTWEAPON function is a new one unique to Eduke32. It's not triggered by pressing 9 unless you have specifically assigned that key to it.

When I have the expander selected and then press 9, it selects the tripbomb (the weapon on slot 9), which seems correct.

Are you trying to get rid of the laser tripbbomb and put the expander on weapon slot 9?
0

User is offline   Seb Luca 

#3

No, no, that's not what I meant :lol: Sorry !
It goes without saying that I assigned the Expander to button 9 beforehand. But something in the background prevents that from happening correctly, where I had no problem when I reprogrammed the Shrinker, Pipebombs and Freezthrower weapons.
0

User is online   Danukem 

  • Duke Plus Developer

#4

View PostSeb Luca, on 22 December 2019 - 03:43 AM, said:

It goes without saying that I assigned the Expander to button 9 beforehand. But something in the background prevents that from happening correctly, where I had no problem when I reprogrammed the Shrinker, Pipebombs and Freezthrower weapons.


What code are you using to assign the Expander to button 9?
0

User is offline   Seb Luca 

#5

View PostTrooper Dan, on 22 December 2019 - 03:47 AM, said:

What code are you using to assign the Expander to button 9?

onevent EVENT_WEAPKEY9
  
  ifvare WEAPON GROW_WEAPON   setvar RETURN -1
  else ifvarg player[THISACTOR].gotweapon GROW_WEAPON 0   setvar RETURN GROW_WEAPON
  else ifvarl player[THISACTOR].gotweapon GROW_WEAPON 1   setvar RETURN -1
  
endevent


Here you are
0

User is online   Danukem 

  • Duke Plus Developer

#6

That is odd. I haven't done a full investigation, but it's acting just like you said, as if setting RETURN to GROW_WEAPON is triggering the NEXTWEAPON function instead of setting it to the specified weapon.
1

User is offline   Seb Luca 

#7

I am honored that you took the time to test! :lol:

Yes, it seems to me that it is managed in hardcode, and I am embarrassed not to be able to change that. :)

Also, I added a secondary shot to my weapon, with an ammo quota managed via a variable, but it's impossible to prevent the weapon from being changed if it runs out of main bullets even while it still has secondary ammunition.

We arrive here in the limitations that the game sometimes imposes, it's not cool ... I will try to find a way to exploit this weapon as a special event, failing to be able to join it to the current arsenal. Posted Image


0

User is online   Danukem 

  • Duke Plus Developer

#8

All of these issues are fixable, but the best approach is to go all-in. Rather than try to trick the game into switching to a different weapon, change all the weapon vars on the tripbomb slot to make it act just like the expander, starting with WORKSLIKE and going all the way down the list:

https://wiki.eduke32...efined_gamevars

I can guarantee that otherwise you are going to keep having problems with weapon switching, even if you work out the WEAPKEY9 problem.

The ammo thing might require you to do some HUD coding. One approach is to prevent the player from firing when they only have 1 ammo. But, make the display show one less ammo than you actually have, so when you have 1 left, it shows 0 (which is effectively true if you can't fire the last shot).
2

User is offline   Seb Luca 

#9

Quote

One approach is to prevent the player from firing when they only have 1 ammo. But, make the display show one less ammo than you actually have, so when you have 1 left, it shows 0 (which is effectively true if you can't fire the last shot).

Ha ha, we thought the same! :) I also considered this solution, equaly that of canceling the display of the official number of main ammunition to manage the display myself via a variable. But unfortunately I do not know the way to prevent this hardcoded display, or to modify it :)


For the rest, concerning the tripbomb: thank you for the suggestion :lol:
Saddly, I did never find how to modify the weapon use animations (the player's hands in the foreground). The tripbomb display, as it is constructed, is not out of date with my gun :lol:
Does any one know how to ?



This post has been edited by Seb Luca: 22 December 2019 - 02:10 PM

0

User is offline   Seb Luca 

#10

Quote

the tripbomb slot to make it act just like the expander, starting with WORKSLIKE and going all the way down the list

I had misunderstood this passage. I had forgotten that a simple "Workslike 11" would be enough to reproduce the animation of the Expander, and that I should not reprogram an animation of weapon in the process of shooting to replace the hands holding the Tripbomb. Posted Image

It works perfectly. A big thank you Dan, and I wish you happy holidays :lol:

Closed subject, Thank you Duke4.



This post has been edited by Seb Luca: 23 December 2019 - 01:01 AM

1

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#11

In the weapon events, RETURN do not equal the weapon ID, but the weapon input.

The inputs are:

0-9: Keys 1-10
10: Previous weapon
11: Next weapon
12: Alternate weapon
13: Last used weapon
0

User is offline   Seb Luca 

#12

Thanks man, but the problem is already solved :)

Everything works perfectly, except for a very small defect that I still have to solve:

I used the variable "setplayer[THISACTOR].weaponswitch" so that the weapon remains in hand when the main ammunition is empty but there remains secondary fire.
If the weapon is emptied of any ammunition, but the last bullets fired are that of secondary fire, the weapon is not automatically changed.
This comes from the fact that secondary ammunition depends on a CON variable, and not on the hardcoded one which triggers the change of weapon if it is zero.

I should be able to execute this event with a function call, or something like that. But I don't know if it exists :lol:

Merry Christmas !



This post has been edited by Seb Luca: 24 December 2019 - 12:15 AM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options