• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Help on Player 16 stealing kills!

Status
Not open for further replies.
Level 3
Joined
Aug 15, 2007
Messages
67
I am making a game where you need to trap the other players with a spell found off this site. When you use it you place a ward on the ground and when somone comes by you activate it collapsing the ground around it and also killing the units in the aoe.

For this game I made a leaderboard which shows the players score and when they kill a unit they are given 10 gold. The problem is every time I use the spell Player 16 takes credit for the kill. I know this because I put in a message that says "(Owner of Killing unit) has killed (Owner of Dieing Unit)" the killing unit is always Player 16.

The part of the spell actually doing the damge is an Ability.

Please any help would be great!
 
Level 3
Joined
Aug 15, 2007
Messages
67
In the spell there is what could be a dummy. "Caster" it is a peasant. Do you mean change the code so its created for the controling player? That woould be very hard for me because I don't know JASS. Here is some of the code...

function TrapDeformStart takes nothing returns nothing
local location casting_loc = InstanceGetMemberLocation(GetThis(), "CastingLoc")
call TerrainDeformCrater(GetLocationX(casting_loc), GetLocationY(casting_loc), 300, 300, 100, true)
set casting_loc = null
endfunction

function TrapDeformEnd takes nothing returns nothing
local location casting_loc = InstanceGetMemberLocation(GetThis(), "CastingLoc")
call TerrainDeformCrater(GetLocationX(casting_loc), GetLocationY(casting_loc), 300, -300, 2000, true)
set casting_loc = null
endfunction

function PBStart takes nothing returns nothing
local string this = GetThis()
local location target_loc = InstanceGetMemberLocation(this, "TargetLoc")
call InstanceSetMemberDestructable(this, "blocker", CreateDestructable('YTpb', GetLocationX(target_loc), GetLocationY(target_loc), 0, 1, 0))
set target_loc = null
endfunction

function PBEnd takes nothing returns nothing
call RemoveDestructable(InstanceGetMemberDestructable(GetThis(), "blocker"))
endfunction

function TrapGroupEffect takes nothing returns nothing
local string this = GetThis()
local location cl = InstanceGetMemberLocation(this, "CastingLoc")
local group g = InstanceGetMemberGroup(this, "TargetGroup")
local unit u = null
call RemoveUnit(InstanceGetMemberUnit(this, "CasterUnit"))
loop
set u = FirstOfGroup(g)
exitwhen u == null
call SetUnitPositionLoc(u, cl)
call GroupRemoveUnit(g, u)
endloop
set g = null
set cl = null
endfunction

function Trig_Trap_Ward_Actions takes nothing returns nothing
local string trap_spell = "S" + I2S('A002') // replace 'A006'with the 4-letter-code of the trap spell in another map
local string fork_sub_spell1 = "S" + I2S('ST04')
local string fork_sub_spell2 = "S" + I2S('ST05')
local string td_sub_spell = "S" + I2S('ST06')
local string pb_all_sub_spell = "S" + I2S('ST07')
local string pb_sub_spell = "S" + I2S('ST08')
local string group_sub_spell = "S" + I2S('ST09')
local string stun_sub_spell = "S" + I2S('ST10')

call CreateClass(trap_spell, "SpellFork")
call ClassSetClassVarInteger(trap_spell, "SpellOne1", 'ST04')
call ClassSetClassVarInteger(trap_spell, "SpellTwo1", 'ST05')

call CreateClass(fork_sub_spell1, "SpellFork")
call ClassSetClassVarInteger(fork_sub_spell1, "SpellOne1", 'ST09')
call ClassSetClassVarInteger(fork_sub_spell1, "SpellTwo1", 'ST06')

call CreateClass(fork_sub_spell2, "SpellFork")
call ClassSetClassVarInteger(fork_sub_spell2, "SpellOne1", 'ST07')
call ClassSetClassVarInteger(fork_sub_spell2, "SpellTwo1", 'ST10')

call CreateClass(td_sub_spell, "DurationSpell")
call ClassSetClassVarReal(td_sub_spell, "Duration1", 20)
call ClassSetClassVarReal(td_sub_spell, "EffectTime1", 22)
call ClassAddFunction(td_sub_spell, "SpellStart", "TrapDeformStart")
call ClassAddFunction(td_sub_spell, "SpellEnd", "TrapDeformEnd")

call CreateClass(pb_all_sub_spell, "AOEPointSpellCircleCast")
call ClassSetClassVarInteger(pb_all_sub_spell, "PointNum1", 22)
call ClassSetClassVarReal(pb_all_sub_spell, "PointDelay1", 0)
call ClassSetClassVarReal(pb_all_sub_spell, "AOERadius1", 280)
call ClassSetClassVarInteger(pb_all_sub_spell, "Spell1", 'ST08')
call ClassSetClassVarInteger(pb_all_sub_spell, "Order1", 0)
call ClassSetClassVarReal(pb_all_sub_spell, "CastDelay", 0.1)

call CreateClass(pb_sub_spell, "DurationSpell")
call ClassSetClassVarReal(pb_sub_spell, "Duration1", 20)
call ClassSetClassVarReal(pb_sub_spell, "EffectTime1", 22)
call ClassAddFunction(pb_sub_spell, "SpellStart", "PBStart")
call ClassAddFunction(pb_sub_spell, "SpellEnd", "PBEnd")
call ClassAddMember(pb_sub_spell, "blocker", "destructable")

call CreateClass(group_sub_spell, "AOEGroupSpellCircle")
call ClassSetClassVarReal(group_sub_spell, "AOERadius1", 300)
call ClassAddFunction(group_sub_spell, "SpellEffect", "TrapGroupEffect")

call CreateClass(stun_sub_spell, "SimpleSpellCast")
call ClassSetClassVarInteger(stun_sub_spell, "Spell1", 'A003') // replace 'A008'with the 4-letter-code of the stomp stun effect in another map
call ClassSetClassVarInteger(stun_sub_spell, "Order1", OrderId("stomp"))
call ClassSetClassVarBoolean(stun_sub_spell, "ImmediateSpell", true)
call ClassSetClassVarReal(stun_sub_spell, "CastDelay", 0.1)

endfunction

//===========================================================================
function InitTrig_Trap_Ward takes nothing returns nothing
set gg_trg_Trap_Ward = CreateTrigger( )
call TriggerAddAction( gg_trg_Trap_Ward, function Trig_Trap_Ward_Actions )
endfunction
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
First of all, threads related to Spells go on the Spells and Systems forum. Second, it might be easier to provide the link to the spell you're using, so people know exactly what they're dealing with, thus giving you more revelant answers.

~Thread Moved
 
this is a perfect example of how a Jass spell downloaded from here by someone who dont know jass can really ruin things up :D. I suck jass and love GUI because there are a number of solutions that i can make in it. However, for no spam... if the player gets gold, Maybe you can add one "Kill point" to the player that recieves gold and remove player 16 from the leaderboard so that it will look like the player killed the unit? but since i have no knowledge of Jass what so ever i cant help much.


EDIT: oh wait.. my mmistake

can you make your own ability? Have a dummy unit, when you cast the trigger on your unit, then it orders the dummy to do a slam, and make the ground undulate violently?
 
Level 9
Joined
Mar 25, 2005
Messages
252
Some of the lines seem to remove some "CasterUnit" but I cant see where that unit is created, so thats propably done by some of these class functions that I have never heard off. If the damage is done by this CasterUnit, then changing it's owner would solve your problem. That is if you have access to the player that should be getting the kill... Have you tried contacting the one who made this spell?
 
Level 3
Joined
Aug 15, 2007
Messages
67
The actual damage is done by an ability called "Trap Stun", the raw code for it is A003. I would not know how to change the player ownership in the code of the spell. I don't even see anything close to that in there.

I can't give points by gold because it wont give the player gold when player 16 takes credit for the kill. Player 16 is not on the leader board.

Thank you so much guys you are helping soo much! It is almost solved I can feel it!
 
Level 3
Joined
Aug 15, 2007
Messages
67
Is there a tutorial that could help me make my own spell of that kind? I want the ground to collapse where it is used and trap/hurt the units inside giving credit to the user of the spell when killing the units. I also want it to be used by multiple heroes simutaniously.
 
Level 10
Joined
Apr 9, 2004
Messages
502
I've had weird problems with killing units with spells from dummy units.... The only way I've gotten around this was having a dummy unit owned by the appropriate damage source, to damage the target. That way always guarantees a kill and that it is allocated to the right target. Damage coming from an ability, for some reason, doesn't work...
 
Status
Not open for further replies.
Top