Scripts / Problem with KillQuest script...

Author
Message
Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 11th Jan 2016 18:57
Hi,

Needs help using the KillQuest script please...

I use it in my level for the main character have to collect items instead of killing enemies.
The problem is when I collect the items, the message " targets remain " doesn't change (still the quantity of items to collect)

For the object to collect, I use the following commands :
if PlayerDist < 80 and g_PlayerHealth > 0 then
PlaySound(e,0)
Destroy(e)
end

I saw in the KillQuest script this line "if g_Entity[questTargets[currentQuest][c]]['health'] > 0 then" to check if the object still alive or not.
Normally, the collected object is destroyed, (meaning its health is = 0) because I destroy it to collect it...

Is there another command for "g_Entity" to check if the object exist or not ?

Hoping I was clear...

Thanks !
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 11th Jan 2016 19:06
Try inserting this before the destroy command and see if that helps.

SetEntityHealth(e,0)

Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 11th Jan 2016 21:29
Thanks Pirate Myke for the tips... but same result...

The only way to have the " targets remain " message box changing is if I shoot on the object.
In this case, the script works fine... but the "target" objects are still "alive"... and do not disappear...

Note that the script I have associated to the "target" objects is just to make them rotating and for the distance detecting with the player :

local delay = {}
local init_delay = {}
GravityOff(e)

function rotation_objet_init(e)
delay[e] = 25
init_delay[e] = delay[e]
rotation = 0
end

function rotation_objet_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 500 then
if GetTimer(e) > delay[e] then
delay[e] = GetTimer(e) + init_delay[e]
SetRotation(e,0,rotation,0)
rotation = rotation + 5
if rotation > 360 then
rotation = 0
end
end
end
if PlayerDist < 80 and g_PlayerHealth > 0 then
PlaySound(e,0)
SetEntityHealth(e,0)
Destroy(e)
--ActivateIfUsed(e)
end
end
PM
Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 11th Jan 2016 21:41
oups !
Small mistake in my second script :

I put "if PlayerDist < 80 and g_PlayerHealth > 0 then" instead of "if PlayerDist < 80 and g_Entity[e]['health'] > 0 then"
PM
Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 11th Jan 2016 23:17
For clues...

I tested step by step removing some lines in the script of the "target object".

If I remove the line "Destroy(e)" just after "SetEntityHealth(e,0)" the "targets remain" message box change correctly (decrease whenever I am close to a target object) but, of course, the target object doesn't disapears...

Doesn't works if I add the line "Destroy(e)"...

I don't anderstand why !

PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 12th Jan 2016 00:14 Edited at: 12th Jan 2016 00:18
You will need to hide the object instead of destroy it. I will look at the script.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 12th Jan 2016 00:16
try:



Untested yet, since here is too late now.

hth
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 12th Jan 2016 00:59
Thanks guys !

I tested with hide object instead of destroy.
It works fine but the script for the distance detection object still detect it even if the object is hidden...

I mean if the character moves to the area where the object is located, the object is collected and we can ear the sound "PlaySound(e,0)"

Take a look at my other post (sorry I posted it before take a look at your answer...)

Thanks !
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 12th Jan 2016 02:26 Edited at: 12th Jan 2016 02:28
ok, here you go. I cant get the object to rotate thou the debug prompt says that it is.





This has been tested on my machine.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Jan 2016 12:09
it wont rotate with physics on.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 12th Jan 2016 13:01
Thank you.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Mariokiki
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 12th Jan 2016 15:31
Many thanks guys !!

I'll test it right now !


PM

Login to post a reply

Server time is: 2024-12-22 12:41:25
Your offset time is: 2024-12-22 12:41:25