Trooper 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.