View Issue Details

IDProjectCategoryView StatusLast Update
0002520The Dark ModCodingpublic27.10.2011 05:16
ReporterSpringheel Assigned Togreebo  
PrioritylowSeveritynormalReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionTDM 1.03 
Target VersionTDM 1.04Fixed in VersionTDM 1.04 
Summary0002520: Request: Random def_projectile
DescriptionIs it possible to treat def_projectiles the way animations work, allowing for several options and the engine picks randomly?

For example:

"def_projectile1" "rock"
"def_projectile2" "knife"

etc.

Not a big deal, but it would be nice to allow characters to randomize what they throw, and for mages to 'cast' different kinds of spells.

TagsNo tags attached.

Activities

Springheel

Springheel

12.01.2011 13:59

administrator   ~0003443

Last edited: 12.01.2011 14:00

More difficult to do (probably) but more flexible would be to allow the animation to define the def_projectile it uses. That way a mage could have different animations that cast different projectiles, and the code would just pick randomly from the animation list as it currently does.

Something like this:

anim ranged_attack2 throw_knife.md5anim
{ frame 10 launch_missile atdm:knife_throwable LHand }

tels

tels

22.01.2011 16:28

reporter   ~0003473

Looked briefly into it, unfortunately the projectile is choosen at spawntime of the entity that should fire it, not at fire time of the projectile.

That means if you want to fire random projectiles, the AI either needs to defer the lookup of the projectile until it actually wants to use one, or store the entire list of possible projectile entities at spawn and later choose one at random.

Allowing the animation to choose the projectile might also be possible, but haven't looked into that.
solarsplace

solarsplace

26.01.2011 09:20

reporter   ~0003487

Hi Guys

I did something like this in our mod. Basically we have only 1 magic weapon in the game and we replace the projectile def depending on what spell the player is firing.

You just need to add some code in the weapon class to erase the projectile def dictionary and replace it with the information with the new def.

Add some code to choose a random projectile from a list in any other def such as your AI dec and job done.

I seem to remember we had some timing issues with the engine not loading the new def before various actions took place, but we found ways around it.

I can send you some code snippets if you like.

CHeers
greebo

greebo

02.02.2011 07:32

administrator   ~0003536

Done, both:

AI can randomly choose between multiple def_projectile spawnargs:

"def_projectile" "atdm:projectile_broadhead"
"def_projectile1" "atdm:projectile_winebottle"
"def_projectile2" "atdm:projectile_waterarrow"

a new framecommand is available to choose a specific def, this will override any def_projectile spawnargs for that animation.

frame 10 create_missile_from_def atdm:projectile_firearrow LeftHand
greebo

greebo

02.02.2011 07:35

administrator   ~0003537

@Solarsplace: sorry, saw your note too late. Thanks anyway for your offer. :)

Issue History

Date Modified Username Field Change
08.01.2011 15:21 Springheel New Issue
12.01.2011 13:59 Springheel Note Added: 0003443
12.01.2011 14:00 Springheel Note Edited: 0003443
22.01.2011 16:28 tels Note Added: 0003473
26.01.2011 09:20 solarsplace Note Added: 0003487
01.02.2011 19:44 greebo Assigned To => greebo
01.02.2011 19:44 greebo Status new => assigned
02.02.2011 07:31 greebo Product Version => TDM 1.03
02.02.2011 07:31 greebo Target Version => TDM 1.04
02.02.2011 07:31 greebo Description Updated
02.02.2011 07:32 greebo Note Added: 0003536
02.02.2011 07:32 greebo Status assigned => resolved
02.02.2011 07:32 greebo Fixed in Version => TDM 1.04
02.02.2011 07:32 greebo Resolution open => fixed
02.02.2011 07:35 greebo Note Added: 0003537
27.10.2011 05:16 greebo Status resolved => closed