"NPC - Death" and sysval(Param1)

Description: Internal scripting system of SMBX-38A Engine based on the simple VB-like language
Moderators: Lx Xzit, Yoshi021, 5438A38A, Semi-moderatos, Moderators

Pilzinsel64
Topic author, Count
Count
Pilzinsel64
Topic author, Count
Count
Reputation: 42
Posts: 226
Joined: 24 Jan 2016

Post #1by Pilzinsel64 » 8 Jul 2016, 12:07

I don't know if this is a error.
If i killed any NPC, the event "NPC - Death" will be triggering.
This event triggers a script, wich read the sysval "Param1", but in their isn't the npc-id. Why?

KFCMARIO
Good citizen
Good citizen
Avatar
KFCMARIO
Good citizen
Good citizen
Reputation: 21
Posts: 33
Joined: 25 Jan 2016

Post #2by KFCMARIO » 8 Jul 2016, 12:43

According to the script help,"When you are using events to execute scripts,'Param1' is the object ID triggering the event",'Param1' stands for the ID of the NPC triggering the Death Event in your section(An NPC has three kinds of "ID", first is Type ID, like 1 stands for Goomba , 10 for SMB3 coins, second is Sequence ID, like index in an array, third is permanent ID,once an NPC is created it has a unique permanent ID and would not change any more),the 'Param1' is the second, you can use it like " npc( sysval(param1) ) ",for example npc(sysval(param1)).x = 100

Pilzinsel64
Topic author, Count
Count
Pilzinsel64
Topic author, Count
Count
Reputation: 42
Posts: 226
Joined: 24 Jan 2016

Post #3by Pilzinsel64 » 8 Jul 2016, 12:58

KFCMARIO wrote:According to the script help,"When you are using events to execute scripts,'Param1' is the object ID triggering the event",'Param1' stands for the ID of the NPC triggering the Death Event in your section(An NPC has three kinds of "ID", first is Type ID, like 1 stands for Goomba , 10 for SMB3 coins, second is Sequence ID, like index in an array, third is permanent ID,once an NPC is created it has a unique permanent ID and would not change any more),the 'Param1' is the second, you can use it like " npc( sysval(param1) ) ",for example npc(sysval(param1)).x = 100

But there is my problem:
If NPC(sysval(Param1)).ID = 102 Then ... (102 = Red Coin)
If the red coin goes death, i thriggers the event "NPC - Death". For me, this event triggers a Script, wich check, what NPC died.
But the Param1 in sysval don't contains the sequence ID, it is always "0".

KFCMARIO
Good citizen
Good citizen
Avatar
KFCMARIO
Good citizen
Good citizen
Reputation: 21
Posts: 33
Joined: 25 Jan 2016

Post #4by KFCMARIO » 9 Jul 2016, 3:07

Pilzinsel64 wrote:But there is my problem:
If NPC(sysval(Param1)).ID = 102 Then ... (102 = Red Coin)
If the red coin goes death, i thriggers the event "NPC - Death". For me, this event triggers a Script, wich check, what NPC died.
But the Param1 in sysval don't contains the sequence ID, it is always "0".

Do you use "Sleep()" before using sysval(param1) ?
The 'Param1' will only be available in the frame that death event being triggered, because data about the dead NPC will be remove after Death Event.

Pilzinsel64
Topic author, Count
Count
Pilzinsel64
Topic author, Count
Count
Reputation: 42
Posts: 226
Joined: 24 Jan 2016

Post #5by Pilzinsel64 » 9 Jul 2016, 10:23

KFCMARIO wrote:Do you use "Sleep()" before using sysval(param1) ?
The 'Param1' will only be available in the frame that death event being triggered, because data about the dead NPC will be remove after Death Event.

No, i don't.
But it's possible, that the event "NPC - Death" will not directly triggering after a death of an NPC? If yes, then i think 5438A38A have to fix this.

KFCMARIO
Good citizen
Good citizen
Avatar
KFCMARIO
Good citizen
Good citizen
Reputation: 21
Posts: 33
Joined: 25 Jan 2016

Post #6by KFCMARIO » 9 Jul 2016, 12:34

Pilzinsel64 wrote:If NPC(sysval(Param1)).ID = 102 Then ... (102 = Red Coin)
Then...I notice that type id of Red Coin is 103 actually,not 102...

rotom407 M
Nice citizen
Nice citizen
rotom407 M
Nice citizen
Nice citizen
Age: 25
Reputation: 0
Posts: 15
Joined: 28 Jun 2016

Post #7by rotom407 » 9 Jul 2016, 14:21

It seems that 38a forgot to implement this feature for auto-run events.

Pilzinsel64
Topic author, Count
Count
Pilzinsel64
Topic author, Count
Count
Reputation: 42
Posts: 226
Joined: 24 Jan 2016

Post #8by Pilzinsel64 » 9 Jul 2016, 14:56

KFCMARIO wrote:Then...I notice that type id of Red Coin is 103 actually,not 102...

I used 103:
Image

rotom407 wrote:It seems that 38a forgot to implement this feature for auto-run events.
I think this is possible, but bad for me.


Return to “TeaScript”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest