Duke4.net Forums: EVENT_PREGAME - Duke4.net Forums

Jump to content

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

EVENT_PREGAME

User is online   Danukem 

  • Duke Plus Developer

#1

EVENT_PREGAME does not seem to work as advertised. The code below does nothing, for example:

onevent EVENT_PREGAME

ifvare sprite[THISACTOR].htpicnum GRENADEPROJ setactor[THISACTOR].htpicnum RPG

endevent


The point of the code was to make my GRENADEPROJ projectile have the same effects as RPG, without going through the code of every actor and adding clauses such as ifhitweapon GRENADEPROJ blah blah blah

The code above would be useless in EVENT_GAME, because by the time that event is processed, the actor's code has already been processed for that tic (including all the ifhitweapon stuff). So yeah, I thought the whole point of EVENT_PREGAME is that it was supposed to work in cases like this.
0

User is offline   Helixhorned 

  • EDuke32 Developer

#2

View PostTrooper Dan, on 17 November 2015 - 01:21 PM, said:

EVENT_PREGAME does not seem to work as advertised. The code below does nothing, for example:

onevent EVENT_PREGAME

ifvare sprite[THISACTOR].htpicnum GRENADEPROJ setactor[THISACTOR].htpicnum RPG

endevent


This is not merely a question of EVENT_PREGAME. The projectile system is not exactly trivial, so one first has to ask whether such an "injection" is expected to give the desired result. I don't know the answer to this, but...

Quote

The point of the code was to make my GRENADEPROJ projectile have the same effects as RPG, without going through the code of every actor and adding clauses such as ifhitweapon GRENADEPROJ blah blah blah

... if your plan is to make your custom GRENADEPROJ behave like the RPG projectile in every respect expect the picnum, isn't the natural approach to defineprojectile a custom one so that it does just that? This has the advantage of being purely declarative and not requiring any "real" code. Starting from this, you may then modify it according to suit your purposes (such as being affected by gravity, as I suppose). The major probem with this is that it's easier said than done: there's no compilation of the proper projectile attributes to emulate the hardcoded ones, AFAIK.

With r5435, player.c now contains two functions in sequence, A_ShootCustom() and A_ShootHardcoded(). The idea is that if you wish to find out which defineprojectile attribute values are needed to emulate a hardcoded one, you look into the latter and then try to match this up with the former (which will have proj->some_projectile_member references instead of the fixed values of A_ShootHardcoded()). Over time, one could build the mentioned compilation this way.
0

User is online   Danukem 

  • Duke Plus Developer

#3

Sorry I wasn't clear: My grenade is actually quite different from RPG, and I'm happy with that. If I wanted it to be exactly like rpg except in appearance, I would use EVENT_ANIMATESPRITES to give it a different displayed picnum.

But some of the properties of a projectile are not the projectile itself, but the effect that it has on actors. In this case, I wanted to take advantage of all the actor code that starts with "ifwasweapon RPG...", so all I wanted to do was change the htpicnum on the actors before the damage was processed. This wasn't very much trouble, but I wasn't able to use EVENT_PREGAME to do it. As it stands, I just don't know when that event would be useful.
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