remove weaponry

» Siedler Map Source Forum » Siedler DEdK Script Forum » remove weaponry

Seiten: 1

AdeBont
#1
30.09.2014 16:49
Beiträge: 666

remove weaponry

I've been scripting along for my third map quite a bit
In the process I must have hacked the update functions that removed weaponry from killed soldiers. Anyone knows which function takes care of that? (so I can add the original function to the hacked function...)

____________________
AdB
---------------------------------
Now faith is the substance of things hoped for,
the evidence of things not seen.
Heb 11:1

mcb
#2
30.09.2014 17:01
Beiträge: 1472

I don't think there is a Lua-function for that... But those weapons are Entities, so an Events.LOGIC_EVENT_ENTITY_DESTROYED-Trigger should detect them. The entitytypes are:

Entities.XD_DroppedAxeShield
Entities.XD_DroppedBow
Entities.XD_DroppedPoleArm
Entities.XD_DroppedShield
Entities.XD_DroppedSword
Entities.XD_DroppedSwordShield
Entities.XD_Evil_LeaderBearman1_Drop
Entities.XD_Evil_LeaderSkirmisher1_Drop

AdeBont
#3
30.09.2014 19:27
Beiträge: 666

Zitat von mcb:
I don't think there is a Lua-function for that... But those weapons are Entities, so an Events.LOGIC_EVENT_ENTITY_DESTROYED-Trigger should detect them. The entitytypes are:

Entities.XD_DroppedAxeShield
Entities.XD_DroppedBow
Entities.XD_DroppedPoleArm
Entities.XD_DroppedShield
Entities.XD_DroppedSword
Entities.XD_DroppedSwordShield
Entities.XD_Evil_LeaderBearman1_Drop
Entities.XD_Evil_LeaderSkirmisher1_Drop


I only have a trigger on Events.LOGIC_EVENT_ENTITY_HURT_ENTITY in my script

____________________
AdB
---------------------------------
Now faith is the substance of things hoped for,
the evidence of things not seen.
Heb 11:1

mcb
#4
30.09.2014 19:32
Beiträge: 1472

Maybe i missunderstood you... What do you want to do with the weapons? Prevent them from being removed?

Zedeg
#5
30.09.2014 20:24
Beiträge: 428

Hello AdeBont!

That's very easy. You cannot set an entity with these drop-models (I don't know why), but you can create new weaponries when the others are removed. The following code works in my map perfectly:

function FirstMapAction()
	Weaponries = {
		["XD_DroppedAxeShield"] = true,
		["XD_DroppedBow"] = true,
		["XD_DroppedPoleArm"] = true,
		["XD_DroppedShield"] = true,
		["XD_DroppedSword"] = true,
		["XD_DroppedSwordShield"] = true,
		["XD_Evil_LeaderBearman1_Drop"] = true,
		["XD_Evil_LeaderSkirmisher1_Drop"] = true,
		["XD_SoldierRifle1_Rifle"] = true,
		["XD_SoldierRifle2_Rifle"] = true,
	}
	Trigger.RequestTrigger(Events.LOGIC_EVENT_ENTITY_DESTROYED, "", "WeaponryHack", 1)
end

function WeaponryHack()
	local entity = Event.GetEntityID()
	local entityType = Logic.GetEntityTypeName(Logic.GetEntityType(entity))
	if Weaponries[entityType] then
		local position = GetPosition(entity)
		local orientation = Logic.GetEntityOrientation(entity)
		Message"Weaponry dropped"
		Logic.CreateEntity(Entities[entityType], position.X, position.Y, orientation, 0)
	end
end



Hope, this helps you.

Zedeg

____________________
Journalisten erkundigen sich bei Wissenschaftlern meist nicht nach Grundlagen, sondern eher nach Ergebnissen und Folgerungen. Das erklärt womöglich auch, warum sich Forschungsberichte in den Medien so häufig als feststehende Erkenntnisse lesen, nicht aber als Ideen, Entdeckungen oder Indizien, um die es sich genau genommen in den meisten Fällen handelt. -Axel Bojowski

Seiten: 1

SiteEngine v1.5.0 by nevermind, ©2005-2007
Design by SpiderFive (www.siedler-games.de) - English translation by juja

Impressum