View Issue Details

IDProjectCategoryView StatusLast Update
0002389The Dark ModCodingpublic03.06.2011 03:56
ReporterFidcal Assigned Totels  
PrioritynormalSeveritynormalReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionTDM 1.02 
Target VersionTDM 1.03Fixed in VersionTDM 1.03 
Summary0002389: needs a new spawnarg for callobjectfunction
Descriptionneeds a new spawnarg for callobjectfunction.
Additional Informationhttp://modetwo.net/darkmod/index.php?/topic/11772-can-i-pass-an-entity-name-to-a-map-script/page__view__findpost__p__233433
TagsNo tags attached.

Relationships

related to 0002338 resolvedgrayman Expand m_LastTouchedBy to Movers (doors, elevators) 
related to 0002390 closedtels BinaryFrobMovers do not relay the activator to their targets 

Activities

tels

tels

03.10.2010 09:35

reporter   ~0003220

I added a script event called entity->addItemToInv(target) and it will add entity to the target's inventory. I also added support for "pass_activator" on PostScriptEvent entities.

So to test it:

* get someone to compile a new windows DLL
* update SVN
* dmap and load test/player_notes.map

As you can see, it works when you pass through the arch, but not when you flip a lever. That is because the levers do not relay the activator (e.g. the player) to their target entity, but instead themselves.

I think that is a bug, but I am not sure.

So what do we do now? Fix the binaryFrobMovers to relay the proper activator along? Or work around in the postscript entity somehow?

Adding entity PlayerNotes3 to inventory of atdm_numberwheel_lever_3. (lever flipped, wrong)
Adding entity PlayerNotes01 to inventory of atdm_numberwheel_lever_3.
Adding entity PlayerNotes4 to inventory of player1. (step through portal, right)
Adding entity PlayerNotes7 to inventory of player1.

The code for BinaryFrobMovers indeed has a problem as it doesn't relay the proper activator to its targets.
tels

tels

03.10.2010 19:54

reporter   ~0003221

Okay, this is finally wrapped up :)

I added support for a spawnarg called "foreach" on the atdm:target_callscriptfunction entity.

* if it is 0 (the default), the script function in "call" is called exactly once, without any arguments, as it was before (to not break old maps).
* if it is set to 1, the function is called for each target, and with the following fixed argument order: "FunctionName(target, activator, triggered_entity);"

I modified the test/player_notes.map to use this entity with these spawnargs now. As a bonus, you can now also use "delay" (an initial delay before the first call happens), "wait" (the basis wait time between calls), "wait_add" (a time (positive or negative) that is added to "wait" after each call, and "wait_mul", a factor that is multiplied with "wait" after each call.

So you can call the first function call after X seconds, and eachone coming in faster and faster, or slower and slower etc.

The testmap has an example for this, too. All the ways to add notes to the player inventory in the testmap work now.

To make it easier for mappers, I also added a new global function:

void addToPlayerInventory(entity target, entity activator, entity triggered)
{
        // ignore activator, because:
        // * due to some bugs it sometimes is not the player
        // * when an AI opens a door and this should be the trigger, we still
        // want the item to go into the player inventory
   target.addItemToInv($player1);
}

Hope this finally solves this issue.

Issue History

Date Modified Username Field Change
02.10.2010 18:57 Fidcal New Issue
02.10.2010 18:57 Fidcal Status new => assigned
02.10.2010 18:57 Fidcal Assigned To => tels
03.10.2010 09:34 tels Product Version => TDM 1.02
03.10.2010 09:34 tels Target Version => TDM 1.03
03.10.2010 09:35 tels Note Added: 0003220
03.10.2010 09:35 tels Relationship added related to 0002338
03.10.2010 09:38 tels Relationship added related to 0002390
03.10.2010 19:54 tels Note Added: 0003221
03.10.2010 19:54 tels Status assigned => resolved
03.10.2010 19:54 tels Fixed in Version => TDM 1.03
03.10.2010 19:54 tels Resolution open => fixed
03.06.2011 03:56 greebo Status resolved => closed